Working on GoCardless

This commit is contained in:
Hillel Coren 2017-08-21 19:08:49 +03:00
parent 9be7c92625
commit 3695a1e476
8 changed files with 408 additions and 248 deletions

View File

@ -271,11 +271,9 @@ if (! defined('APP_NAME')) {
define('GATEWAY_SAGE_PAY_DIRECT', 20); define('GATEWAY_SAGE_PAY_DIRECT', 20);
define('GATEWAY_SAGE_PAY_SERVER', 21); define('GATEWAY_SAGE_PAY_SERVER', 21);
define('GATEWAY_STRIPE', 23); define('GATEWAY_STRIPE', 23);
define('GATEWAY_GOCARDLESS', 6);
define('GATEWAY_TWO_CHECKOUT', 27); define('GATEWAY_TWO_CHECKOUT', 27);
define('GATEWAY_BEANSTREAM', 29); define('GATEWAY_BEANSTREAM', 29);
define('GATEWAY_PSIGATE', 30); define('GATEWAY_PSIGATE', 30);
define('GATEWAY_MOOLAH', 31);
define('GATEWAY_BITPAY', 42); define('GATEWAY_BITPAY', 42);
define('GATEWAY_DWOLLA', 43); define('GATEWAY_DWOLLA', 43);
define('GATEWAY_CHECKOUT_COM', 47); define('GATEWAY_CHECKOUT_COM', 47);
@ -283,6 +281,7 @@ if (! defined('APP_NAME')) {
define('GATEWAY_WEPAY', 60); define('GATEWAY_WEPAY', 60);
define('GATEWAY_BRAINTREE', 61); define('GATEWAY_BRAINTREE', 61);
define('GATEWAY_CUSTOM', 62); define('GATEWAY_CUSTOM', 62);
define('GATEWAY_GOCARDLESS', 64);
// The customer exists, but only as a local concept // The customer exists, but only as a local concept
// The remote gateway doesn't understand the concept of customers // The remote gateway doesn't understand the concept of customers

View File

@ -64,6 +64,7 @@ class AccountGateway extends EntityModel
public static function paymentDriverClass($provider) public static function paymentDriverClass($provider)
{ {
$folder = 'App\\Ninja\\PaymentDrivers\\'; $folder = 'App\\Ninja\\PaymentDrivers\\';
$provider = str_replace('\\', '', $provider);
$class = $folder . $provider . 'PaymentDriver'; $class = $folder . $provider . 'PaymentDriver';
$class = str_replace('_', '', $class); $class = str_replace('_', '', $class);

View File

@ -47,6 +47,7 @@ class Gateway extends Eloquent
GATEWAY_BRAINTREE, GATEWAY_BRAINTREE,
GATEWAY_AUTHORIZE_NET, GATEWAY_AUTHORIZE_NET,
GATEWAY_MOLLIE, GATEWAY_MOLLIE,
GATEWAY_GOCARDLESS,
GATEWAY_CUSTOM, GATEWAY_CUSTOM,
]; ];

View File

@ -0,0 +1,17 @@
<?php
namespace App\Ninja\PaymentDrivers;
class GoCardlessV2RedirectPaymentDriver extends BasePaymentDriver
{
protected function paymentDetails($paymentMethod = false)
{
$data = parent::paymentDetails($paymentMethod);
if ($ref = request()->redirect_flow_id) {
$data['transaction_reference'] = $ref;
}
return $data;
}
}

View File

@ -37,6 +37,7 @@
"descubraomundo/omnipay-pagarme": "dev-master", "descubraomundo/omnipay-pagarme": "dev-master",
"digitickets/omnipay-barclays-epdq": "~3.0", "digitickets/omnipay-barclays-epdq": "~3.0",
"digitickets/omnipay-datacash": "~3.0", "digitickets/omnipay-datacash": "~3.0",
"digitickets/omnipay-gocardlessv2": "dev-master",
"digitickets/omnipay-realex": "~5.0", "digitickets/omnipay-realex": "~5.0",
"dioscouri/omnipay-cybersource": "dev-master", "dioscouri/omnipay-cybersource": "dev-master",
"doctrine/dbal": "2.5.x", "doctrine/dbal": "2.5.x",
@ -161,6 +162,10 @@
{ {
"type": "vcs", "type": "vcs",
"url": "https://github.com/hillelcoren/l5-google-cloud-storage" "url": "https://github.com/hillelcoren/l5-google-cloud-storage"
},
{
"type": "vcs",
"url": "https://github.com/hillelcoren/omnipay-gocardlessv2"
} }
] ]
} }

