function commerce_paypal_wps_redirect_form in Commerce PayPal 7
Same name and namespace in other branches
- 7.2 modules/wps/commerce_paypal_wps.module \commerce_paypal_wps_redirect_form()
Payment method callback: redirect form, a wrapper around the module's general use function for building a WPS form.
File
- modules/
wps/ commerce_paypal_wps.module, line 168 - Implements PayPal Website Payments Standard in Drupal Commerce checkout.
Code
function commerce_paypal_wps_redirect_form($form, &$form_state, $order, $payment_method) {
// Return an error if the enabling action's settings haven't been configured.
if (empty($payment_method['settings']['business'])) {
drupal_set_message(t('PayPal WPS is not configured for use. No PayPal e-mail address has been specified.'), 'error');
return array();
}
$settings = array(
// Return to the previous page when payment is canceled
'cancel_return' => url('checkout/' . $order->order_id . '/payment/back/' . $order->data['payment_redirect_key'], array(
'absolute' => TRUE,
)),
// Return to the payment redirect page for processing successful payments
'return' => url('checkout/' . $order->order_id . '/payment/return/' . $order->data['payment_redirect_key'], array(
'absolute' => TRUE,
)),
// Specify the current payment method instance ID in the notify_url
'payment_method' => $payment_method['instance_id'],
);
return commerce_paypal_wps_order_form($form, $form_state, $order, $payment_method['settings'] + $settings);
}