Skip to content

Commit

Permalink
set dynamic Payment Identity for Sadad (#181)
Browse files Browse the repository at this point in the history
Use payment_identity from invoice details if present otherwise use default settings
  • Loading branch information
hos3ein authored Mar 15, 2023
1 parent cdf32a4 commit 5aa9a0f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Drivers/Sadad/Sadad.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,17 @@ public function purchase()
$mobile = "";
}

//set PaymentIdentity for payment
if (!empty($this->invoice->getDetails()['payment_identity'])) {
$paymentIdentity = $this->invoice->getDetails()['payment_identity'];
} else {
$paymentIdentity = $this->settings->PaymentIdentity;
}

$data = array(
'MerchantId' => $this->settings->merchantId,
'ReturnUrl' => $this->settings->callbackUrl,
'PaymentIdentity' => $this->settings->PaymentIdentity,
'PaymentIdentity' => $paymentIdentity,
'LocalDateTime' => $iranTime->format("m/d/Y g:i:s a"),
'SignData' => $signData,
'TerminalId' => $terminalId,
Expand Down

0 comments on commit 5aa9a0f

Please sign in to comment.