1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 06:32:40 +01:00

Merge pull request #6636 from beganovich/v5-686

Braintree: Add MAID references
This commit is contained in:
David Bomba 2021-09-14 21:58:40 +10:00 committed by GitHub
commit 62c1e2488d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,13 @@ class CreditCard
$data['gateway'] = $this->braintree;
$data['client_token'] = $this->braintree->gateway->clientToken()->generate();
if ($this->braintree->company_gateway->getConfigField('merchantAccountId')) {
/** https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#merchant_account_id */
$data['client_token'] = $this->braintree->gateway->clientToken()->generate([
'merchantAccountId' => $this->braintree->company_gateway->getConfigField('merchantAccountId')
]);
}
return render('gateways.braintree.credit_card.pay', $data);
}
@ -136,13 +143,15 @@ class CreditCard
$gateway_response = \json_decode($data['gateway_response']);
$response = $this->braintree->gateway->paymentMethod()->create([
$data = [
'customerId' => $customerId,
'paymentMethodNonce' => $gateway_response->nonce,
'options' => [
'verifyCard' => true,
],
]);
];
$response = $this->braintree->gateway->paymentMethod()->create($data);
if ($response->success) {
return $response->paymentMethod->token;