POSTCHARGE Bug - v 4.0.1

27 views
Skip to first unread message

acpan22

unread,
Nov 6, 2019, 7:18:41 AM11/6/19
to as...@googlegroups.com
Hi,

I did a POSTCHARGE, assuming it is to deduct from user account balance (because i am guessing POSTCHARGE  means to deduct since the other option is Recharge, the name is quite ambiguous), and it was deducted successfully, but the email was sent as Recharge and notified user the total amount after adding the postcharged amount, instead of the balance after deduction.


Also google for meaning of POSTCHRAGE but can't find this term, If it is deduct, why not just name it as deduct or debit? or actually there is other meaning to it?


Thanks
ACP

acpan22

unread,
Nov 6, 2019, 10:52:17 AM11/6/19
to as...@googlegroups.com
Okay, i fixed the bug, here are the steps to fix:

Step 1: Add "account_postcharged" type to this file

File: opt/ASTPP/web_interface/astpp/application/modules/accounts/controller/accounts.php

Around line: 1538
$customer_info['refill_amount'] = $post_array['credit'];
// @@ fix sent email wrong for POSTCHARGE
if ($post_array['payment_type'] == 0)
{
  $customer_info['balance'] = $customer_info['balance'] + $customer_info['refill_amount'];
  $this->common->mail_to_users('account_refilled', $customer_info);
}
else
{
  // Note: I assume POSTCHAGE field still uses refill_amount, same as REFILL.
  $customer_info['balance'] = $customer_info['balance'] - $customer_info['refill_amount'];
  $this->common->mail_to_users('account_postcharged', $customer_info);
}    
// @@ fix sent email wrong for POSTCHARGE
Enter code here...

Step 2: Add the account_postcharged case for mail_to_users function

File for send email: /opt/ASTPP/web_interface/astpp/application/libraries/astpp/common.php
Around Line: 1351

Functions: mail_to_users is missing case 'account_postcharged': 

// @@ this is missing
case 'account_postcharged':
  $subject = str_replace('#REFILLBALANCE#', $accountinfo['refill_amount'], $subject);
    $message = str_replace('#NAME#', $accountinfo['first_name'] . " " . $accountinfo['last_name'], $message);
      $message = str_replace('#REFILLBALANCE#', $accountinfo['refill_amount'], $message);
    $message = str_replace('#BALANCE#', $accountinfo['balance'], $message);
$message = str_replace('#COMPANY_WEBSITE#', $company_website, $message);
       $message = str_replace('#COMPANY_EMAIL#', $settings_reply_email, $message);
    break;
// @@ this is missing

Step 3: Duplicate the account_refilled in the default_template database table and add the missing "account_postcharged" into the table, sample data below:

39
---------------------
account_postcharged
---------------------
Your account has been debited WITH #REFILLBALANCE#
---------------------
Account postcharge notification template
---------------------
Dear #FIRST_NAME#, Your account has been debited with #REFILLBALANCE#. Your new balance is #BALANCE#. Thanks, #COMPANY_NAME#
---------------------
<p>Your account has been debited WITH #REFILLBALANCE#. Your new balance is
#BALANCE#.</p>
---------------------
<p>Dear #NAME#,</p>

<p>Your account has been debited with #REFILLBALANCE#.</p>

<p>Your account new balance is #BALANCE#.</p>

<p>For more info, please visit our website #COMPANY_WEBSITE# or contact our support department at #COMPANY_EMAIL#.</p>

<p>Thanks,<br />

#COMPANY_NAME#</p>
-------------------

Hope it helps.

ACP

Reply all
Reply to author
Forward
0 new messages