You are here

function _uc_stripe_convert_trial_period in Ubercart Stripe 7

Same name and namespace in other branches
  1. 6 uc_stripe.module \_uc_stripe_convert_trial_period()

Convert trial period from any unit to days which Stripe expects.

1 call to _uc_stripe_convert_trial_period()
uc_stripe_product_feature_validate in ./uc_stripe.module
Validate the product feature save.

File

./uc_stripe.module, line 644
A module used for processing payments with Stripe.

Code

function _uc_stripe_convert_trial_period($value, $unit) {
  switch ($unit) {
    case 'days':
      return $value;
      break;
    case 'weeks':
      return $value * 7;
      break;
    case 'months':
      return $value * 30;
      break;
    case 'years':
      return $value * 365;
      break;
    default:
      return $value;
      break;
  }
}