function uc_recurring_hosted_recurring_access in UC Recurring Payments and Subscriptions 7.2
Same name and namespace in other branches
- 6.2 modules/uc_recurring_hosted/uc_recurring_hosted.module \uc_recurring_hosted_recurring_access()
Implements hook_recurring_access().
File
- modules/
uc_recurring_hosted/ uc_recurring_hosted.module, line 209 - Provides hosted gateway specific code for recurring payments, specifically Authorize.net ARB and Paypal WPS
Code
function uc_recurring_hosted_recurring_access($fee, $op, $account) {
if ($fee->fee_handler == 'paypal_wpp') {
switch ($op) {
case 'view agreement':
if (!user_access('administer recurring fees') || $fee->status == UC_RECURRING_FEE_STATUS_SUSPENDED_NOPROFILE || $fee->status == UC_RECURRING_FEE_STATUS_CANCELLED) {
return UC_RECURRING_ACCESS_DENY;
}
break;
case 'reactivate':
// Check whether the profile is inactive
if ($fee->status == UC_RECURRING_FEE_STATUS_SUSPENDED) {
return UC_RECURRING_ACCESS_ALLOW;
}
else {
return UC_RECURRING_ACCESS_DENY;
}
break;
case 'update':
if ($fee->status == UC_RECURRING_FEE_STATUS_ACTIVE) {
return UC_RECURRING_ACCESS_ALLOW;
}
else {
return UC_RECURRING_ACCESS_DENY;
}
break;
case 'create profile':
if ($fee->status != UC_RECURRING_FEE_STATUS_SUSPENDED_NOPROFILE) {
return UC_RECURRING_ACCESS_DENY;
}
break;
}
}
// TODO: Consider if this can be made part of uc_recurring_user_access().
if ($op == 'cancel') {
if ($fee->status == UC_RECURRING_FEE_STATUS_CANCELLED) {
return UC_RECURRING_ACCESS_DENY;
}
}
}