Skip to content

Commit

Permalink
add execute payment method
Browse files Browse the repository at this point in the history
  • Loading branch information
dipudey committed Sep 15, 2022
1 parent 7a0161c commit 1a9abfa
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/Payment/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ private function initPayment($invoice)
return $response;
}


/**
* Redirect Nagad Payment Checkout Page
* Create payment
*
* @param float $amount
* @param string $invoice
*
* @return Application|RedirectResponse|Redirector
* @throws NagadException
* @return mixed
* @throws InvalidPrivateKey
* @throws InvalidPublicKey
* @throws NagadException
*/

public function create($amount, $invoice)
{
$initialize = $this->initPayment($invoice);
Expand Down Expand Up @@ -85,9 +85,15 @@ public function create($amount, $invoice)
throw new NagadException($response->message);
}

if ($response->status == "Success") {
return redirect($response->callBackUrl);
}
return $response;
}
}

public function executePayment($amount, $invoice)
{
$response = $this->create($amount, $invoice);
if ($response->status == "Success") {
return redirect($response->callBackUrl);
}
}

Expand Down

0 comments on commit 1a9abfa

Please sign in to comment.