コード例 #1
0
 /**
  * Converts SARP period to ARB period array
  * @param AW_Sarp_Model_Period $Period
  * @return array
  */
 protected function _convertPeriod(AW_Sarp_Model_Period $Period)
 {
     $unitMultiplier = 1;
     $unit = $Period->getPeriodValue();
     switch ($Period->getPeriodType()) {
         case AW_Sarp_Model_Source_Periods::PERIOD_WEEKS:
             $unitMultiplier = 7;
             $unit = self::UNIT_DAYS;
             break;
         case AW_Sarp_Model_Source_Periods::PERIOD_YEARS:
             $unitMultiplier = 12;
             $unit = self::UNIT_MONTHS;
             break;
         case AW_Sarp_Model_Source_Periods::PERIOD_MONTHS:
             $unitMultiplier = 1;
             $unit = self::UNIT_MONTHS;
             break;
         case AW_Sarp_Model_Source_Periods::PERIOD_DAYS:
             $unitMultiplier = 1;
             $unit = self::UNIT_DAYS;
             break;
     }
     return array('length' => $unitMultiplier * $Period->getPeriodValue(), 'unit' => $unit);
 }
コード例 #2
0
 /**
  * Converts period to Paypal::CreateRecurringPaymentsProfile format
  * @param AW_Sarp_Model_Period $Period
  * @return
  */
 protected function _convertPeriod(AW_Sarp_Model_Period $Period)
 {
     switch ($Period->getPeriodType()) {
         case 'month':
             return 'Month';
         case 'week':
             return 'Week';
         case 'year':
             return 'Year';
     }
     return 'Day';
 }