Skip to content

Commit 1f62d34

Browse files
Releasing v3.16.0. Please check the changelog for the updates.
1 parent 1ba8bc0 commit 1f62d34

File tree

22 files changed

+231
-11
lines changed

22 files changed

+231
-11
lines changed

CHANGELOG.md

+44
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
### v3.16.0 (2024-03-20)
2+
* * *
3+
4+
#### New resources:
5+
* Attribute has been added.
6+
* ImpactedItemPrice has been added.
7+
* InstallmentConfig has been added.
8+
* Installment has been added.
9+
10+
#### Removed attributes:
11+
* product_id has been removed from ItemPrice resource.
12+
13+
#### New Enum values:
14+
* klarna_pay_now has been added to TypeEnum in Customer resource.
15+
* klarna_pay_now has been added to PaymentMethodEnum.
16+
* klarna_pay_now has been added to PaymentMethodTypeEnum enum.
17+
* klarna_pay_now has been added to TypeEnum.
18+
* price_variant has been added to EntityTypeEnum.
19+
* price_variant_created has been added in EventType enum.
20+
* price_variant_updated has been added in EventType enum.
21+
* price_variant_deleted has been added in EventType enum.
22+
23+
#### Removed Enum values:
24+
* product and variant have been removed from EntityTypeEnum.
25+
26+
#### New Input parameters:
27+
* config_id has been added to Invoice#InstallmentsRequest.
28+
* amount has been added to Invoice#InstallmentsRequest.
29+
* payment_source_id has been added to Purchase#CreateRequest.
30+
* installment_info[config_id] has been added to Purchase#CreateRequest.
31+
* installment_info[amount] has been added to Purchase#CreateRequest.
32+
* subscription_info[contract_term_billing_cycle_on_renewal] has been added to Purchase#CreateRequest.
33+
* contract_terms[index] has been added to Purchase#CreateRequest.
34+
* contract_terms[action_at_term_end] has been added to Purchase#CreateRequest.
35+
* contract_terms[cancellation_cutoff_period] has been added to Purchase#CreateRequest.
36+
* subscription_info[contract_term_billing_cycle_on_renewal] has been added to Purchase#EstimateRequest.
37+
* contract_terms[index] has been added to Purchase#EstimateRequest.
38+
* contract_terms[action_at_term_end] has been added to Purchase#EstimateRequest.
39+
* contract_terms[cancellation_cutoff_period] has been added to Purchase#EstimateRequest.
40+
41+
#### Deprecated input parameters:
42+
* product_created, product_updated, product_deleted, variant_created, variant_updated, variant_deleted has been deprecated in EventTypeEnum.
43+
44+
145
### v3.15.0 (2024-02-29)
246
* * *
347

