change some debugging

This commit is contained in:
Nathan Coad
2016-07-23 12:23:44 +10:00
parent a24a60fb77
commit af648cce84

View File

@@ -4,7 +4,6 @@
* @file * @file
* Functions for stripe payment integration * Functions for stripe payment integration
* @see https://github.com/ericthelast/drupal-stripe-form and https://www.webomelette.com/drupal-stripe-integration * @see https://github.com/ericthelast/drupal-stripe-form and https://www.webomelette.com/drupal-stripe-integration
* Australian test number is 4000000360000006
*/ */
/** /**
@@ -165,7 +164,6 @@ function booking_stripe_validate_form_payment($form, &$form_state) {
//get values from original form //get values from original form
//@todo sanitise this input //@todo sanitise this input
$token = (isset($form_state['input']['token_id']) ? $form_state['input']['token_id'] : ''); $token = (isset($form_state['input']['token_id']) ? $form_state['input']['token_id'] : '');
watchdog('booking_debug', "<pre>Stripe token:\n@info</pre>", array('@info' => print_r( $token, true)));
$amount = (isset($form_state['input']['gross_amount']) ? $form_state['input']['gross_amount'] : ''); $amount = (isset($form_state['input']['gross_amount']) ? $form_state['input']['gross_amount'] : '');
$invoice = (isset($form_state['input']['invoice']) ? $form_state['input']['invoice'] : ''); $invoice = (isset($form_state['input']['invoice']) ? $form_state['input']['invoice'] : '');
$nid = (isset($form_state['input']['nid']) ? $form_state['input']['nid'] : ''); $nid = (isset($form_state['input']['nid']) ? $form_state['input']['nid'] : '');
@@ -184,7 +182,9 @@ function booking_stripe_validate_form_payment($form, &$form_state) {
//if card is issued from a different country then apply the international rate also //if card is issued from a different country then apply the international rate also
//@todo figure out a better way of matching country name to country code //@todo figure out a better way of matching country name to country code
// probably via https://api.drupal.org/api/drupal/includes%21locale.inc/function/country_get_list/7.x // probably via https://api.drupal.org/api/drupal/includes%21locale.inc/function/country_get_list/7.x
elseif (variable_get('booking_default_country', 'Australia') === 'Australia' && $card_country !== 'US') { //NOTE! This will result in incorrect charge amounts when using the test API due to a stripe bug
//since the australian test card number gets charged 2.9% instead of 1.75%
elseif (variable_get('booking_default_country', 'Australia') === 'Australia' && $card_country !== 'AU') {
$person = node_load($nid); $person = node_load($nid);
$amount = (isset($form_state['input']['foreign_gross_amount']) ? $form_state['input']['foreign_gross_amount'] : $amount); $amount = (isset($form_state['input']['foreign_gross_amount']) ? $form_state['input']['foreign_gross_amount'] : $amount);
watchdog('booking_debug', "Detected foreign card use (country !country), setting amount to !amount", watchdog('booking_debug', "Detected foreign card use (country !country), setting amount to !amount",
@@ -210,7 +210,7 @@ function booking_stripe_validate_form_payment($form, &$form_state) {
)); ));
watchdog('booking_debug', "<pre>Stripe payment charge results:\n@info</pre>", array('@info' => print_r( $charge->__toJSON(), true))); watchdog('booking_debug', "<pre>Stripe payment charge results:\n@info</pre>", array('@info' => print_r( $charge->__toJSON(), true)));
if ($charge && $charge->paid) { if ($charge && $charge->paid) {
watchdog('booking', 'Charge created successfully'); //watchdog('booking_debug', 'Charge created successfully');
_booking_process_stripe_payment($charge, $token); _booking_process_stripe_payment($charge, $token);
//$form_state['stripeform_charge'] = $charge; //$form_state['stripeform_charge'] = $charge;
// @todo call _booking_process_stripe_payment to store payment // @todo call _booking_process_stripe_payment to store payment