Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Apr 18, 2024 11:49 am
Voice Broadcast System


All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Failed to log refill & payment in checkout_process.php
PostPosted: Mon Sep 13, 2010 5:02 am 
Offline

Joined: Wed Mar 31, 2010 9:40 am
Posts: 11
Hi,

I think the checkout_process.php fail to create records into cc_logrefill and cc_logpayment table. Here is some part of the epayment log I found:

Quote:
........
[12/09/2010 00:06:41]:[checkout_process.php line:316-transactionID=66 CARD FOUND IN DB (25)]
[12/09/2010 00:06:41]:[checkout_process.php line:328-transactionID=66 Update_table cc_card : credit = credit+'10' - CLAUSE : id='25']
[12/09/2010 00:06:41]:[checkout_process.php line:344-transactionID=66 Add_table cc_logrefill : date, credit, card_id, description,agent_id - VALUES '2010-09-12 00:06:41', '10', '25', 'paypal',NULL]
[12/09/2010 00:06:41]:[checkout_process.php line:350-transactionID=66 Add_table cc_logpayment : date, payment, card_id, id_logrefill, description,agent_id - VALUES '2010-09-12 00:06:41', '10', '25', '', 'paypal',NULL ]
........


If you look at the empty data field just before 'paypal' in the last line which seems like it failed to return a ID from new inserted cc_logrefill record hence no cc_logrefill inserted. That made me wonder what actually is trying to do so I had a look at checkout_process.php.

Around line: 344 -350 (see log above) I found this piece of code which I believe is the code that actually insert the new refill and payment log into the table:

Quote:
$field_insert = "date, credit, card_id, description,agent_id";
$value_insert = "'$nowDate', '".$amount_without_vat."', '$id', '".$transaction_data[0][4]."',$id_agent_insert";
$instance_sub_table = new Table("cc_logrefill", $field_insert);
$id_logrefill = $instance_sub_table -> Add_table ($DBHandle, $value_insert, null, null, 'id'); <== (*** Is this suppose to be single quote or double? ***)
write_log(LOGFILE_EPAYMENT, basename(__FILE__).' line:'.__LINE__."-transactionID=$transactionID"." Add_table cc_logrefill : $field_insert - VALUES $value_insert");

$field_insert = "date, payment, card_id, id_logrefill, description,agent_id";
$value_insert = "'$nowDate', '".$amount_paid."', '$id', '$id_logrefill', '".$transaction_data[0][4]."',$id_agent_insert ";
$instance_sub_table = new Table("cc_logpayment", $field_insert);
$id_payment = $instance_sub_table -> Add_table ($DBHandle, $value_insert, null, null,"id");
write_log(LOGFILE_EPAYMENT, basename(__FILE__).' line:'.__LINE__."-transactionID=$transactionID"." Add_table cc_logpayment : $field_insert - VALUES $value_insert");


Then I look at the database table structure:

Quote:
cc_logrefill Table:

Field name,Type,Allow nulls?,Key,Default value,Extras
id, bigint(20), No, Primary, NULL, auto_increment
date, timestamp, No, None, CURRENT_TIMESTAMP
credit, decimal(15,5), No, None, NULL
card_id, bigint(20), No, None, NULL
description, mediumtext, Yes, None, NULL
refill_type, tinyint(4), No, None, 0
added_invoice, tinyint(4), No, None, 0



Quote:
cc_logpayment Table:

Field name, Type, Allow nulls?, Key, Default value, Extras
id, int(11), No, Primary, NULL, auto_increment
date, timestamp, No, None, CURRENT_TIMESTAMP
payment, decimal(15,5), No, None, NULL
card_id, bigint(20), No, None, NULL
id_logrefill, bigint(20), Yes, None, NULL
description, mediumtext, Yes, None, NULL
added_refill, smallint(6), No, None, 0
payment_type, tinyint(4), No, None, 0
added_commission, tinyint(4), No, None, 0


I couldn't figure it out what caused the failing insert new records in cc_logrefill and cc_logpayment? I query the table but it remains empty after several payment attempts using the paypal module.

What I would expect to happen is when the Paypal payment processed:
- Update customer balance
- Create a new refill record
- Create a new payment record that can offset the overdue debt balance (To Pay under Customer Balance)

