function uc_recurring_hosted_paypal_wpp_cancel in UC Recurring Payments and Subscriptions 6.2
Same name and namespace in other branches
- 7.2 modules/uc_recurring_hosted/uc_recurring_hosted.module \uc_recurring_hosted_paypal_wpp_cancel()
PayPal website payments pro renew.
Note: the cancel handler gets just one parameter $fee. And it is passed by value (not by ref). It differs to the other handlers (such as process or renew).
1 string reference to 'uc_recurring_hosted_paypal_wpp_cancel'
- uc_recurring_hosted_recurring_info in modules/
uc_recurring_hosted/ uc_recurring_hosted.module - Implementation of hook_recurring_info().
File
- modules/
uc_recurring_hosted/ uc_recurring_hosted.module, line 902 - Provides hosted gateway specific code for recurring payments, specifically Authorize.net ARB and Paypal WPS
Code
function uc_recurring_hosted_paypal_wpp_cancel($fee) {
global $user;
// Get the subscription ID.
$subscription = uc_recurring_hosted_subscription_load($fee->rfid);
// Build an NVP request.
$nvp_request = array(
// Set the version required for recurring payments.
'VERSION' => UC_PAYPAL_RECURRING_API,
'METHOD' => 'ManageRecurringPaymentsProfileStatus',
'PROFILEID' => $subscription->subscription_id,
'ACTION' => 'Cancel',
);
// Post the request, and parse the response.
$nvp_response = uc_paypal_api_request($nvp_request, variable_get('uc_paypal_wpp_server', 'https://api-3t.sandbox.paypal.com/nvp'), UC_PAYPAL_RECURRING_API);
if ($nvp_response['ACK'] != 'Success' && $nvp_response['ACK'] != 'SuccessWithWarning') {
watchdog('uc_recurring_hosted', 'Failed to cancel recurring @id', array(
'@id' => $fee->rfid,
), WATCHDOG_ERROR);
return FALSE;
}
else {
watchdog('uc_recurring_hosted', 'Success to cancel recurring @id', array(
'@id' => $fee->rfid,
), WATCHDOG_INFO);
}
return TRUE;
}