예제 #1
0
 /**
  * Cancels a Payflow recurring profile.
  *
  * @package s2Member\PayPal
  * @since 110531
  *
  * @param string $subscr_id A paid subscription ID (aka: Recurring Profile ID).
  * @param string $baid A Billing Agreement ID (aka: BAID).
  *
  * @return boolean True if the profile was cancelled, else false.
  */
 public static function payflow_cancel_profile($subscr_id = '', $baid = '')
 {
     $payflow['TRXTYPE'] = 'R';
     $payflow['ACTION'] = 'C';
     $payflow['TENDER'] = 'C';
     $payflow['ORIGPROFILEID'] = $subscr_id;
     if (($cancellation = c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response($payflow)) && empty($cancellation['__error'])) {
         if (!$baid || c_ws_plugin__s2member_pro_paypal_utilities::payflow_cancel_billing_agreement($baid)) {
             return TRUE;
         }
     }
     $payflow['TENDER'] = 'P';
     if (($cancellation = c_ws_plugin__s2member_paypal_utilities::paypal_payflow_api_response($payflow)) && empty($cancellation['__error'])) {
         if (!$baid || c_ws_plugin__s2member_pro_paypal_utilities::payflow_cancel_billing_agreement($baid)) {
             return TRUE;
         }
     }
     return FALSE;
 }