Skip to content

Commit

Permalink
Updating some docs and comments..
Browse files Browse the repository at this point in the history
  • Loading branch information
judgej committed Jan 23, 2018
1 parent d090230 commit 201b50c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,19 @@ The capture/refund/void methods are also available.
A simple authorize will look like this:

```php
use Money\Money;
use Money\Currency;

$gateway->setPaymentType(Gateway::PAYMENT_TYPE_CREDIT_CARD);

$authRequest = $gateway->authorize([
'transactionId' => $yourMerchantTransactionId,
'amount' => '1.23',
//
// Several ways to supply the amount:
'amount' => '4.56',
'amount' => new Money(456, new Currency('EUR')),
'amount' => Money::EUR(456),
//
'currency' => 'EUR',
'description' => 'Mandatory reason for the transaction',
'language' => 'en',
Expand Down Expand Up @@ -261,7 +269,7 @@ The required amount can be captured using this request:
```php
$captureRequest = $gateway->capture([
'transactionId' => $yourMerchantTransactionId,
'amount' => '1.23',
'amount' => Money::EUR(123),
'currency' => 'EUR',
'description' => 'Capture reason is required',
'transactionReference' => 'original authorize transaction reference',
Expand Down Expand Up @@ -317,8 +325,8 @@ $gateway->setPaymentType(Gateway::PAYMENT_TYPE_DIRECTDEBIT);

$authRequest = $gateway->authorize([
'transactionId' => $yourMerchantTransactionId,
'amount' => '4.56',
'currency' => 'EUR',
'amount' => Money::EUR(456),
'currency' => 'EUR', // Optional if the amount is Money
'description' => 'Mandatory reason for the transaction',
'language' => 'en',
'returnUrl' => 'url to bring the user back to the merchant site',
Expand Down Expand Up @@ -397,7 +405,7 @@ $gateway->setPaymentType(Gateway::PAYMENT_TYPE_PAYPAL);

$authRequest = $gateway->purchase([
'transactionId' => $yourMerchantTransactionId,
'amount' => '7.89',
'amount' => Money::EUR(789),
'currency' => 'EUR',
'description' => 'Mandatory reason for the transaction',
'returnUrl' => 'url to bring the user back to the merchant site',
Expand Down Expand Up @@ -483,7 +491,7 @@ There is no `authorize` capability, just `purchase`.
```php
$request = $gateway->purchase([
'transactionId' => $transactionId,
'amount' => '1.23',
'amount' => Money::EUR(123),
'currency' => 'EUR',
'description' => 'Transaction ' . $transactionId,
'returnUrl' => 'url to bring the user back to the merchant site',
Expand Down Expand Up @@ -556,11 +564,11 @@ Since Omnipay 2.x (or 3.x at this time) does not define the units cart items use
some assumptions will be made and conversions performed as follows (all these
formats are treated as the same amount, namely 123 minor units, such as €1.23):

* `Money\Money::EUR(123)` => 123
* String '1.23' => 123
* String '123' => 123
* Integer 123 => 123
* Float 1.23 => 123
* `Money\Money::EUR(123)`
* String '1.23'
* String '123'
* Integer 123
* Float 1.23

If no currency is set explicitly with `setCurrency()` then it will be taken from the amount
if using a `Money\Money` object.
Expand Down
5 changes: 4 additions & 1 deletion src/Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class Gateway extends AbstractGateway
{
/**
* @var string
* @var string supported payment types
*/
const PAYMENT_TYPE_CREDIT_CARD = 'CreditCard';
const PAYMENT_TYPE_PAYPAL = 'PayPal';
Expand All @@ -25,6 +25,9 @@ class Gateway extends AbstractGateway
const PAYMENT_TYPE_PAYDIREKT = 'Paydirekt';
const PAYMENT_TYPE_PAYMENTPAGE = 'PaymentPage';

/**
* @var string payment types supported but not fully tested and documented
*/
const PAYMENT_TYPE_MAESTRO = 'Maestro';
const PAYMENT_TYPE_IDEAL = 'iDEAL';
const PAYMENT_TYPE_EPS = 'eps';
Expand Down
7 changes: 0 additions & 7 deletions src/Message/AuthorizeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ class AuthorizeRequest extends AbstractRequest
const RECURRING_YES = 1;
const RECURRING_NO = 0;

/**
* @var int Flag to indicate a variant on the UI.
* VARIANT_PAGE is for when a user is present and visits the payment page.
*/
const VARIANT_PAGE = 'page';
const VARIANT_OFFLINE = 'offline';

/**
* @var int 1 to 4
* 1 = single payment (default)
Expand Down

0 comments on commit 201b50c

Please sign in to comment.