Skip to content

Commit 1a9abfa

Browse files
committed
add execute payment method
1 parent 7a0161c commit 1a9abfa

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/Payment/Payment.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ private function initPayment($invoice)
4545
return $response;
4646
}
4747

48+
4849
/**
49-
* Redirect Nagad Payment Checkout Page
50+
* Create payment
5051
*
5152
* @param float $amount
5253
* @param string $invoice
5354
*
54-
* @return Application|RedirectResponse|Redirector
55-
* @throws NagadException
55+
* @return mixed
5656
* @throws InvalidPrivateKey
5757
* @throws InvalidPublicKey
58+
* @throws NagadException
5859
*/
59-
6060
public function create($amount, $invoice)
6161
{
6262
$initialize = $this->initPayment($invoice);
@@ -85,9 +85,15 @@ public function create($amount, $invoice)
8585
throw new NagadException($response->message);
8686
}
8787

88-
if ($response->status == "Success") {
89-
return redirect($response->callBackUrl);
90-
}
88+
return $response;
89+
}
90+
}
91+
92+
public function executePayment($amount, $invoice)
93+
{
94+
$response = $this->create($amount, $invoice);
95+
if ($response->status == "Success") {
96+
return redirect($response->callBackUrl);
9197
}
9298
}
9399

0 commit comments

Comments
 (0)