mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 22:22:32 +01:00
Process merchantAccountId
with Braintree transactions
This commit is contained in:
parent
535e0b93aa
commit
146cd8bc66
@ -88,14 +88,30 @@ class CreditCard
|
||||
|
||||
$token = $this->getPaymentToken($request->all(), $customer->id);
|
||||
|
||||
$result = $this->braintree->gateway->transaction()->sale([
|
||||
$data = [
|
||||
'amount' => $this->braintree->payment_hash->data->amount_with_fee,
|
||||
'paymentMethodToken' => $token,
|
||||
'deviceData' => $state['client-data'],
|
||||
'options' => [
|
||||
'submitForSettlement' => true
|
||||
],
|
||||
]);
|
||||
];
|
||||
|
||||
if ($this->braintree->company_gateway->getConfigField('merchantAccountId')) {
|
||||
/** https://developer.paypal.com/braintree/docs/reference/request/transaction/sale/php#full-example */
|
||||
$data['merchantAccountId'] = $this->braintree->company_gateway->getConfigField('merchantAccountId');
|
||||
}
|
||||
|
||||
try {
|
||||
$result = $this->braintree->gateway->transaction()->sale($data);
|
||||
} catch(\Exception $e) {
|
||||
if ($e instanceof \Braintree\Exception\Authorization) {
|
||||
throw new PaymentFailed(ctrans('texts.generic_gateway_error'), $e->getCode());
|
||||
}
|
||||
|
||||
throw new PaymentFailed($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
|
||||
if ($result->success) {
|
||||
$this->braintree->logSuccessfulGatewayResponse(['response' => $request->server_response, 'data' => $this->braintree->payment_hash], SystemLog::TYPE_BRAINTREE);
|
||||
|
@ -4302,6 +4302,7 @@ $LANG = array(
|
||||
'checking' => 'Checking',
|
||||
'savings' => 'Savings',
|
||||
'unable_to_verify_payment_method' => 'Unable to verify payment method.',
|
||||
'generic_gateway_error' => 'Gateway configuration error. Please check your credentials.',
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
Loading…
Reference in New Issue
Block a user