Please correct me if I misinterpret the process flow for the epayment.

Can anyone help? I need to properly log a refill and payment when customer make a top up epayment so we can trace what happen in payment flow.


Many thanks. :laugh:


Last edited by pbx_kc on Mon Sep 13, 2010 11:10 am, edited 6 times in total.

Top
 Profile  
 
 Post subject: Re: Failed to create refill & payment log (checkout_process.php)
PostPosted: Mon Sep 13, 2010 5:03 am 
Offline

Joined: Wed Mar 31, 2010 9:40 am
Posts: 11
By the way, the rest of the epayment log looks fine and I only picked the lines that I think it might be the problem. Thanks. :)


Top
 Profile  
 
 Post subject: Re: Failed to create refill & payment log (checkout_process.php)
PostPosted: Mon Sep 13, 2010 10:42 am 
Offline

Joined: Wed Mar 31, 2010 9:40 am
Posts: 11
Enabled the MySQL log to see what query are being executed in checkout_process.php and found the following:

Quote:
INSERT INTO cc_logrefill (date, credit, card_id, description,agent_id) values ('2010-09-13 20:53:01', '10', '25', 'paypal',NULL)
INSERT INTO cc_logpayment (date, payment, card_id, id_logrefill, description,agent_id) values ('2010-09-13 20:53:01', '10', '25', '', 'paypal',NULL)


I manually run this INSERT query and realised it's trying to insert some data into a non existence column: agent_id in both the tables.

Looks like this is what caused the insert fail.

There are 2 other similar tables cc_logrefill_agent and cc_logpayment_agent and I am not too sure if this agent_id are being used in these tables?

What should I do?


Thanks.


Top
 Profile  
 
 Post subject: Re: Failed to log refill & payment in checkout_process.php
PostPosted: Mon Sep 13, 2010 1:40 pm 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
Hi

Try this

ALTER TABLE cc_logpayment ADD agent_id BIGINT NULL ;
ALTER TABLE cc_logrefill ADD agent_id BIGINT NULL ;


Joe


Top
 Profile  
 
 Post subject: Re: Failed to log refill & payment in checkout_process.php
PostPosted: Tue Sep 14, 2010 7:59 am 
Offline

Joined: Thu Feb 12, 2009 11:11 pm
Posts: 18
Location: Thessaloniki, Greece
Hi,

agent_id field is a required field in the DB schema.
Maybe you messed up with your installation?
Maybe you upgraded your old A2B without updating MySQL schema?

The agent_id field must be occupied by the id of the agent that the customer belongs.
If however, the customer who completed the transaction, does not belong to a particular Customer GROUP, then the agent_id must be NULL

I think that it is a DB problem.
Regards,
Tasos


Top
 Profile  
 
 Post subject: Re: Failed to log refill & payment in checkout_process.php
PostPosted: Tue Sep 14, 2010 10:06 am 
Offline

Joined: Wed Mar 31, 2010 9:40 am
Posts: 11
Thanks for your reply Joe and zafeirop. That make total sense.

I'll add the column now into the table and that should do the trick.

I wonder if there is a up to date A2Billing database schema documentation somewhere I can look at?


Top
 Profile  
 
 Post subject: Re: Failed to log refill & payment in checkout_process.php
PostPosted: Tue Sep 14, 2010 11:11 pm 
Offline

Joined: Thu Feb 12, 2009 11:11 pm
Posts: 18
Location: Thessaloniki, Greece
I think that you can visit A2B Trac.
Try here:
http://www.asterisk2billing.org/cgi-bin/trac.cgi/browser/trunk/DataBase/mysql-5.x

The full schema for 1.7.0 is here:
http://www.asterisk2billing.org/cgi-bin/trac.cgi/export/2916/trunk/DataBase/mysql-5.x/a2billing-mysql-schema-v1.7.0.sql

The SQL commands are self explanatory :lol:

Regards,
Tasos


Top
 Profile  
 
 Post subject: Re: Failed to log refill & payment in checkout_process.php
PostPosted: Wed Sep 15, 2010 6:00 am 
Offline

Joined: Wed Mar 31, 2010 9:40 am
Posts: 11
Thanks zafeirop. Everything is now sorted.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 
VoIP Billing solution


All times are UTC


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group