Skip to content

Commit 057bcac

Browse files
Merge pull request #14 from cashfree/version_bump_2.1.0
Check if transaction id exist or not
2 parents c0423f3 + 3bf71e1 commit 057bcac

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

modules/gateways/callback/cashfree.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@
9494

9595
if ($success === true)
9696
{
97+
/**
98+
* Check Callback Transaction ID.
99+
*
100+
* Performs a check for any existing transactions with the same given
101+
* transaction number.
102+
*
103+
* Performs a die upon encountering a duplicate.
104+
105+
* @param string $transactionId
106+
*/
107+
checkCbTransID($transactionId);
108+
97109
# Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
98110
addInvoicePayment($invoiceId, $transactionId, $paymentAmount, 0, $gatewayParams["name"]);
99111
# Successful

modules/gateways/callback/cashfree_notify.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
$order = localAPI($command, $invoiceData);
2626

2727
//Execute notify url after 10 sec of execution return url
28-
sleep(10);
28+
sleep(30);
2929
if($order['totalresults'] === 0 or $result['orders']['order'][0]['status'] === 'Paid')
3030
{
3131
return;
@@ -55,6 +55,18 @@
5555
$error ="WHMCS_ERROR:Request to Cashfree Failed";
5656
}
5757

58+
/**
59+
* Check Callback Transaction ID.
60+
*
61+
* Performs a check for any existing transactions with the same given
62+
* transaction number.
63+
*
64+
* Performs a die upon encountering a duplicate.
65+
66+
* @param string $transactionId
67+
*/
68+
checkCbTransID($transactionId);
69+
5870
# Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
5971
addInvoicePayment($invoiceId, $transactionId, $paymentAmount, 0, $gatewayParams["name"]);
6072
if ($success === true)

0 commit comments

Comments
 (0)