You are here

function _uc_stripe_convert_trial_period in Ubercart Stripe 6

Same name and namespace in other branches
  1. 7 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. Basically, ensure everything is Stripe compatible. Some options are not Stripe compatible and we have stripped out the UI but we double check to ensure the user has not attempted to circumvent those measures.

File

./uc_stripe.module, line 634
A module used for Stripe. Developed by Victor Quinn for Health for Hackers (http://www.healthforhackers.com)

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;
  }
}