OK, I have decided to put some time into attempting to debug the Stripe module. So first, attempt to correct the issue with stripe_object:
Quote:
> desc stripe_data;
+----------------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------------+--------------+------+-----+---------+----------------+
| stripe_object | varchar(64) | NO | | NULL | |
After running
Quote:
ALTER TABLE stripe_data
CHANGE stripe_object stripe_object varchar(64) NULL DEFAULT '';
the definition changes to
Quote:
> desc stripe_data;
+----------------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------------+--------------+------+-----+---------+----------------+
| stripe_object | varchar(64) | YES | | | |
Unfortunately, when I try a Stripe checkout, after entering the sandbox data I get at
https://***/shop/index.php?main_page=checkout_process
the following display (no other output)
Quote:
WARNING: An Error occurred, please refresh the page and try again.
and on refreshing the page, the warning
Quote:
Must provide source or customer.
displays under "Step 3 of 3 - Order Confirmation".
The debug log now shows a different error though, which is a welcome change:
Quote:
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Charge instance: customer
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Charge instance: disputed
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Charge instance: fee
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Charge instance: invoice
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_city
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_country
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_line1
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_line1_check
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_line2
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_zip
[31-Jul-2019 00:13:32 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_zip_check
[31-Jul-2019 00:13:32 Asia/Tokyo] Request URI: /shop/index.php?main_page=checkout_process, IP address: 192.168.0.3
#1 trigger_error() called at [/***/shop/includes/classes/db/mysql/query_factory.php:171]
#2 queryFactory->show_error() called at [/***/shop/includes/classes/db/mysql/query_factory.php:143]
#3 queryFactory->set_error() called at [/***/shop/includes/classes/db/mysql/query_factory.php:270]
#4 queryFactory->Execute() called at [/***/shop/includes/functions/functions_general.php:952]
#5 zen_db_perform() called at [/***/shop/includes/modules/payment/stripepay.php:495]
#6 stripepay->after_process() called at [/***/shop/includes/classes/payment.php:254]
#7 payment->after_process() called at [/***/shop/includes/modules/pages/checkout_process/header_php.php:17]
#8 require(/***/shop/includes/modules/pages/checkout_process/header_php.php) called at [/***/shop/index.php:36]
--> PHP Fatal error: 1406:Data too long for column 'stripe_charge_id' at row 1 :: INSERT INTO stripe_data (orders_id, stripe_charge_id, customers_id, stripe_amount, stripe_amount_refunded, stripe_currency, stripe_customer, stripe_description, stripe_disputed, stripe_fee, stripe_invoice, stripe_paid, stripe_address_city, stripe_address_country, stripe_address_line1, stripe_address_line1_check, stripe_address_line2, stripe_address_zip, stripe_address_zip_check, stripe_country, stripe_fingerprint, stripe_cvc_check, stripe_name, stripe_last4, stripe_exp_month, stripe_exp_year, stripe_type) VALUES ('36', 'ch_1F1x15IvuX80g3UFlLCPZ6ka', '2', '58290', '0', 'JPY', '', 'user AT gmail.com', '', '', '', '1', '', '', '', '', '', '', '', 'US', 'lHfW1lpMAnH1N1Ea', 'pass', 'USER NAME', '4242', '1', '2023', 'Visa') ==> (as called by) /***/shop/includes/functions/functions_general.php on line 952 <== in /***/shop/includes/classes/db/mysql/query_factory.php on line 171.
I have replaced the actual email address and user name with "user AT gmail.com" and "USER NAME" in the error log contents.
The field stripe_charge_id is being set to ch_1F1x15IvuX80g3UFlLCPZ6ka, but in the stripe_data table is defined as varchar(25)
Quote:
> desc stripe_data;
+----------------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------------+--------------+------+-----+---------+----------------+
| stripe_charge_id | varchar(25) | NO | | NULL | |
Clearly, the value to be set is 27 chars long. Now I guess I need to check docs to see what the max value should be.
As a test, if I altered the field to be 27 varchars,
Quote:
ALTER TABLE stripe_data CHANGE stripe_charge_id stripe_charge_id varchar(27) NOT NULL;
so that definition becomes:
Quote:
> desc stripe_data;
+----------------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------------+--------------+------+-----+---------+----------------+
| stripe_charge_id | varchar(27) | NO | | NULL | |
and tried checkout again.
An error still occurs, and debug log shows yet a different error. So some progress here.
As it is late, I will defer this, but it looks like the fee value is not being given correctly for the module's liking.
Quote:
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Charge instance: customer
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Charge instance: disputed
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Charge instance: fee
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Charge instance: invoice
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_city
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_country
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_line1
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_line1_check
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_line2
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_zip
[31-Jul-2019 00:30:23 Asia/Tokyo] Stripe Notice: Undefined property of Stripe_Object instance: address_zip_check
[31-Jul-2019 00:30:23 Asia/Tokyo] Request URI: /shop/index.php?main_page=checkout_process, IP address: 192.168.0.3
#1 trigger_error() called at [/***/shop/includes/classes/db/mysql/query_factory.php:171]
#2 queryFactory->show_error() called at [/***/shop/includes/classes/db/mysql/query_factory.php:143]
#3 queryFactory->set_error() called at [/***/shop/includes/classes/db/mysql/query_factory.php:270]
#4 queryFactory->Execute() called at [/***/shop/includes/functions/functions_general.php:952]
#5 zen_db_perform() called at [/***/shop/includes/modules/payment/stripepay.php:495]
#6 stripepay->after_process() called at [/***/shop/includes/classes/payment.php:254]
#7 payment->after_process() called at [/***/shop/includes/modules/pages/checkout_process/header_php.php:17]
#8 require(/***/shop/includes/modules/pages/checkout_process/header_php.php) called at [/***/shop/index.php:36]
--> PHP Fatal error: 1366:Incorrect integer value: '' for column `zencartshop`.`stripe_data`.`stripe_fee` at row 1 :: INSERT INTO stripe_data (orders_id, stripe_charge_id, customers_id, stripe_amount, stripe_amount_refunded, stripe_currency, stripe_customer, stripe_description, stripe_disputed, stripe_fee, stripe_invoice, stripe_paid, stripe_address_city, stripe_address_country, stripe_address_line1, stripe_address_line1_check, stripe_address_line2, stripe_address_zip, stripe_address_zip_check, stripe_country, stripe_fingerprint, stripe_cvc_check, stripe_name, stripe_last4, stripe_exp_month, stripe_exp_year, stripe_type) VALUES ('37', 'ch_1F1xHOIvuX80g3UF1seaLy6J', '2', '58290', '0', 'JPY', '', 'user AT gmail.com', '', '', '', '1', '', '', '', '', '', '', '', 'US', 'lHfW1lpMAnH1N1Ea', 'pass', 'USER NAME', '4242', '1', '2020', 'Visa') ==> (as called by) /***/shop/includes/functions/functions_general.php on line 952 <== in /***/shop/includes/classes/db/mysql/query_factory.php on line 171.
In sandbox no fee is taken, so the fact that the fee is not there is not a big surprise, but should it be an integer 0, or should the code accept an empty string?
I think that in the above, all these errors are generated by the Zen Cart module itself, not an error being reported by Stripe.
To be continued the following day.