mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-15 15:24:35 -04: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);
|
$token = $this->getPaymentToken($request->all(), $customer->id);
|
||||||
|
|
||||||
$result = $this->braintree->gateway->transaction()->sale([
|
$data = [
|
||||||
'amount' => $this->braintree->payment_hash->data->amount_with_fee,
|
'amount' => $this->braintree->payment_hash->data->amount_with_fee,
|
||||||
'paymentMethodToken' => $token,
|
'paymentMethodToken' => $token,
|
||||||
'deviceData' => $state['client-data'],
|
'deviceData' => $state['client-data'],
|
||||||
'options' => [
|
'options' => [
|
||||||
'submitForSettlement' => true
|
'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) {
|
if ($result->success) {
|
||||||
$this->braintree->logSuccessfulGatewayResponse(['response' => $request->server_response, 'data' => $this->braintree->payment_hash], SystemLog::TYPE_BRAINTREE);
|
$this->braintree->logSuccessfulGatewayResponse(['response' => $request->server_response, 'data' => $this->braintree->payment_hash], SystemLog::TYPE_BRAINTREE);
|
||||||
|
@ -4302,6 +4302,7 @@ $LANG = array(
|
|||||||
'checking' => 'Checking',
|
'checking' => 'Checking',
|
||||||
'savings' => 'Savings',
|
'savings' => 'Savings',
|
||||||
'unable_to_verify_payment_method' => 'Unable to verify payment method.',
|
'unable_to_verify_payment_method' => 'Unable to verify payment method.',
|
||||||
|
'generic_gateway_error' => 'Gateway configuration error. Please check your credentials.',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user