614
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'CardSave', 'provider' => 'CardSave'], ['name' => 'CardSave', 'provider' => 'CardSave'],
['name' => 'Eway Rapid', 'provider' => 'Eway_RapidShared', 'is_offsite' => true], ['name' => 'Eway Rapid', 'provider' => 'Eway_RapidShared', 'is_offsite' => true],
['name' => 'FirstData Connect', 'provider' => 'FirstData_Connect'], ['name' => 'FirstData Connect', 'provider' => 'FirstData_Connect'],
['name' => 'GoCardless', 'provider' => 'GoCardless', 'is_offsite' => true], ['name' => 'GoCardless', 'provider' => 'GoCardless', 'is_offsite' => true, 'payment_library_id' => 2],
['name' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'], ['name' => 'Migs ThreeParty', 'provider' => 'Migs_ThreeParty'],
['name' => 'Migs TwoParty', 'provider' => 'Migs_TwoParty'], ['name' => 'Migs TwoParty', 'provider' => 'Migs_TwoParty'],
['name' => 'Mollie', 'provider' => 'Mollie', 'is_offsite' => true, 'sort_order' => 7], ['name' => 'Mollie', 'provider' => 'Mollie', 'is_offsite' => true, 'sort_order' => 7],
@ -70,12 +70,15 @@ class PaymentLibrariesSeeder extends Seeder
['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 2], ['name' => 'WeChat Express', 'provider' => 'WeChat_Express', 'payment_library_id' => 2],
['name' => 'WePay', 'provider' => 'WePay', 'is_offsite' => false], ['name' => 'WePay', 'provider' => 'WePay', 'is_offsite' => false],
['name' => 'Braintree', 'provider' => 'Braintree', 'sort_order' => 2], ['name' => 'Braintree', 'provider' => 'Braintree', 'sort_order' => 2],
['name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 8], ['name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 9],
['name' => 'FirstData Payeezy', 'provider' => 'FirstData_Payeezy'], ['name' => 'FirstData Payeezy', 'provider' => 'FirstData_Payeezy'],
//['name' => 'GoCardless', 'provider' => 'GoCardlessV2\Redirect', 'sort_order' => 8, 'is_offsite' => true],
]; ];
foreach ($gateways as $gateway) { foreach ($gateways as $gateway) {
$record = Gateway::where('name', '=', $gateway['name'])->first(); $record = Gateway::whereName($gateway['name'])
->whereProvider($gateway['provider'])
->first();
if ($record) { if ($record) {
$record->fill($gateway); $record->fill($gateway);
$record->save(); $record->save();

View File

@ -45,3 +45,7 @@
{!! Former::populateField(GATEWAY_BRAINTREE . '_merchantId', env('BRAINTREE_TEST_MERCHANT_ID')) !!} {!! Former::populateField(GATEWAY_BRAINTREE . '_merchantId', env('BRAINTREE_TEST_MERCHANT_ID')) !!}
{!! Former::populateField(GATEWAY_BRAINTREE . '_testMode', 1) !!} {!! Former::populateField(GATEWAY_BRAINTREE . '_testMode', 1) !!}
{!! Former::populateField('enable_paypal', 1) !!} {!! Former::populateField('enable_paypal', 1) !!}
{!! Former::populateField(GATEWAY_GOCARDLESS . '_accessToken', env('GOCARDLESS_TEST_TOKEN')) !!}
{!! Former::populateField(GATEWAY_GOCARDLESS . '_testMode', 1) !!}