Created
November 18, 2013 19:49
-
-
Save aczietlow/7534195 to your computer and use it in GitHub Desktop.
ada_corporatejoin/includes/forms.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -164,48 +164,25 @@ function _ada_corporatejoin_form_submit_infusionsoft($form_state) { | |
} | |
function _ada_corporatejoin_form_submit_payment(&$form_state) { | |
- if (module_exists('google_checkout') && $form_state['values']['payment']['method']['options'] == 'credit_card') { | |
+ if (module_exists('ada_paypal_api') && $form_state['values']['payment']['method']['options'] == 'credit_card') { | |
global $user; | |
- google_checkout_load_include('item'); | |
- $cart = google_checkout_cart_init(); | |
- $cart->SetMerchantPrivateData(new MerchantPrivateData(array( | |
- 'uid' => $user->uid, | |
- 'appsalliance_ui_partner_archive_id' => $form_state['appsalliance_ui_partner_archive']->id, | |
- ))); | |
- $cart->SetContinueShoppingUrl(url('join/corporate/welcome', array('absolute' => TRUE))); | |
- | |
- $item_name = t('Alliance membership dues'); | |
- $item_description = t('@member_type organization with @num_employees employees', array( | |
- '@member_type' => $form_state['values']['dues']['member_type'], | |
- '@num_employees' => $form_state['values']['dues']['num_employees'], | |
- )); | |
- $item_price = $form_state['values']['dues']['calculated_dues']; | |
- $item = new GoogleItem($item_name, $item_description, 1, $item_price); | |
- $cart->AddItem($item); | |
- watchdog('ada_corporatejoin_debug', 'cart: <pre>@cart</pre>', array( | |
- '@cart' => print_r($cart, TRUE), | |
- ), WATCHDOG_DEBUG); | |
- | |
- // Run Drupal's exit routines before redirecting to Google Checkout. | |
- // @see drupal_exit(). | |
- $destination = NULL; | |
- if (drupal_get_bootstrap_phase() == DRUPAL_BOOTSTRAP_FULL) { | |
- if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') { | |
- module_invoke_all('exit', $destination); | |
- } | |
- drupal_session_commit(); | |
- } | |
- | |
- // Communicate information to GoogleCheckout and redirect user to complete checkout. | |
- google_checkout_cart_redirect($cart); | |
+ $item = array( | |
+ 'name' => t('Alliance membership dues'), | |
+ 'description' => t('@member_type organization with @num_employees employees', array( | |
+ '@member_type' => $form_state['values']['dues']['member_type'], | |
+ '@num_employees' => $form_state['values']['dues']['num_employees'], | |
+ )), | |
+ 'price' => $form_state['values']['dues']['calculated_dues'], | |
+ ); | |
+ $partner_archive_id = $form_state['appsalliance_ui_partner_archive']->id; | |
- // if this line executes, google checkout failed | |
- // i.e. rejected our cart object - check watchdog | |
- $form_state['redirect'] = 'join/corporate/google_checkout_error'; | |
- drupal_set_message('The checkout process could not be completed. The Application Developers Alliance will be in contact with you.'); | |
- ada_corporatejoin_send_mail('checkout_error', $form_state); | |
+ ada_paypal_api_pp_process($item, $partner_archive_id); | |
+ watchdog('ada_corporatejoin_debug', 'join_id: @join_id item: <pre>@item</pre>', array( | |
+ '@join_id' => $partner_archive_id, | |
+ '@item' => print_r($item, TRUE), | |
+ ), WATCHDOG_DEBUG); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment