Commit c9fa4fc6 authored by Antonio.Suerte's avatar Antonio.Suerte

Help2Pay Migration [Withdrawal Webhook Validation Enhancement]

parent 435afa02
......@@ -108,67 +108,65 @@ class H2PWithdrawalWebhook extends System {
//log the access details
$this -> logEvent("Accessed: {$response}", VAL_INT_1);
if($this -> transactionNum != NO_STRING && $this -> transactionKey != NO_STRING){
if($this -> transactionNum != NO_STRING && $this -> transactionKey != NO_STRING){
$result = $this -> getRowData($this -> accessSelect('SELECT_WITHDRAW_H2P_TEMP', array($this -> transactionNum)));
if($this -> isLoopData($result)){
$resultData = print_r($result, true);
$this -> logEvent("Withdrawal Transaction Data: {$resultData}", VAL_INT_1);
$memberCode = $this -> getColumnData($result, COLUMN_USER_ACCOUNT);
$bankCode = $this -> getColumnData($result, COLUMN_RECEIPT_BANK_NAME);
$language = $this -> getColumnData($result, COLUMN_LANGUAGE);
$memberCode = $this -> getColumnData($result, COLUMN_USER_ACCOUNT);
$bankCode = $this -> getColumnData($result, COLUMN_RECEIPT_BANK_NAME);
$language = $this -> getColumnData($result, COLUMN_LANGUAGE);
if(strcasecmp($this -> transactionKey, $this -> getColumnData($result, "api_key")) === 0){
$param = [];
$param = [];
if($this -> memberCode == $memberCode){
$param[] = $this -> transactionNum;
$param[] = $response.'Bank_code:'.$bankCode;
if($this -> memberCode == $memberCode){
$param[] = $this -> transactionNum;
$param[] = $response.'Bank_code:'.$bankCode;
switch($this -> status){
case "000":
//update withdraw
$param[] = VAL_INT_2;
$this -> accessModifyCommon('UPDATE_WITHDRAW_H2P_STATUS', $param);
$this -> accessModifyCommon('UPDATE_WITHDRAW_H2P_TEMP_STATUS', $param);
$this -> sendMailByTmp(
"{$language}/withdraw_h2p_success.xml",
$this -> emailParams($this -> status, $result),
$this -> getUserEMailCommon($memberCode),
VAR_CS_MAIL_ADDRESS
);
$this -> logEvent("success status:\r\n\r\n{$response}", VAL_INT_3);
break;
case "001":
//update withdraw
$param[] = VAL_INT_5;
$this -> accessModifyCommon('UPDATE_WITHDRAW_H2P_STATUS', $param);
$this -> accessModifyCommon('UPDATE_WITHDRAW_H2P_TEMP_STATUS', $param);
$this -> sendMailByTmp("{$language}/withdraw_h2p_fail.xml",
$this -> emailParams($this -> status, $result),
$this -> getUserEMailCommon($memberCode),
VAR_CS_MAIL_ADDRESS
);
$this -> logEvent("nfail status:\r\n\r\n{$response}", VAL_INT_2);
break;
default:
//error, status not valid
$this -> logEvent("Error status code invalid:\r\n\r\n{$response}\r\n{$this -> status}", VAL_INT_2);
break;
}
}else{
//error, member code not valid
$this -> logEvent("Error member code invalid: {$memberCode}", VAL_INT_2);
}
switch($this -> status){
case "000":
//update withdraw
$param[] = VAL_INT_2;
$this -> accessModifyCommon('UPDATE_WITHDRAW_H2P_STATUS', $param);
$this -> accessModifyCommon('UPDATE_WITHDRAW_H2P_TEMP_STATUS', $param);
$this -> sendMailByTmp(
"{$language}/withdraw_h2p_success.xml",
$this -> emailParams($this -> status, $result),
$this -> getUserEMailCommon($memberCode),
VAR_CS_MAIL_ADDRESS
);
$this -> logEvent("success status:\r\n\r\n{$response}", VAL_INT_3);
break;
case "001":
//update withdraw
$param[] = VAL_INT_5;
$this -> accessModifyCommon('UPDATE_WITHDRAW_H2P_STATUS', $param);
$this -> accessModifyCommon('UPDATE_WITHDRAW_H2P_TEMP_STATUS', $param);
$this -> sendMailByTmp("{$language}/withdraw_h2p_fail.xml",
$this -> emailParams($this -> status, $result),
$this -> getUserEMailCommon($memberCode),
VAR_CS_MAIL_ADDRESS
);
$this -> logEvent("nFailed Status:\r\n\r\n{$response}", VAL_INT_2);
break;
default:
//error, status not valid
$this -> logEvent("Invalid Status Code:\r\n\r\n{$response}\r\n{$this -> status}", VAL_INT_2);
break;
}
}else{
//error, status not valid
$this -> logEvent("Key invalid:\r\n\r\n{$response}", VAL_INT_2);
}
//error, member code not valid
$this -> logEvent("Invalid Member Code: {$this -> memberCode}", VAL_INT_2);
}
}else{
//error, transaction num not valid
$this -> logEvent("Invalid Transaction Number:\r\n\r\n{$this -> transactionNum}", VAL_INT_2);
}
}
}
......
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