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

Support item-specific coupons #563

Merged
merged 2 commits into from
Nov 2, 2020
Merged

Support item-specific coupons #563

merged 2 commits into from
Nov 2, 2020

Conversation

joannasese
Copy link
Contributor

Add item_codes and applies_to_all_items to Coupon

Example:

$coupon = new Recurly_Coupon();
$couponCode = 'special';
$coupon->name = 'Special';
$coupon->coupon_code = $couponCode;
$coupon->discount_type = 'percent';
$coupon->discount_percent = 20;
// `applies_to_all_items` defaults to false, so next line is optional
$coupon->applies_to_all_items = false
$coupon->item_codes = array('item_one', 'item_two', 'item_three');
$coupon->create();

Add item_codes and applies_to_all_items to Coupon
@joannasese joannasese added the V2 V2 Client label Oct 28, 2020
@@ -90,10 +90,20 @@ public function testPlanCodesXml() {
$coupon = Recurly_Coupon::get('special', $this->client);

$this->assertInstanceOf('Recurly_Coupon', $coupon);
$this->assertTrue($coupon->applies_to_all_plans);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this test being changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, plan_codes is an "Array of plan_codes the coupon applies to, if applies_to_all_plans is false." So here, applies_to_all_plans should actually be false.

Copy link
Contributor

@douglasmiller douglasmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@douglasmiller douglasmiller merged commit cace6e9 into v2 Nov 2, 2020
@joannasese joannasese mentioned this pull request Nov 4, 2020
@douglasmiller douglasmiller deleted the item-coupons branch September 1, 2022 22:00
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.

None yet

2 participants