mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Inject MAID in client token create & payment method create
This commit is contained in:
parent
c4a4d4d25c
commit
8a2d3a4958
@ -61,6 +61,13 @@ class CreditCard
|
|||||||
$data['gateway'] = $this->braintree;
|
$data['gateway'] = $this->braintree;
|
||||||
$data['client_token'] = $this->braintree->gateway->clientToken()->generate();
|
$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);
|
return render('gateways.braintree.credit_card.pay', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,13 +143,20 @@ class CreditCard
|
|||||||
|
|
||||||
$gateway_response = \json_decode($data['gateway_response']);
|
$gateway_response = \json_decode($data['gateway_response']);
|
||||||
|
|
||||||
$response = $this->braintree->gateway->paymentMethod()->create([
|
$data = [
|
||||||
'customerId' => $customerId,
|
'customerId' => $customerId,
|
||||||
'paymentMethodNonce' => $gateway_response->nonce,
|
'paymentMethodNonce' => $gateway_response->nonce,
|
||||||
'options' => [
|
'options' => [
|
||||||
'verifyCard' => true,
|
'verifyCard' => true,
|
||||||
],
|
],
|
||||||
]);
|
];
|
||||||
|
|
||||||
|
if ($this->braintree->company_gateway->getConfigField('merchantAccountId')) {
|
||||||
|
/** https://developer.paypal.com/braintree/docs/reference/request/payment-method/create#options.verification_merchant_account_id */
|
||||||
|
$data['verificationMerchantAccountId'] = $this->braintree->company_gateway->getConfigField('merchantAccountId');
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $this->braintree->gateway->paymentMethod()->create($data);
|
||||||
|
|
||||||
if ($response->success) {
|
if ($response->success) {
|
||||||
return $response->paymentMethod->token;
|
return $response->paymentMethod->token;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user