Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
arif98741 committed Mar 8, 2021
2 parents d6849c1 + f9106a1 commit cb404ab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ class Base
*/
public function __construct($config, $params)
{

$this->keyObject = new Key($config);

$this->amount = $params['amount'];
$this->invoice = $params['invoice'];
$this->merchantID = $this->keyObject->getAppMerchantID();
Expand All @@ -96,11 +94,13 @@ public function __construct($config, $params)
/**
* Final Send Request to Nagad
* @param Base $base
* @return array
* @throws \Exception
*/
public function payNow(Base $base)
{
$request = new RequestHandler($base);
$request->sendRequest();
return $request->sendRequest();
}

/**
Expand Down
12 changes: 9 additions & 3 deletions src/RequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

namespace NagadApi;

use NagadApi\Exception\ExceptionHandler;

/**
* This is the main performer that means request handler for entire nagadApi
* This class is doing extra-ordinary job according to request type.
Expand Down Expand Up @@ -61,6 +63,7 @@ public function __construct(Base $base)
/**
* Fire request to nagad api
* @return array
* @throws \Exception
*/
public function sendRequest()
{
Expand All @@ -81,11 +84,13 @@ public function sendRequest()
'sensitiveData' => $this->helper->EncryptDataWithPublicKey(json_encode($sensitiveData)),
'signature' => $this->helper->SignatureGenerate(json_encode($sensitiveData))
);

$resultData = $this->helper->HttpPostMethod($postUrl, $postData);
$this->initUrl = $postUrl;
if (is_array($resultData) && array_key_exists('reason', $resultData)) {

if ($resultData === NULL) {
return $resultData;

} else if ($resultData === NULL) {
return $this->response = [
'status' => 'error',
'response' => [
Expand Down Expand Up @@ -136,7 +141,7 @@ public function sendRequest()
'merchantCallbackURL' => $this->base->merchantCallback,

);
$OrderSubmitUrl = $this->base->getBaseUrl() . "remote-payment-gateway-1.0/api/dfs/check-out/complete/"
$OrderSubmitUrl = $this->base->getBaseUrl() . "api/dfs/check-out/complete/"
. $paymentReferenceId;

$Result_Data_Order = $this->helper->HttpPostMethod($OrderSubmitUrl, $PostDataOrder);
Expand Down Expand Up @@ -182,4 +187,5 @@ public function sendRequest()
}

}

}

0 comments on commit cb404ab

Please sign in to comment.