Skip to content

Commit 570df6b

Browse files
authored
Merge pull request #117 from academe/issue112
Issue112
2 parents 7cf1f13 + 0aa8bf9 commit 570df6b

File tree

2 files changed

+42
-38
lines changed

2 files changed

+42
-38
lines changed

README.md

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ if using this API.
8888

8989
The Direct gateway methods for handling cards are:
9090

91-
* authorize() - with completeAuthorize for 3D Secure and PayPal redirect
92-
* purchase() - with completePurchase for 3D Secure and PayPal redirect
93-
* createCard() - explicit "standalone" creation of a cardReference or token
91+
* `authorize()` - with completeAuthorize for 3D Secure and PayPal redirect
92+
* `purchase()` - with completePurchase for 3D Secure and PayPal redirect
93+
* `createCard()` - explicit "standalone" creation of a cardReference or token
9494

9595
*Note: PayPal is not yet implemented in this driver.*
9696

@@ -129,7 +129,7 @@ $requestMessage = $gateway->purchase([
129129
'currency' => 'GBP',
130130
'card' => $card,
131131
'transactionId' => $transactionId,
132-
'description' => 'Pizzas for everyone',
132+
'description' => 'Pizzas for everyone at PHPNE',
133133

134134
// If 3D Secure is enabled, then provide a return URL for
135135
// when the user comes back from 3D Secure authentication.
@@ -158,12 +158,12 @@ if ($responseMessage->isRedirect()) {
158158
}
159159
```
160160

161-
That redirect method is intended just for testing.
162-
Create your own instead, within the rules of your framework, using:
161+
That `redirect()` method is intended just for demonstration or testing.
162+
Create your own instead, within your framework, using these helpers:
163163

164-
* $responseMessage->getRedirectUrl()
165-
* $responseMessage->getRedirectMethod()
166-
* $responseMessage->getRedirectData()
164+
* `$responseMessage->getRedirectUrl()`
165+
* `$responseMessage->getRedirectMethod()`
166+
* `$responseMessage->getRedirectData()`
167167

168168
#### Redirect Return
169169

@@ -248,10 +248,11 @@ Sage Pay Server uses your IP address to authenticate backend access to the
248248
gateway, and it also needs to a public URL that it can send back-channel
249249
notifications to. This makes development on a localhost server difficult.
250250

251-
* authorize()
252-
* purchase()
253-
* createCard() - explicit "standalone" creation of a cardReference or token
254-
* acceptNotification() - Notification Handler for authorize, purchase and explicit cardReference registration
251+
* `authorize()`
252+
* `purchase()`
253+
* `createCard()` - explicit "standalone" creation of a cardReference or token
254+
* `acceptNotification()` - Notification Handler for authorize, purchase and
255+
explicit cardReference registration
255256

256257
### Server Gateway
257258

@@ -594,6 +595,12 @@ since the result will be safely saved in the database.
594595

595596
Sage Pay Form requires neither a server-to-server back-channel nor
596597
IP-based security.
598+
It does not require pre-registration of a transaction, so is ideal for
599+
a speculative "pay now" button on a page for instant purchases of a
600+
product or service.
601+
Unlike `Direct` and `Server`, it does not support saved card references
602+
or tokens.
603+
597604
The payment details are encrypted on the server before being sent to
598605
the gateway from the user's browser.
599606
The result is returned to the merchant site also through a client-side
@@ -604,8 +611,8 @@ in the "My Sage Pay" administration panel.
604611

605612
Supported functions are:
606613

607-
* authorize()
608-
* purchase()
614+
* `authorize()`
615+
* `purchase()`
609616

610617
### Form Authorize
611618

@@ -622,7 +629,7 @@ $gateway = OmniPay::create('SagePay\Form')->initialize([
622629

623630
The `encryptionKey` is generated in "My Sage Pay" when logged in as the administrator.
624631

625-
Note that this gateway will assume all inout data (names, addresses etc.)
632+
Note that this gateway will assume all input data (names, addresses etc.)
626633
are UTF-8 encoded.
627634
It will then recode the data to ISO8859-1 before encrypting it for the gateway,
628635
as the gateway strictly accepts ISO8859-1 only, regardless of what encoding is
@@ -643,12 +650,12 @@ $response = $gateway->authorize([
643650
]);
644651
```
645652

646-
The `$response` will be a `POST` redirect, which will take use to the gateway.
653+
The `$response` will be a `POST` redirect, which will take the user to the gateway.
647654
At the gateway, the user will authenticate or authorise their credit card,
648655
perform any 3D Secure actions that may be requested, then will return to the
649656
merchant site.
650657

651-
To get the result details, the transaction is "completed":
658+
To get the result details, the transaction is "completed" on return:
652659

653660
```php
654661
// The result will be read and decrypted from the return URL (or failure URL)
@@ -661,13 +668,18 @@ $result->getTransactionReference();
661668
// etc.
662669
```
663670

664-
If you already have the encrypted response string, then it can be optionally
665-
passed in:
671+
If you already have the encrypted response string, then it can be passed in.
672+
However, you would normally leave it for the driver to read it for you from
673+
the current server request:
666674

675+
$crypt = $_GET['crypt']; // or supplied by your framework
667676
$result = $gateway->completeAuthorize(['crypt' => $crypt])->send();
668677

669-
This should normally not be necessary, but is handy for testing or if the
670-
current page query parameters are not available in a particular architecture.
678+
This is handy for testing or if the current page query parameters are not
679+
available in a particular architecture.
680+
681+
Like `Server` and `Direct`, you can use either the `DEFERRED` or the `AUTHENTICATE`
682+
method to reserve the amount.
671683

672684
### Form Purchase
673685

@@ -680,13 +692,13 @@ Note: these functions do not work for the `Form` API.
680692
These actions for `Sage Pay Form` must be performed manually through the "My Sage Pay"
681693
admin panel.
682694

683-
* capture()
684-
* refund()
685-
* void() - void a purchase
686-
* abort() - abort an authorization before it is captured
687-
* repeatAuthorize() - new authorization based on past transaction
688-
* repeatPurchase() - new purchase based on past transaction
689-
* deleteCard() - remove a cardReference or token from the accout
695+
* `capture()`
696+
* `refund()`
697+
* `void()` - void a purchase
698+
* `abort()` - abort an authorization before it is captured
699+
* `repeatAuthorize()` - new authorization based on past transaction
700+
* `repeatPurchase()` - new purchase based on past transaction
701+
* `deleteCard()` - remove a cardReference or token from the accout
690702

691703
### Repeat Authorize/Purchase
692704

@@ -886,7 +898,6 @@ but is also the only format currently supported by some of the Sage accounting p
886898
For applications that require this type of integration, an optional parameter `useOldBasketFormat`
887899
with a value of `true` can be passed in the driver's `initialize()` method.
888900

889-
890901
## Sage 50 Accounts Software Integration
891902

892903
The Basket format can be used for Sage 50 Accounts Software Integration:

src/Message/Form/AuthorizeRequest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,6 @@ public function getCryptData()
9393
{
9494
$data = $this->getBaseAuthorizeData();
9595

96-
// CHECKME: are tokens supported?
97-
98-
if ($this->getToken() || $this->getCardReference()) {
99-
// If using a token, then set that data.
100-
$data = $this->getTokenData($data);
101-
}
102-
10396
// Some [optional] parameters specific to Sage Pay Form..
10497

10598
if ($this->getCustomerName() !== null) {
@@ -144,7 +137,7 @@ public function getCryptData()
144137
$data = array_intersect_key($data, $this->validFields);
145138

146139
// Throw exception if any mandatory fields are missing.
147-
// We need to catch it here before sending the user to an
140+
// We need to catch it here before sending the user to a
148141
// generic (and useless) error on the gateway site.
149142

150143
foreach ($this->validFields as $fieldName => $mandatoryFlag) {

0 commit comments

Comments
 (0)