Skip to content

Commit bba571a

Browse files
authored
Merge pull request #132 from academe/master
Issue #130 documentation changes
2 parents 9f24c0e + 24210c2 commit bba571a

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ php:
55
- 7.0
66
- 7.1
77
- 7.2
8+
- 7.3
89

910
before_script:
1011
- composer install -n --dev --prefer-source

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ Table of Contents
3434
* [Server Notification Handler](#server-notification-handler)
3535
* [Sage Pay Form Methods](#sage-pay-form-methods)
3636
* [Form Authorize](#form-authorize)
37+
* [Form completeAuthorise](#form-completeauthorise)
3738
* [Form Purchase](#form-purchase)
38-
* [Sage Pay Shared Methods (Direct and Server)](#sage-pay-shared-methods-for-both-direct-and-server)
39+
* [Sage Pay Shared Methods (Direct and Server)](#sage-pay-shared-methods-direct-and-server)
3940
* [Repeat Authorize/Purchase](#repeat-authorizepurchase)
4041
* [Capture](#capture)
4142
* [Delete Card](#delete-card)
@@ -681,7 +682,10 @@ At the gateway, the user will authenticate or authorise their credit card,
681682
perform any 3D Secure actions that may be requested, then will return to the
682683
merchant site.
683684

684-
To get the result details, the transaction is "completed" on return:
685+
### Form completeAuthorise
686+
687+
To get the result details, the transaction is "completed" on the
688+
user's return. This wil be at your `returnUrl` endpoint:
685689

686690
```php
687691
// The result will be read and decrypted from the return URL (or failure URL)
@@ -696,14 +700,30 @@ $result->getTransactionReference();
696700

697701
If you already have the encrypted response string, then it can be passed in.
698702
However, you would normally leave it for the driver to read it for you from
699-
the current server request:
703+
the current server request, so the following would not normally be necessary:
700704

701705
$crypt = $_GET['crypt']; // or supplied by your framework
702706
$result = $gateway->completeAuthorize(['crypt' => $crypt])->send();
703707

704708
This is handy for testing or if the current page query parameters are not
705709
available in a particular architecture.
706710

711+
It is important to make sure this result is what was expected by your
712+
merchant site.
713+
Your transaction ID will be returned in the result and can be inspected:
714+
715+
$result->getTransactionId()
716+
717+
You *must* make sure this transaction ID matches the one you sent
718+
the user off with in the first place (store it in your session).
719+
If they do no match, then you cannot trust the result, as the user
720+
could be running two checkout flows at the same time, possibly
721+
for wildly different amounts.
722+
723+
In a future release, the `completeAuthorize()` method will expect the
724+
`transactionId` to be supplied and it must match before it will
725+
return a success status.
726+
707727
Like `Server` and `Direct`, you can use either the `DEFERRED` or the `AUTHENTICATE`
708728
method to reserve the amount.
709729

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
"name": "Adrian Macneil",
2020
"email": "adrian@adrianmacneil.com"
2121
},
22+
{
23+
"name": "Jason Judge",
24+
"email": "jason.judge@academe.co.uk"
25+
},
2226
{
2327
"name": "Omnipay Contributors",
2428
"homepage": "https://github.com/thephpleague/omnipay-sagepay/contributors"

src/Message/Form/CompleteAuthorizeRequest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getTxType()
3333
public function getData()
3434
{
3535
// The application has the option of passing the query parameter
36-
// in, perhaps using its own middleware, or allowing Omnipay t0
36+
// in, perhaps using its own middleware, or allowing Omnipay to
3737
// provide it.
3838

3939
$crypt = $this->getCrypt() ?: $this->httpRequest->query->get('crypt');
@@ -45,7 +45,7 @@ public function getData()
4545
}
4646

4747
// Remove the leading '@' and decrypt the remainder into a query string.
48-
// And E_WARNING error will be issued if the crypt parameter data is not
48+
// An InvalidResponseException is thrown if the crypt parameter data is not
4949
// a hexadecimal string.
5050

5151
$hexString = substr($crypt, 1);
@@ -64,6 +64,9 @@ public function getData()
6464

6565
parse_str($queryString, $data);
6666

67+
// The result will be ASCII data only, being a very restricted set of
68+
// IDs and flags, so can be treated as UTF-8 without any conversion.
69+
6770
return($data);
6871
}
6972

0 commit comments

Comments
 (0)