Skip to content

Commit 4cd81c9

Browse files
committed
updated abusement checklist methods
1 parent 4c000b5 commit 4cd81c9

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

src/Provider/AsanPardakhtProvider.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,16 @@ public function sendParamToAp(array $params, string $url, string $method): mixed
189189

190190
protected function getGatewayOrderIdFromCallBackParameters(): string
191191
{
192-
return (string) $this->getParameters('ResNum');
192+
return (string) $this->getTransaction()->getFromJsonb(key: 'salesOrderID', filedName: 'gateway_callback_params');
193193
}
194194

195195
protected function callbackAbuseCheckList(): void
196196
{
197-
parent::callbackAbuseCheckList(); // checks order id
198-
199-
if ((int) $this->getParameters('amount') !== $this->getTransaction()->getPayableAmount()) {
200-
throw new Exception('shaparak::shaparak.could_not_pass_abuse_checklist');
201-
}
202-
203-
if ((string) $this->getParameters('refID') !== $this->getTransaction()->getGatewayToken()) {
197+
if (!(
198+
$this->getGatewayOrderIdFromCallBackParameters() === (string)$this->getTransaction()->gateway_order_id
199+
&& (int)$this->getTransaction()->getFromJsonb(key: 'amount', filedName: 'gateway_callback_params') === $this->getTransaction()->getPayableAmount()
200+
&& (string)$this->getTransaction()->getFromJsonb(key: 'refID', filedName: 'gateway_callback_params') === $this->getTransaction()->getGatewayToken()
201+
)) {
204202
throw new Exception('shaparak::shaparak.could_not_pass_abuse_checklist');
205203
}
206204
}

src/Provider/MellatProvider.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,11 @@ protected function getGatewayOrderIdFromCallBackParameters(): string
9595

9696
protected function callbackAbuseCheckList(): void
9797
{
98-
parent::callbackAbuseCheckList();
99-
100-
if ((int) $this->getParameters('FinalAmount') !== $this->getTransaction()->getPayableAmount()) {
101-
throw new Exception('shaparak::shaparak.could_not_pass_abuse_checklist');
102-
}
103-
104-
if ((string) $this->getParameters('refID') !== $this->getTransaction()->getGatewayToken()) {
98+
if (!(
99+
(string)$this->getTransaction()->gateway_order_id === $this->getGatewayOrderIdFromCallBackParameters()
100+
&& (int)$this->getParameters('FinalAmount') === $this->getTransaction()->getPayableAmount()
101+
&& (string)$this->getParameters('refID') === $this->getTransaction()->getGatewayToken()
102+
)) {
105103
throw new Exception('shaparak::shaparak.could_not_pass_abuse_checklist');
106104
}
107105
}

0 commit comments

Comments
 (0)