Skip to content

Commit 6237be2

Browse files
Shugyoushaleighmcculloch
authored andcommitted
Add CurrentBillingCycle field to Modification (braintree-go#236)
What === Add CurrentBillingCycle field to Modification. Why === To get access to the field returned in the modification response from the Braintree API. * Add CHANGELOG entry
1 parent a447dfa commit 6237be2

4 files changed

+7
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ IMPROVEMENTS:
88

99
* Add TransactionLineItemGateway, TransactionLineItem, TransactionLineItemRequest.
1010
* Add LineItems to TransactionRequest.
11+
* Add CurrentBillingCycle to Modification.
1112

1213
## 0.18.0 (March 2nd, 2018)
1314

discount_integration_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func TestDiscounts(t *testing.T) {
3434
t.Fatalf("expected Name to be %s, was %s", "test_discount_name", discount.Name)
3535
} else if discount.NeverExpires != true {
3636
t.Fatalf("expected NeverExpires to be %t, was %t", true, discount.NeverExpires)
37+
} else if discount.CurrentBillingCycle != 0 {
38+
t.Fatalf("expected current billing cycle to be %d, was %d", 0, discount.CurrentBillingCycle)
3739
} else if discount.Description != "A test discount" {
3840
t.Fatalf("expected Description to be %s, was %s", "A test discount", discount.Description)
3941
}

modification.go

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ type Modification struct {
1616
NeverExpires bool `xml:"never-expires"`
1717
Quantity int `xml:"quantity"`
1818
NumberOfBillingCycles int `xml:"number-of-billing-cycles"`
19+
CurrentBillingCycle int `xml:"current-billing-cycle"`
1920
UpdatedAt *time.Time `xml:"updated_at"`
2021
}

subscription_integration_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,9 @@ func TestSubscriptionModifications(t *testing.T) {
925925
if x := sub2.Discounts.Discounts[0].NumberOfBillingCycles; x != 2 {
926926
t.Fatalf("got %v number of billing cycles on discount, want 2 billing cycles", x)
927927
}
928+
if x := sub2.Discounts.Discounts[0].CurrentBillingCycle; x != 0 {
929+
t.Fatalf("got current billing cycle of %d on discount, want 0", x)
930+
}
928931

929932
// Update AddOn
930933
sub3, err := g.Update(ctx, &SubscriptionRequest{

0 commit comments

Comments
 (0)