コード例 #1
0
 /**
  * Handles currency conversions for Maestro/Solo cards.
  *
  * PayPal requires Maestro/Solo to be charged in GBP. So if a site owner is using
  * another currency *(i.e. something NOT in GBP)*, we have to convert all of the charge amounts dynamically.
  *
  * Coupon Codes should always be applied before this conversion takes place.
  * That way a site owner's configuration remains adequate.
  *
  * Tax rates should be applied after this conversion takes place.
  *
  * @package s2Member\PayPal
  * @since 110531
  *
  * @param array $attr An array of PayPal Pro Form Attributes.
  * @param str $card_type The Card Type *(i.e. Billing Method)* selected.
  * @return array The same array of Pro Form Attributes, with possible currency conversions.
  */
 public static function paypal_maestro_solo_2gbp($attr = FALSE, $card_type = FALSE)
 {
     if (is_array($attr) && is_string($card_type) && in_array($card_type, array("Maestro", "Solo"))) {
         if (!empty($attr["cc"]) && strcasecmp($attr["cc"], "GBP") !== 0 && is_numeric($attr["ta"]) && is_numeric($attr["ra"])) {
             if ($attr["ta"] <= 0 && is_numeric($c_ta = "0") || is_numeric($c_ta = c_ws_plugin__s2member_utils_cur::convert($attr["ta"], $attr["cc"], "GBP"))) {
                 if ($attr["ra"] <= 0 && is_numeric($c_ra = "0") || is_numeric($c_ra = c_ws_plugin__s2member_utils_cur::convert($attr["ra"], $attr["cc"], "GBP"))) {
                     $attr = array_merge($attr, array("cc" => "GBP", "ta" => $c_ta, "ra" => $c_ra));
                 }
             }
         }
     }
     return $attr;
     // Return array of Attributes.
 }
コード例 #2
0
 /**
  * Handles currency conversions for Maestro/Solo cards.
  *
  * PayPal requires Maestro/Solo to be charged in GBP. So if a site owner is using
  * another currency *(i.e., something NOT in GBP)*, we have to convert all of the charge amounts dynamically.
  *
  * Coupon Codes should always be applied before this conversion takes place.
  * That way a site owner's configuration remains adequate.
  *
  * Tax rates should be applied after this conversion takes place.
  *
  * @package s2Member\PayPal
  * @since 110531
  *
  * @param array  $attr An array of PayPal Pro-Form Attributes.
  * @param string $card_type The Card Type *(i.e., Billing Method)* selected.
  *
  * @return array The same array of Pro-Form Attributes, with possible currency conversions.
  */
 public static function paypal_maestro_solo_2gbp($attr = array(), $card_type = '')
 {
     if (is_array($attr) && is_string($card_type) && in_array($card_type, array('Maestro', 'Solo'))) {
         if (!empty($attr['cc']) && strcasecmp($attr['cc'], 'GBP') !== 0 && is_numeric($attr['ta']) && is_numeric($attr['ra'])) {
             if ($attr['ta'] <= 0 && is_numeric($c_ta = '0') || is_numeric($c_ta = c_ws_plugin__s2member_utils_cur::convert($attr['ta'], $attr['cc'], 'GBP'))) {
                 if ($attr['ra'] <= 0 && is_numeric($c_ra = '0') || is_numeric($c_ra = c_ws_plugin__s2member_utils_cur::convert($attr['ra'], $attr['cc'], 'GBP'))) {
                     $attr = array_merge($attr, array('cc' => 'GBP', 'ta' => $c_ta, 'ra' => $c_ra));
                 }
             }
         }
     }
     return $attr;
     // Return array of Attributes.
 }