-
Notifications
You must be signed in to change notification settings - Fork 2
Clearing existing CC failure log if any when cc is charged successfully #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
09c2137
170d646
68e46b3
132b928
696e867
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -501,6 +501,21 @@ function charge_card($custid, $amount = false, $invoice = false, $module = 'defa | |
| } | ||
| //Prepay Invoices updates ends | ||
| } | ||
| //Clear out this CC Decline history | ||
| $db->query("SELECT * FROM user_log WHERE history_owner = {$custid} AND history_type = 'carddecline'", __LINE__, __FILE__); | ||
| if ($db->num_rows() > 0) { | ||
| $history_id = null; | ||
| while ($db->next_record(MYSQL_ASSOC)) { | ||
| if ($cc == $GLOBALS['tf']->decrypt($db->Record['history_new_value'])) { | ||
| $history_id = $db->Record['history_id']; | ||
| break; | ||
| } | ||
| } | ||
| if ($history_id && intval($history_id) > 0) { | ||
| $history_id = intval($history_id); | ||
| $db->query("DELETE FROM user_log WHERE history_id = $history_id", __LINE__, __FILE__); | ||
| } | ||
| } | ||
|
kumar-interserver marked this conversation as resolved.
|
||
| break; | ||
| default: | ||
| myadmin_log('billing', 'notice', 'FAILURE (custid:'.$custid.',exp:'.$cc_exp.',cc:'.mask_cc($cc, true).',amount:'.$amount.', code:'.$response['code'].') raw: '.$cc_response, __LINE__, __FILE__); | ||
|
|
@@ -571,6 +586,7 @@ function charge_card($custid, $amount = false, $invoice = false, $module = 'defa | |
| if ( | ||
| count($ccs) > 1 && //more than 1 cc present then proceed | ||
| RETRY_CC == 1 && //When CC Retry is enabled from config | ||
| $returnURL === false && //is to work only when billingd calls | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 The new Extended reasoning...The changeLine 588 adds The problemThe retry branch and the "force customer to paypal" branch are the two arms of the same if/else. They were already paired before this PR: if (count($ccs) > 1 && RETRY_CC == 1 && (... ot_cc logic ...)) {
// log carddecline + retry with backup CC
$retval = retry_charge_card(...);
} else {
// force account onto paypal
App::accounts()->update($custid, ['payment_method' => 'paypal', 'cc_auto' => '0']);
}Adding Real caller verified
Addressing the refutationOne verifier argued this is pre-existing because "at the PR base (commit 64eec63) the paypal switch ran unconditionally after every CC failure." That is inspecting the wrong commit. PR #18 begins at The second half of the refutation — that losing the retry on webpage declines is intentional per the inline comment — is half true. The inline comment documents intent to gate the retry; the force-paypal side effect on webpage callers is not acknowledged anywhere and is almost certainly unintentional. Step-by-step proofScenario: customer 100 has primary CC
Before this PR the same scenario entered the retry arm, attempted the backup CC, and logged the decline — none of those outcomes were changed-to-paypal. Suggested fixEither gate the paypal fallback on the same billingd-only check: } elseif ($returnURL === false) {
App::accounts()->update($custid, ['payment_method' => 'paypal', 'cc_auto' => '0']);
}or keep retry webpage-accessible and drop the new gate. The key point is the force-paypal side effect should not fire on webpage-initiated charges just because retry was suppressed. |
||
| (!isset(App::variables()->request['ot_cc']) || isset(App::variables()->request['retry_cc'])) | ||
| ) { | ||
| $cc_encrypted = $GLOBALS['tf']->encrypt(trim(str_replace([' ', '_', '-'], ['', '', ''], $cc))); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.