actions/installment/installment.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package installment
2+
3+
import (
4+
"fmt"
5+
"github.com/chargebee/chargebee-go/v3"
6+
"github.com/chargebee/chargebee-go/v3/models/installment"
7+
"net/url"
8+
)
9+
10+
func Retrieve(id string) chargebee.RequestObj {
11+
return chargebee.Send("GET", fmt.Sprintf("/installments/%v", url.PathEscape(id)), nil)
12+
}
13+
func List(params *installment.ListRequestParams) chargebee.RequestObj {
14+
return chargebee.SendList("GET", fmt.Sprintf("/installments"), params)
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package installmentconfig
2+
3+
import (
4+
"fmt"
5+
"github.com/chargebee/chargebee-go/v3"
6+
"github.com/chargebee/chargebee-go/v3/models/installmentconfig"
7+
"net/url"
8+
)
9+
10+
func Create(params *installmentconfig.CreateRequestParams) chargebee.RequestObj {
11+
return chargebee.Send("POST", fmt.Sprintf("/installment_configs"), params)
12+
}
13+
func Retrieve(id string) chargebee.RequestObj {
14+
return chargebee.Send("GET", fmt.Sprintf("/installment_configs/%v", url.PathEscape(id)), nil)
15+
}
16+
func Delete(id string) chargebee.RequestObj {
17+
return chargebee.Send("POST", fmt.Sprintf("/installment_configs/%v/delete", url.PathEscape(id)), nil)
18+
}

actions/invoice/invoice.go

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ func Delete(id string, params *invoice.DeleteRequestParams) chargebee.RequestObj
109109
func UpdateDetails(id string, params *invoice.UpdateDetailsRequestParams) chargebee.RequestObj {
110110
return chargebee.Send("POST", fmt.Sprintf("/invoices/%v/update_details", url.PathEscape(id)), params)
111111
}
112+
func Installments(id string, params *invoice.InstallmentsRequestParams) chargebee.RequestObj {
113+
return chargebee.Send("POST", fmt.Sprintf("/invoices/%v/installments", url.PathEscape(id)), params)
114+
}
112115
func ResendEinvoice(id string) chargebee.RequestObj {
113116
return chargebee.Send("POST", fmt.Sprintf("/invoices/%v/resend_einvoice", url.PathEscape(id)), nil)
114117
}

enum/entity_type.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ const (
1717
EntityTypeItemFamily EntityType = "item_family"
1818
EntityTypeItem EntityType = "item"
1919
EntityTypeItemPrice EntityType = "item_price"
20-
EntityTypeProduct EntityType = "product"
21-
EntityTypeVariant EntityType = "variant"
20+
EntityTypePriceVariant EntityType = "price_variant"
2221
)

enum/event_type.go

+3
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,7 @@ const (
174174
EventTypeVariantDeleted EventType = "variant_deleted"
175175
EventTypeItemPriceEntitlementsUpdated EventType = "item_price_entitlements_updated"
176176
EventTypeItemPriceEntitlementsRemoved EventType = "item_price_entitlements_removed"
177+
EventTypePriceVariantCreated EventType = "price_variant_created"
178+
EventTypePriceVariantUpdated EventType = "price_variant_updated"
179+
EventTypePriceVariantDeleted EventType = "price_variant_deleted"
177180
)

enum/payment_method.go

+1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ const (
3333
PaymentMethodFasterPayments PaymentMethod = "faster_payments"
3434
PaymentMethodSepaInstantTransfer PaymentMethod = "sepa_instant_transfer"
3535
PaymentMethodAutomatedBankTransfer PaymentMethod = "automated_bank_transfer"
36+
PaymentMethodKlarnaPayNow PaymentMethod = "klarna_pay_now"
3637
)

enum/payment_method_type.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ const (
2525
PaymentMethodTypeFasterPayments PaymentMethodType = "faster_payments"
2626
PaymentMethodTypeSepaInstantTransfer PaymentMethodType = "sepa_instant_transfer"
2727
PaymentMethodTypeAutomatedBankTransfer PaymentMethodType = "automated_bank_transfer"
28+
PaymentMethodTypeKlarnaPayNow PaymentMethodType = "klarna_pay_now"
2829
)

enum/type.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ const (
2525
TypeFasterPayments Type = "faster_payments"
2626
TypeSepaInstantTransfer Type = "sepa_instant_transfer"
2727
TypeAutomatedBankTransfer Type = "automated_bank_transfer"
28+
TypeKlarnaPayNow Type = "klarna_pay_now"
2829
)

models/attribute/attribute.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package attribute
2+
3+
type Attribute struct {
4+
Name string `json:"name"`
5+
Value string `json:"value"`
6+
Object string `json:"object"`
7+
}

models/customer/enum/payment_method_type.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ const (
2525
PaymentMethodTypeFasterPayments PaymentMethodType = "faster_payments"
2626
PaymentMethodTypeSepaInstantTransfer PaymentMethodType = "sepa_instant_transfer"
2727
PaymentMethodTypeAutomatedBankTransfer PaymentMethodType = "automated_bank_transfer"
28+
PaymentMethodTypeKlarnaPayNow PaymentMethodType = "klarna_pay_now"
2829
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package impacteditemprice
2+
3+
import (
4+
"encoding/json"
5+
)
6+
7+
type ImpactedItemPrice struct {
8+
Count int32 `json:"count"`
9+
Download *Download `json:"download"`
10+
ItemPrices json.RawMessage `json:"item_prices"`
11+
Object string `json:"object"`
12+
}
13+
type Download struct {
14+
DownloadUrl string `json:"download_url"`
15+
ValidTill int64 `json:"valid_till"`
16+
MimeType string `json:"mime_type"`
17+
Object string `json:"object"`
18+
}

models/installment/enum/status.go

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package enum
2+
3+
type Status string
4+
5+
const (
6+
StatusPosted Status = "posted"
7+
StatusPaymentDue Status = "payment_due"
8+
StatusPaid Status = "paid"
9+
)

models/installment/installment.go

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package installment
2+
3+
import (
4+
"github.com/chargebee/chargebee-go/v3/filter"
5+
installmentEnum "github.com/chargebee/chargebee-go/v3/models/installment/enum"
6+
)
7+
8+
type Installment struct {
9+
Id string `json:"id"`
10+
InvoiceId string `json:"invoice_id"`
11+
Date int64 `json:"date"`
12+
Amount int64 `json:"amount"`
13+
Status installmentEnum.Status `json:"status"`
14+
CreatedAt int64 `json:"created_at"`
15+
UpdatedAt int64 `json:"updated_at"`
16+
Object string `json:"object"`
17+
}
18+
type ListRequestParams struct {
19+
Limit *int32 `json:"limit,omitempty"`
20+
Offset string `json:"offset,omitempty"`
21+
SortBy string `json:"sort_by,omitempty"`
22+
InvoiceId *filter.StringFilter `json:"invoice_id"`
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package enum
2+
3+
type PeriodUnit string
4+
5+
const (
6+
PeriodUnitDay PeriodUnit = "day"
7+
PeriodUnitWeek PeriodUnit = "week"
8+
PeriodUnitMonth PeriodUnit = "month"
9+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package installmentconfig
2+
3+
import (
4+
installmentConfigEnum "github.com/chargebee/chargebee-go/v3/models/installmentconfig/enum"
5+
)
6+
7+
type InstallmentConfig struct {
8+
Id string `json:"id"`
9+
Description string `json:"description"`
10+
NumberOfInstallments int32 `json:"number_of_installments"`
11+
PeriodUnit installmentConfigEnum.PeriodUnit `json:"period_unit"`
12+
Period int32 `json:"period"`
13+
PreferredDay int32 `json:"preferred_day"`
14+
CreatedAt int64 `json:"created_at"`
15+
UpdatedAt int64 `json:"updated_at"`
16+
Installments []*Installment `json:"installments"`
17+
Object string `json:"object"`
18+
}
19+
type Installment struct {
20+
Period int32 `json:"period"`
21+
AmountPercentage float64 `json:"amount_percentage"`
22+
Object string `json:"object"`
23+
}
24+
type CreateRequestParams struct {
25+
NumberOfInstallments *int32 `json:"number_of_installments"`
26+
PeriodUnit installmentConfigEnum.PeriodUnit `json:"period_unit"`
27+
Period *int32 `json:"period,omitempty"`
28+
PreferredDay *int32 `json:"preferred_day,omitempty"`
29+
Description string `json:"description,omitempty"`
30+
Installments []*CreateInstallmentParams `json:"installments,omitempty"`
31+
}
32+
type CreateInstallmentParams struct {
33+
Period *int32 `json:"period,omitempty"`
34+
AmountPercentage *float64 `json:"amount_percentage,omitempty"`
35+
}

models/invoice/invoice.go

+4
Original file line numberDiff line numberDiff line change
@@ -1035,3 +1035,7 @@ type UpdateDetailsStatementDescriptorParams struct {
10351035
Descriptor string `json:"descriptor,omitempty"`
10361036
AdditionalInfo string `json:"additional_info,omitempty"`
10371037
}
1038+
type InstallmentsRequestParams struct {
1039+
ConfigId string `json:"config_id"`
1040+
Amount *int64 `json:"amount,omitempty"`
1041+
}

models/itemprice/item_price.go

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ type ItemPrice struct {
1111
Id string `json:"id"`
1212
Name string `json:"name"`
1313
ItemFamilyId string `json:"item_family_id"`
14-
ProductId string `json:"product_id"`
1514
ItemId string `json:"item_id"`
1615
Description string `json:"description"`
1716
Status itemPriceEnum.Status `json:"status"`

models/paymentintent/enum/payment_method_type.go

+1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ const (
2121
PaymentMethodTypePayTo PaymentMethodType = "pay_to"
2222
PaymentMethodTypeFasterPayments PaymentMethodType = "faster_payments"
2323
PaymentMethodTypeSepaInstantTransfer PaymentMethodType = "sepa_instant_transfer"
24+
PaymentMethodTypeKlarnaPayNow PaymentMethodType = "klarna_pay_now"
2425
)

models/purchase/purchase.go

+28-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package purchase
22

33
import (
44
"github.com/chargebee/chargebee-go/v3/enum"
5+
contractTermEnum "github.com/chargebee/chargebee-go/v3/models/contractterm/enum"
56
)
67

78
type Purchase struct {
@@ -19,8 +20,11 @@ type CreateRequestParams struct {
1920
ShippingAddresses []*CreateShippingAddressParams `json:"shipping_addresses,omitempty"`
2021
Discounts []*CreateDiscountParams `json:"discounts,omitempty"`
2122
SubscriptionInfo []*CreateSubscriptionInfoParams `json:"subscription_info,omitempty"`
23+
ContractTerms []*CreateContractTermParams `json:"contract_terms,omitempty"`
2224
InvoiceInfo *CreateInvoiceInfoParams `json:"invoice_info,omitempty"`
25+
InstallmentInfo *CreateInstallmentInfoParams `json:"installment_info,omitempty"`
2326
CustomerId string `json:"customer_id"`
27+
PaymentSourceId string `json:"payment_source_id,omitempty"`
2428
}
2529
type CreatePurchaseItemParams struct {
2630
Index *int32 `json:"index"`
@@ -64,21 +68,32 @@ type CreateDiscountParams struct {
6468
IncludedInMrr *bool `json:"included_in_mrr,omitempty"`
6569
}
6670
type CreateSubscriptionInfoParams struct {
67-
Index *int32 `json:"index"`
68-
SubscriptionId string `json:"subscription_id,omitempty"`
69-
BillingCycles *int32 `json:"billing_cycles,omitempty"`
70-
MetaData map[string]interface{} `json:"meta_data,omitempty"`
71+
Index *int32 `json:"index"`
72+
SubscriptionId string `json:"subscription_id,omitempty"`
73+
BillingCycles *int32 `json:"billing_cycles,omitempty"`
74+
ContractTermBillingCycleOnRenewal *int32 `json:"contract_term_billing_cycle_on_renewal,omitempty"`
75+
MetaData map[string]interface{} `json:"meta_data,omitempty"`
76+
}
77+
type CreateContractTermParams struct {
78+
Index *int32 `json:"index"`
79+
ActionAtTermEnd contractTermEnum.ActionAtTermEnd `json:"action_at_term_end,omitempty"`
80+
CancellationCutoffPeriod *int32 `json:"cancellation_cutoff_period,omitempty"`
7181
}
7282
type CreateInvoiceInfoParams struct {
7383
PoNumber string `json:"po_number,omitempty"`
7484
Notes string `json:"notes,omitempty"`
7585
}
86+
type CreateInstallmentInfoParams struct {
87+
ConfigId string `json:"config_id,omitempty"`
88+
Amount *int64 `json:"amount,omitempty"`
89+
}
7690
type EstimateRequestParams struct {
7791
PurchaseItems []*EstimatePurchaseItemParams `json:"purchase_items,omitempty"`
7892
ItemTiers []*EstimateItemTierParams `json:"item_tiers,omitempty"`
7993
ShippingAddresses []*EstimateShippingAddressParams `json:"shipping_addresses,omitempty"`
8094
Discounts []*EstimateDiscountParams `json:"discounts,omitempty"`
8195
SubscriptionInfo []*EstimateSubscriptionInfoParams `json:"subscription_info,omitempty"`
96+
ContractTerms []*EstimateContractTermParams `json:"contract_terms,omitempty"`
8297
Customer *EstimateCustomerParams `json:"customer,omitempty"`
8398
BillingAddress *EstimateBillingAddressParams `json:"billing_address,omitempty"`
8499
ClientProfileId string `json:"client_profile_id,omitempty"`
@@ -126,9 +141,15 @@ type EstimateDiscountParams struct {
126141
IncludedInMrr *bool `json:"included_in_mrr,omitempty"`
127142
}
128143
type EstimateSubscriptionInfoParams struct {
129-
Index *int32 `json:"index"`
130-
SubscriptionId string `json:"subscription_id,omitempty"`
131-
BillingCycles *int32 `json:"billing_cycles,omitempty"`
144+
Index *int32 `json:"index"`
145+
SubscriptionId string `json:"subscription_id,omitempty"`
146+
BillingCycles *int32 `json:"billing_cycles,omitempty"`
147+
ContractTermBillingCycleOnRenewal *int32 `json:"contract_term_billing_cycle_on_renewal,omitempty"`
148+
}
149+
type EstimateContractTermParams struct {
150+
Index *int32 `json:"index"`
151+
ActionAtTermEnd contractTermEnum.ActionAtTermEnd `json:"action_at_term_end,omitempty"`
152+
CancellationCutoffPeriod *int32 `json:"cancellation_cutoff_period,omitempty"`
132153
}
133154
type EstimateCustomerParams struct {
134155
VatNumber string `json:"vat_number,omitempty"`

result.go

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/chargebee/chargebee-go/v3/models/address"
66
"github.com/chargebee/chargebee-go/v3/models/advanceinvoiceschedule"
77
"github.com/chargebee/chargebee-go/v3/models/attacheditem"
8+
"github.com/chargebee/chargebee-go/v3/models/attribute"
89
"github.com/chargebee/chargebee-go/v3/models/card"
910
"github.com/chargebee/chargebee-go/v3/models/comment"
1011
"github.com/chargebee/chargebee-go/v3/models/contact"
@@ -28,6 +29,7 @@ import (
2829
"github.com/chargebee/chargebee-go/v3/models/hierarchy"
2930
"github.com/chargebee/chargebee-go/v3/models/hostedpage"
3031
"github.com/chargebee/chargebee-go/v3/models/impacteditem"
32+
"github.com/chargebee/chargebee-go/v3/models/impacteditemprice"
3133
"github.com/chargebee/chargebee-go/v3/models/impactedsubscription"
3234
"github.com/chargebee/chargebee-go/v3/models/inappsubscription"
3335
"github.com/chargebee/chargebee-go/v3/models/invoice"
@@ -60,6 +62,8 @@ import (
6062
"github.com/chargebee/chargebee-go/v3/models/usage"
6163
"github.com/chargebee/chargebee-go/v3/models/virtualbankaccount"
6264
"github.com/chargebee/chargebee-go/v3/models/paymentvoucher"
65+
"github.com/chargebee/chargebee-go/v3/models/installmentconfig"
66+
"github.com/chargebee/chargebee-go/v3/models/installment"
6367
"net/http"
6468
"strconv"
6569
)
@@ -116,19 +120,23 @@ type Result struct {
116120
GatewayErrorDetail *gatewayerrordetail.GatewayErrorDetail `json:"gateway_error_detail,omitempty"`
117121
ItemFamily *itemfamily.ItemFamily `json:"item_family,omitempty"`
118122
Item *item.Item `json:"item,omitempty"`
123+
Attribute *attribute.Attribute `json:"attribute,omitempty"`
119124
ItemPrice *itemprice.ItemPrice `json:"item_price,omitempty"`
120125
AttachedItem *attacheditem.AttachedItem `json:"attached_item,omitempty"`
121126
DifferentialPrice *differentialprice.DifferentialPrice `json:"differential_price,omitempty"`
122127
Feature *feature.Feature `json:"feature,omitempty"`
123128
ImpactedSubscription *impactedsubscription.ImpactedSubscription `json:"impacted_subscription,omitempty"`
124129
ImpactedItem *impacteditem.ImpactedItem `json:"impacted_item,omitempty"`
130+
ImpactedItemPrice *impacteditemprice.ImpactedItemPrice `json:"impacted_item_price,omitempty"`
125131
SubscriptionEntitlement *subscriptionentitlement.SubscriptionEntitlement `json:"subscription_entitlement,omitempty"`
126132
ItemEntitlement *itementitlement.ItemEntitlement `json:"item_entitlement,omitempty"`
127133
Entitlement *entitlement.Entitlement `json:"entitlement,omitempty"`
128134
InAppSubscription *inappsubscription.InAppSubscription `json:"in_app_subscription,omitempty"`
129135
EntitlementOverride *entitlementoverride.EntitlementOverride `json:"entitlement_override,omitempty"`
130136
Purchase *purchase.Purchase `json:"purchase,omitempty"`
131137
PaymentVoucher *paymentvoucher.PaymentVoucher `json:"payment_voucher,omitempty"`
138+
InstallmentConfig *installmentconfig.InstallmentConfig `json:"installment_config,omitempty"`
139+
Installment *installment.Installment `json:"installment,omitempty"`
132140
UnbilledCharges []*unbilledcharge.UnbilledCharge `json:"unbilled_charges,omitempty"`
133141
CreditNotes []*creditnote.CreditNote `json:"credit_notes,omitempty"`
134142
AdvanceInvoiceSchedules []*advanceinvoiceschedule.AdvanceInvoiceSchedule `json:"advance_invoice_schedules,omitempty"`

version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package chargebee
22

3-
const Version string = "3.15.0"
3+
const Version string = "3.16.0"

0 commit comments

Comments
 (0)