updated omnipay

This commit is contained in:
denisdulici 2020-01-01 16:41:06 +03:00
parent dd4af839c7
commit 851e60d43b

View File

@ -38,15 +38,24 @@ trait Omnipay
if ($response->isSuccessful()) {
$this->setReference($invoice, $response->getTransactionReference());
$response = $this->gateway->capture([
'amount' => $invoice->amount,
'currency' => $invoice->currency_code,
'transactionId' => $this->getReference($invoice),
])->send();
$options['transactionReference'] = $response->getTransactionReference();
$response = $this->gateway->capture($options)->send();
return $this->finish($invoice, $request);
}
if ($response->isRedirect()) {
$this->setReference($invoice, $response->getTransactionReference());
return response()->json([
'error' => false,
'redirect' => $response->getRedirectUrl(),
'success' => false,
'data' => $response->getRedirectData(),
]);
}
return $this->failure($invoice, $response);
}
@ -187,4 +196,15 @@ trait Omnipay
return $this->factory;
}
public function setCardFirstLastName(&$request)
{
$contact = explode(" ", $request['cardName']);
$last_name = array_pop($contact);
$first_name = implode(" ", $contact);
$request['cardFirstName'] = $first_name;
$request['cardLastName'] = $last_name;
}
}