mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
GoCardless Integration update #872
This commit is contained in:
parent
82a94c1612
commit
3052168b1d
@ -96,8 +96,10 @@ class AccountGatewayToken extends Eloquent
|
|||||||
} elseif ($accountGateway->gateway_id == GATEWAY_BRAINTREE) {
|
} elseif ($accountGateway->gateway_id == GATEWAY_BRAINTREE) {
|
||||||
$merchantId = $accountGateway->getConfigField('merchantId');
|
$merchantId = $accountGateway->getConfigField('merchantId');
|
||||||
$testMode = $accountGateway->getConfigField('testMode');
|
$testMode = $accountGateway->getConfigField('testMode');
|
||||||
|
|
||||||
return $testMode ? "https://sandbox.braintreegateway.com/merchants/{$merchantId}/customers/{$this->token}" : "https://www.braintreegateway.com/merchants/{$merchantId}/customers/{$this->token}";
|
return $testMode ? "https://sandbox.braintreegateway.com/merchants/{$merchantId}/customers/{$this->token}" : "https://www.braintreegateway.com/merchants/{$merchantId}/customers/{$this->token}";
|
||||||
|
} elseif ($accountGateway->gateway_id == GATEWAY_GOCARDLESS) {
|
||||||
|
$testMode = $accountGateway->getConfigField('testMode');
|
||||||
|
return $testMode ? "https://manage-sandbox.gocardless.com/customers/{$this->token}" : "https://manage.gocardless.com/customers/{$this->token}";
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,16 +2,72 @@
|
|||||||
|
|
||||||
namespace App\Ninja\PaymentDrivers;
|
namespace App\Ninja\PaymentDrivers;
|
||||||
|
|
||||||
|
use Session;
|
||||||
|
|
||||||
class GoCardlessV2RedirectPaymentDriver extends BasePaymentDriver
|
class GoCardlessV2RedirectPaymentDriver extends BasePaymentDriver
|
||||||
{
|
{
|
||||||
|
protected $transactionReferenceParam = "\x00*\x00id";
|
||||||
|
|
||||||
|
public function gatewayTypes()
|
||||||
|
{
|
||||||
|
$types = [
|
||||||
|
GATEWAY_TYPE_BANK_TRANSFER,
|
||||||
|
GATEWAY_TYPE_TOKEN,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $types;
|
||||||
|
}
|
||||||
|
|
||||||
protected function paymentDetails($paymentMethod = false)
|
protected function paymentDetails($paymentMethod = false)
|
||||||
{
|
{
|
||||||
$data = parent::paymentDetails($paymentMethod);
|
$data = parent::paymentDetails($paymentMethod);
|
||||||
|
|
||||||
|
if ($paymentMethod) {
|
||||||
|
$data['mandate_reference'] = $paymentMethod->source_reference;
|
||||||
|
}
|
||||||
|
|
||||||
if ($ref = request()->redirect_flow_id) {
|
if ($ref = request()->redirect_flow_id) {
|
||||||
$data['transaction_reference'] = $ref;
|
$data['transaction_reference'] = $ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function shouldCreateToken()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function completeOffsitePurchase($input)
|
||||||
|
{
|
||||||
|
$details = $this->paymentDetails();
|
||||||
|
$this->purchaseResponse = $response = $this->gateway()->completePurchase($details)->send();
|
||||||
|
|
||||||
|
if (! $response->isSuccessful()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$paymentMethod = $this->createToken();
|
||||||
|
$payment = $this->completeOnsitePurchase(false, $paymentMethod);
|
||||||
|
|
||||||
|
return $payment;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function creatingCustomer($customer)
|
||||||
|
{
|
||||||
|
$customer->token = $this->purchaseResponse->getCustomerId();
|
||||||
|
|
||||||
|
return $customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function creatingPaymentMethod($paymentMethod)
|
||||||
|
{
|
||||||
|
$paymentMethod->source_reference = $this->purchaseResponse->getMandateId();
|
||||||
|
$paymentMethod->payment_type_id = PAYMENT_TYPE_ACH;
|
||||||
|
$paymentMethod->status = PAYMENT_METHOD_STATUS_VERIFIED;
|
||||||
|
|
||||||
|
return $paymentMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +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-gocardlessv2": "dev-payment-fix",
|
||||||
"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",
|
||||||
|
14
composer.lock
generated
14
composer.lock
generated
@ -4,8 +4,8 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "21e71e6ce0568744f92aca427b7f103b",
|
"hash": "a39a505121abab0985f7c0cb1734920c",
|
||||||
"content-hash": "a052186eb2c4093936e61fe22d93255f",
|
"content-hash": "4067bb1f3c6d2b3397e3a005b642ddb6",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "agmscode/omnipay-agms",
|
"name": "agmscode/omnipay-agms",
|
||||||
@ -1429,16 +1429,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "digitickets/omnipay-gocardlessv2",
|
"name": "digitickets/omnipay-gocardlessv2",
|
||||||
"version": "dev-master",
|
"version": "dev-payment-fix",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/hillelcoren/omnipay-gocardlessv2.git",
|
"url": "https://github.com/hillelcoren/omnipay-gocardlessv2.git",
|
||||||
"reference": "007c29256a4df6e2d149d8a239474f80028e8601"
|
"reference": "a264ac71dcdb7c03f42f17cb52c650d87e42f8e0"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/hillelcoren/omnipay-gocardlessv2/zipball/007c29256a4df6e2d149d8a239474f80028e8601",
|
"url": "https://api.github.com/repos/hillelcoren/omnipay-gocardlessv2/zipball/a264ac71dcdb7c03f42f17cb52c650d87e42f8e0",
|
||||||
"reference": "007c29256a4df6e2d149d8a239474f80028e8601",
|
"reference": "a264ac71dcdb7c03f42f17cb52c650d87e42f8e0",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1511,7 +1511,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/hillelcoren/omnipay-gocardlessv2/tree/master"
|
"source": "https://github.com/hillelcoren/omnipay-gocardlessv2/tree/master"
|
||||||
},
|
},
|
||||||
"time": "2017-08-21 09:54:55"
|
"time": "2017-08-21 18:05:05"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "digitickets/omnipay-realex",
|
"name": "digitickets/omnipay-realex",
|
||||||
|
@ -72,7 +72,7 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
['name' => 'Braintree', 'provider' => 'Braintree', 'sort_order' => 2],
|
['name' => 'Braintree', 'provider' => 'Braintree', 'sort_order' => 2],
|
||||||
['name' => 'Custom', 'provider' => 'Custom', 'is_offsite' => true, 'sort_order' => 9],
|
['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],
|
['name' => 'GoCardless', 'provider' => 'GoCardlessV2\Redirect', 'sort_order' => 8, 'is_offsite' => true],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($gateways as $gateway) {
|
foreach ($gateways as $gateway) {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -439,7 +439,7 @@ $LANG = array(
|
|||||||
'reset_all' => 'Reset All',
|
'reset_all' => 'Reset All',
|
||||||
'approve' => 'Approve',
|
'approve' => 'Approve',
|
||||||
'token_billing_type_id' => 'Token Billing',
|
'token_billing_type_id' => 'Token Billing',
|
||||||
'token_billing_help' => 'Store payment details with WePay, Stripe or Braintree.',
|
'token_billing_help' => 'Store payment details with WePay, Stripe, Braintree or GoCardless.',
|
||||||
'token_billing_1' => 'Disabled',
|
'token_billing_1' => 'Disabled',
|
||||||
'token_billing_2' => 'Opt-in - checkbox is shown but not selected',
|
'token_billing_2' => 'Opt-in - checkbox is shown but not selected',
|
||||||
'token_billing_3' => 'Opt-out - checkbox is shown and selected',
|
'token_billing_3' => 'Opt-out - checkbox is shown and selected',
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
<div id="gateway_{{ $gateway->id }}_div" class='gateway-fields' style="display: none">
|
||||||
@foreach ($gateway->fields as $field => $details)
|
@foreach ($gateway->fields as $field => $details)
|
||||||
|
|
||||||
@if ($details && !$accountGateway && !is_array($details))
|
@if ($details && !$accountGateway && !is_array($details) && !is_bool($details))
|
||||||
{!! Former::populateField($gateway->id.'_'.$field, $details) !!}
|
{!! Former::populateField($gateway->id.'_'.$field, $details) !!}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user