Skip to content

Commit

Permalink
Merge pull request #1241 from stripe/richardm-api-changes
Browse files Browse the repository at this point in the history
Multiple API Changes
  • Loading branch information
richardm-stripe authored Jan 15, 2021
2 parents 0cc9f2d + 7081c79 commit 5b4c91b
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 9 deletions.
87 changes: 78 additions & 9 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,58 @@ import (
"encoding/json"
)

// CheckoutSessionCustomerDetailsTaxIDsType is the list of allowed values for type
// on the tax_ids inside customer_details of a checkout session.
type CheckoutSessionCustomerDetailsTaxIDsType string

// List of values that CheckoutSessionCustomerDetailsTaxIDsType can take.
const (
CheckoutSessionCustomerDetailsTaxIDsTypeAETRN CheckoutSessionCustomerDetailsTaxIDsType = "ae_trn"
CheckoutSessionCustomerDetailsTaxIDsTypeAUABN CheckoutSessionCustomerDetailsTaxIDsType = "au_abn"
CheckoutSessionCustomerDetailsTaxIDsTypeBRCNPJ CheckoutSessionCustomerDetailsTaxIDsType = "br_cnpj"
CheckoutSessionCustomerDetailsTaxIDsTypeBRCPF CheckoutSessionCustomerDetailsTaxIDsType = "br_cpf"
CheckoutSessionCustomerDetailsTaxIDsTypeCABN CheckoutSessionCustomerDetailsTaxIDsType = "ca_bn"
CheckoutSessionCustomerDetailsTaxIDsTypeCAQST CheckoutSessionCustomerDetailsTaxIDsType = "ca_qst"
CheckoutSessionCustomerDetailsTaxIDsTypeCHVAT CheckoutSessionCustomerDetailsTaxIDsType = "ch_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeCLTIN CheckoutSessionCustomerDetailsTaxIDsType = "cl_tin"
CheckoutSessionCustomerDetailsTaxIDsTypeESCIF CheckoutSessionCustomerDetailsTaxIDsType = "es_cif"
CheckoutSessionCustomerDetailsTaxIDsTypeEUVAT CheckoutSessionCustomerDetailsTaxIDsType = "eu_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeHKBR CheckoutSessionCustomerDetailsTaxIDsType = "hk_br"
CheckoutSessionCustomerDetailsTaxIDsTypeIDNPWP CheckoutSessionCustomerDetailsTaxIDsType = "id_npwp"
CheckoutSessionCustomerDetailsTaxIDsTypeINGST CheckoutSessionCustomerDetailsTaxIDsType = "in_gst"
CheckoutSessionCustomerDetailsTaxIDsTypeJPCN CheckoutSessionCustomerDetailsTaxIDsType = "jp_cn"
CheckoutSessionCustomerDetailsTaxIDsTypeJPRN CheckoutSessionCustomerDetailsTaxIDsType = "jp_rn"
CheckoutSessionCustomerDetailsTaxIDsTypeKRBRN CheckoutSessionCustomerDetailsTaxIDsType = "kr_brn"
CheckoutSessionCustomerDetailsTaxIDsTypeLIUID CheckoutSessionCustomerDetailsTaxIDsType = "li_uid"
CheckoutSessionCustomerDetailsTaxIDsTypeMXRFC CheckoutSessionCustomerDetailsTaxIDsType = "mx_rfc"
CheckoutSessionCustomerDetailsTaxIDsTypeMYFRP CheckoutSessionCustomerDetailsTaxIDsType = "my_frp"
CheckoutSessionCustomerDetailsTaxIDsTypeMYITN CheckoutSessionCustomerDetailsTaxIDsType = "my_itn"
CheckoutSessionCustomerDetailsTaxIDsTypeMYSST CheckoutSessionCustomerDetailsTaxIDsType = "my_sst"
CheckoutSessionCustomerDetailsTaxIDsTypeNOVAT CheckoutSessionCustomerDetailsTaxIDsType = "no_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeNZGST CheckoutSessionCustomerDetailsTaxIDsType = "nz_gst"
CheckoutSessionCustomerDetailsTaxIDsTypeRUINN CheckoutSessionCustomerDetailsTaxIDsType = "ru_inn"
CheckoutSessionCustomerDetailsTaxIDsTypeRUKPP CheckoutSessionCustomerDetailsTaxIDsType = "ru_kpp"
CheckoutSessionCustomerDetailsTaxIDsTypeSAVAT CheckoutSessionCustomerDetailsTaxIDsType = "sa_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeSGGST CheckoutSessionCustomerDetailsTaxIDsType = "sg_gst"
CheckoutSessionCustomerDetailsTaxIDsTypeSGUEN CheckoutSessionCustomerDetailsTaxIDsType = "sg_uen"
CheckoutSessionCustomerDetailsTaxIDsTypeTHVAT CheckoutSessionCustomerDetailsTaxIDsType = "th_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeTWVAT CheckoutSessionCustomerDetailsTaxIDsType = "tw_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeUnknown CheckoutSessionCustomerDetailsTaxIDsType = "unknown"
CheckoutSessionCustomerDetailsTaxIDsTypeUSEIN CheckoutSessionCustomerDetailsTaxIDsType = "us_ein"
CheckoutSessionCustomerDetailsTaxIDsTypeZAVAT CheckoutSessionCustomerDetailsTaxIDsType = "za_vat"
)

