Reference made dynamic
This commit is contained in:
parent
d9b73bac43
commit
6920fbbbe7
@ -8,7 +8,7 @@ trait Omnipay
|
|||||||
|
|
||||||
public $factory;
|
public $factory;
|
||||||
|
|
||||||
public function authorize($invoice, $request, $extra_options = [])
|
public function authorize($invoice, $request, $extra_options = [], $reference = 'getTransactionReference')
|
||||||
{
|
{
|
||||||
$default_options = [
|
$default_options = [
|
||||||
'amount' => $invoice->amount,
|
'amount' => $invoice->amount,
|
||||||
@ -36,9 +36,9 @@ trait Omnipay
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($response->isSuccessful()) {
|
if ($response->isSuccessful()) {
|
||||||
$this->setReference($invoice, $response->getTransactionReference());
|
$this->setReference($invoice, $response->$reference());
|
||||||
|
|
||||||
$options['transactionReference'] = $response->getTransactionReference();
|
$options[lcfirst(str_replace('get', '', $reference))] = $response->$reference();
|
||||||
|
|
||||||
$response = $this->gateway->capture($options)->send();
|
$response = $this->gateway->capture($options)->send();
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ trait Omnipay
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($response->isRedirect()) {
|
if ($response->isRedirect()) {
|
||||||
$this->setReference($invoice, $response->getTransactionReference());
|
$this->setReference($invoice, $response->$reference());
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'error' => false,
|
'error' => false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user