work on storing stripe token

This commit is contained in:
Nathan Coad
2016-07-22 09:31:49 +10:00
parent 2614e25364
commit b6bcfacead

View File

@@ -157,7 +157,7 @@ function booking_stripe_validate_form_payment($form, &$form_state) {
$tempid= (isset($form_state['input']['uuid']) ? $form_state['input']['uuid'] : '');
$last_name = (isset($form_state['input']['last_name']) ? $form_state['input']['last_name'] : '');
$first_name = (isset($form_state['input']['first_name']) ? $form_state['input']['first_name'] : '');
watchdog('booking_debug', "<pre>Stripe payment form :\n@info</pre>", array('@info' => print_r( $form_state, true)));
watchdog('booking_debug', "<pre>Stripe token:\n@info</pre>", array('@info' => print_r( $token, true)));
// Create the charge on Stripe's servers - this will charge the user's card
try {
@@ -179,7 +179,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, true)));
if ($charge && $charge->paid) {
watchdog('booking', 'Charge created successfully');
_booking_process_stripe_payment($charge);
_booking_process_stripe_payment($charge, $token);
//$form_state['stripeform_charge'] = $charge;
// @todo call _booking_process_stripe_payment to store payment
drupal_goto('bookingfinal/' . $tempid);
@@ -223,7 +223,7 @@ function booking_stripeform_remove_name($element) {
}
function _booking_process_stripe_payment($charge) {
function _booking_process_stripe_payment($charge, $token) {
global $event;
$balance_payment = false;
$amount_owing = 0;
@@ -288,6 +288,7 @@ function _booking_process_stripe_payment($charge) {
//'booking_payer_status' => $data['payer_status'],
'booking_item_name' => $charge->description,
'booking_ipn_track_id' => $charge->id,
//'booking_stripe_token' => $token,
))
->execute();