// CheckoutSessionCustomerDetailsTaxExempt is the list of allowed values for
// tax_exempt inside customer_details of a checkout session.
type CheckoutSessionCustomerDetailsTaxExempt string

// List of values that CheckoutSessionCustomerDetailsTaxExempt can take.
const (
CheckoutSessionCustomerDetailsTaxExemptExempt CheckoutSessionCustomerDetailsTaxExempt = "exempt"
CheckoutSessionCustomerDetailsTaxExemptNone CheckoutSessionCustomerDetailsTaxExempt = "none"
CheckoutSessionCustomerDetailsTaxExemptReverse CheckoutSessionCustomerDetailsTaxExempt = "reverse"
)

// CheckoutSessionMode is the list of allowed values for the mode on a Session.
type CheckoutSessionMode string

Expand Down Expand Up @@ -75,15 +127,16 @@ type CheckoutSessionDiscountParams struct {
// CheckoutSessionLineItemParams is the set of parameters allowed for a line item
// on a checkout session.
type CheckoutSessionLineItemParams struct {
Amount *int64 `form:"amount"`
Currency *string `form:"currency"`
Description *string `form:"description"`
Images []*string `form:"images"`
Name *string `form:"name"`
Price *string `form:"price"`
PriceData *CheckoutSessionLineItemPriceDataParams `form:"price_data"`
Quantity *int64 `form:"quantity"`
TaxRates []*string `form:"tax_rates"`
Amount *int64 `form:"amount"`
Currency *string `form:"currency"`
Description *string `form:"description"`
DynamicTaxRates []*string `form:"dynamic_tax_rates"`
Images []*string `form:"images"`
Name *string `form:"name"`
Price *string `form:"price"`
PriceData *CheckoutSessionLineItemPriceDataParams `form:"price_data"`
Quantity *int64 `form:"quantity"`
TaxRates []*string `form:"tax_rates"`
}

// CheckoutSessionPaymentIntentDataTransferDataParams is the set of parameters allowed for the
Expand Down Expand Up @@ -187,6 +240,21 @@ type CheckoutSessionListParams struct {
Subscription *string `form:"subscription"`
}

// CheckoutSessionCustomerDetailsTaxIDs represent customer's tax IDs at the
// time of checkout.
type CheckoutSessionCustomerDetailsTaxIDs struct {
Type CheckoutSessionCustomerDetailsTaxIDsType `json:"type"`
Value string `json:"value"`
}

// CheckoutSessionCustomerDetails represent the customer details including
// the tax exempt status and the customer's tax IDs.
type CheckoutSessionCustomerDetails struct {
Email string `json:"email"`
TaxExempt CheckoutSessionCustomerDetailsTaxExempt `json:"tax_exempt"`
TaxIDs []*CheckoutSessionCustomerDetailsTaxIDs `json:"tax_ids"`
}

// CheckoutSessionShippingAddressCollection is the set of parameters allowed for the
// shipping address collection.
type CheckoutSessionShippingAddressCollection struct {
Expand Down Expand Up @@ -224,6 +292,7 @@ type CheckoutSession struct {
APIResource
AllowPromotionCodes bool `json:"allow_promotion_codes"`
CancelURL string `json:"cancel_url"`
CustomerDetails *CheckoutSessionCustomerDetails `json:"customer_details"`
AmountSubtotal int64 `json:"amount_subtotal"`
AmountTotal int64 `json:"amount_total"`
ClientReferenceID string `json:"client_reference_id"`
Expand Down
1 change: 1 addition & 0 deletions issuing_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type IssuingTransactionListParams struct {
Cardholder *string `form:"cardholder"`
Created *int64 `form:"created"`
CreatedRange *RangeQueryParams `form:"created"`
Type *string `form:"type"`
}

// IssuingTransactionAmountDetails is the resource representing the breakdown of the amount.
Expand Down
4 changes: 4 additions & 0 deletions taxrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import "encoding/json"
type TaxRateParams struct {
Params `form:"*"`
Active *bool `form:"active"`
Country *string `form:"country"`
Description *string `form:"description"`
DisplayName *string `form:"display_name"`
Inclusive *bool `form:"inclusive"`
Jurisdiction *string `form:"jurisdiction"`
Percentage *float64 `form:"percentage"`
State *string `form:"state"`
}

// TaxRateListParams is the set of parameters that can be used when listing tax rates.
Expand All @@ -29,6 +31,7 @@ type TaxRateListParams struct {
type TaxRate struct {
APIResource
Active bool `json:"active"`
Country string `json:"country"`
Created int64 `json:"created"`
Description string `json:"description"`
DisplayName string `json:"display_name"`
Expand All @@ -39,6 +42,7 @@ type TaxRate struct {
Metadata map[string]string `json:"metadata"`
Object string `json:"object"`
Percentage float64 `json:"percentage"`
State string `json:"state"`
}

// TaxRateList is a list of tax rates as retrieved from a list endpoint.
Expand Down

0 comments on commit 5b4c91b

Please sign in to comment.