Commit 1d2a781f authored by Anthony.Suerte's avatar Anthony.Suerte

CCD Solution [Failed Payment Filter]

parent 93304414
......@@ -69,6 +69,13 @@ class APNWebHook extends System{
}
}
private function updateTempCCDepositTransaction($tempDepositData){
$this -> accessModify("UPDATE_TEMP_CCDEPOSIT", [
"('){$tempDepositData["invoice_num"]}(')",
$tempDepositData["credited"]
], false);
}
private function creditTransaction($tempDepositData){
$comment = "[APN Reference No.]\\n{$tempDepositData["invoice_num"]}";
......@@ -93,8 +100,6 @@ class APNWebHook extends System{
NO_COUNT,
$tempDepositData[COLUMN_MESSAGE],
], false);
$this -> accessModify("UPDATE_TEMP_CCDEPOSIT", ["('){$tempDepositData["invoice_num"]}(')"], false);
}
private function sendTransactionCompleteNotice($txn){
......@@ -117,6 +122,26 @@ class APNWebHook extends System{
, VAR_CS_MAIL_ADDRESS);
}
private function sendTransactionFailedNotice($txn){
$member = $this -> getRowData($this -> getAccountCommon($txn[COLUMN_USER_ACCOUNT]));
$params = [
$member[COLUMN_USER_ACCOUNT],
$this -> getNameCommon($member[COLUMN_USER_ACCOUNT]),
$txn[COLUMN_TRANSACTION_NUMBER],
date("Y-m-d H:i:s"),
$txn["currency"],
$this -> intToCurrency($txn[COLUMN_AMOUNT] + $txn[COLUMN_FEE], $txn[COLUMN_CURRENCY]),
$txn["currency"],
$this -> intToCurrency($txn[COLUMN_AMOUNT], $txn[COLUMN_CURRENCY])
];
$this -> sendMailByTmp('deposit_ccd_fail.xml'
, $params
, $this -> getColumnData($member, COLUMN_MAIL)
, VAR_CS_MAIL_ADDRESS);
}
private function isJSON($string){
return is_string($string)
&& is_array(json_decode($string, true))
......@@ -154,19 +179,41 @@ class APNWebHook extends System{
$tempDepositData = $this -> apnIntegration -> getTempDepositDataBy('invoice_num', $decpload -> reference);
if($tempDepositData){
if(!$tempDepositData["credited"]){
$this -> creditTransaction($tempDepositData);
if($tempDepositData["credited"] == 0){
$tempDepositData["deposit_date"] = date("Y-m-d H:i:s");
switch($decpload -> status){
case "PAID":{
$tempDepositData["credited"] = 1;
$tempDepositData["deposit_date"] = date("Y-m-d H:i:s");
$this -> creditTransaction($tempDepositData);
$this -> updateTempCCDepositTransaction($tempDepositData);
$this -> sendTransactionCompleteNotice($tempDepositData);
break;
}
$message = print_r($tempDepositData, true);
case "FAILED":{
$tempDepositData["credited"] = 2;
$this -> updateTempCCDepositTransaction($tempDepositData);
$this -> sendTransactionFailedNotice($tempDepositData);
break;
}
}
$this -> sendTransactionCompleteNotice($tempDepositData);
$tempDepositData["amount"] = $this -> intToCurrency($tempDepositData["amount"], $tempDepositData["currency"]);
$tempDepositData["fee"] = $this -> intToCurrency($tempDepositData["fee"], $tempDepositData["currency"]);
$message = print_r($tempDepositData, true);
error_log("[$msgtime]\n{$message}\n\n", 3, "Logs/APN/{$fileName}");
}else
}else{
switch($tempDepositData["credited"]){
case 1:
error_log("[$msgtime]\nInvoice Already Credited: {$decpload -> reference}\n\n", 3, "Logs/APN/{$fileName}");
break;
case 2:
error_log("[$msgtime]\nFailed Invoice: {$decpload -> reference}\n\n", 3, "Logs/APN/{$fileName}");
break;
}
}
}else
error_log("[$msgtime]\nReference num doesn't exist: {$decpload -> reference}\n\n", 3, "Logs/APN/{$fileName}");
}else{
......
<?xml version="1.0" encoding="UTF-8"?>
<MAIL>
<title>【iWallet】クレジットカード入金が失敗しました/Failed Deposit via Credit Card Deposit Solution</title>
<body>
__ELEMENT01__ __ELEMENT02__ 様
平素よりiWalletをご利用いただき、誠にありがとうございます。
クレジットカード決済が失敗しました。
日時:__ELEMENT04__(GMT +8)
お支払い金額: __ELEMENT05__ __ELEMENT06__
カード決済失敗の原因は、下記が考えられます。
・間違ったカード情報の詳細
・残高不足
・ご申請額はご入金限度額の範囲外となります。
別のご入金方法をご利用ください。
ご質問やご不明な点などございましたら、いつでもお気軽にお問合せ下さいませ。
今後ともiWalletを何卒宜しくお願い申し上げます。
__ELEMENT01__ Mr./Ms. __ELEMENT02__
Thank you for using iWallet.
Your credit card deposit request failed.
Transaction time/date : __ELEMENT04__(GMT +8)
Payment amount :__ELEMENT05__ __ELEMENT06__
The possible causes of the transaction failing are as follows:
· Wrong card information details
· Insufficient Funds
· The amount you are trying to deposit is outside the payment limit
Please try again or use another card once you have confirmed the above reasons. You may also use another deposit method to complete your transaction.
 
If you have any questions or inquiries, please do not hesitate to contact us.
We are committed to providing our customers with the highest quality of service.
━━━━━━━━━━━━━━━━━━
iWallet Customer Support
URL:https://secure.iwl.world/
Email:cs@iwl.world
━━━━━━━━━━━━━━━━━━
</body>
</MAIL>
......@@ -11736,7 +11736,7 @@ WHERE
<UPDATE_TEMP_CCDEPOSIT>
UPDATE t_deposit_credit_card_temporary
SET credited = '1' where invoice_num = __ELEMENT01__
SET credited = '__ELEMENT02__' where invoice_num = __ELEMENT01__
</UPDATE_TEMP_CCDEPOSIT>
<INSERT_TRANSACTION_TOKEN>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment