Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding support for new coupon duration attributes #171

Merged
merged 1 commit into from
Jul 31, 2015

Conversation

shulmang
Copy link

Description:
Add support for new coupon duration attributes (duration, temporal_unit, temporal_amount)

Additional approvers:
@bhelx

Testing:

  • Verify that new coupons can be created with duration=forever/single_use/temporal, single_use=true, & applies_for_months=n
  • Verify that when reading all of the created coupons the values for duration, temporal_unit, temporal_amount, single_use, & applies_for_months are all correct
function new_coupon() {
  $coupon = new Recurly_Coupon();
  $coupon->coupon_code = uniqid();
  $coupon->name = uniqid();
  $coupon->discount_in_cents->addCurrency('USD',200);
  return $coupon;
}


$coupon = new_coupon();
$coupon->duration = 'forever';

$coupon->create();
$coupon = Recurly_Coupon::get($coupon->coupon_code);
print($coupon->duration);
print($coupon->temporal_unit);
print($coupon->temporal_amount);
print($coupon->applies_for_months);
print($coupon->single_use);


$coupon = new_coupon();
$coupon->duration = 'single_use';

$coupon->create();
$coupon = Recurly_Coupon::get($coupon->coupon_code);
print($coupon->duration);
print($coupon->temporal_unit);
print($coupon->temporal_amount);
print($coupon->applies_for_months);
print($coupon->single_use);


$coupon = new_coupon();
$coupon->duration = 'temporal';
$coupon->temporal_unit = 'month';
$coupon->temporal_amount = 3;

$coupon->create();
$coupon = Recurly_Coupon::get($coupon->coupon_code);
print($coupon->duration);
print($coupon->temporal_unit);
print($coupon->temporal_amount);
print($coupon->applies_for_months);
print($coupon->single_use);


$coupon = new_coupon();
$coupon->applies_for_months = 3;

$coupon->create();
$coupon = Recurly_Coupon::get($coupon->coupon_code);
print($coupon->duration);
print($coupon->temporal_unit);
print($coupon->temporal_amount);
print($coupon->applies_for_months);
print($coupon->single_use);


$coupon = new_coupon();
$coupon->single_use = true;

$coupon->create();
$coupon = Recurly_Coupon::get($coupon->coupon_code);
print($coupon->duration);
print($coupon->temporal_unit);
print($coupon->temporal_amount);
print($coupon->applies_for_months);
print($coupon->single_use);

@bhelx
Copy link
Contributor

bhelx commented Jul 30, 2015

Could you add changelog entry?

@shulmang shulmang force-pushed the gs-support_new_coupon_duration_attributes branch from fdc7a7b to a7d8bc3 Compare July 31, 2015 19:31
@bhelx
Copy link
Contributor

bhelx commented Jul 31, 2015

👍

bhelx added a commit that referenced this pull request Jul 31, 2015
…ttributes

adding support for new coupon duration attributes
@bhelx bhelx merged commit b361a2f into master Jul 31, 2015
@bhelx bhelx deleted the gs-support_new_coupon_duration_attributes branch July 31, 2015 21:08
@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants