From 2e49535b6975f7c64c375afcd11cfc61368d03bc Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Wed, 27 Mar 2019 11:23:04 -0700 Subject: [PATCH] Add a long list of missing params and properties --- charge.go | 15 +++++++------ customer.go | 46 +++++++++++++++++++++++++++------------- invoice.go | 3 ++- invoiceitem.go | 25 ++++++++++++++-------- issuerfraudrecord.go | 2 +- issuing_authorization.go | 3 ++- issuing_card.go | 1 + issuing_cardholder.go | 3 +++ issuing_dispute.go | 9 ++++---- issuing_transaction.go | 1 + loginlink.go | 5 +++-- order.go | 2 ++ paymentintent.go | 4 +++- payout.go | 2 ++ plan.go | 2 ++ product.go | 14 ++++++------ refund.go | 1 + reversal.go | 2 ++ sub.go | 13 ++++++------ subschedule.go | 11 ++++++++++ token.go | 4 ++-- token/client_test.go | 2 +- topup.go | 2 ++ transfer.go | 2 ++ 24 files changed, 119 insertions(+), 55 deletions(-) diff --git a/charge.go b/charge.go index 0485c573fb..f13e6f3f1c 100644 --- a/charge.go +++ b/charge.go @@ -67,7 +67,8 @@ type ChargeLevel3Params struct { // ChargeTransferDataParams is the set of parameters allowed for the transfer_data hash. type ChargeTransferDataParams struct { - Amount *int64 `form:"amount"` + Amount *int64 `form:"amount"` + // This parameter can only be used on Charge creation. Destination *string `form:"destination"` } @@ -136,11 +137,13 @@ type ChargeListParams struct { // CaptureParams is the set of parameters that can be used when capturing a charge. type CaptureParams struct { Params `form:"*"` - Amount *int64 `form:"amount"` - ApplicationFeeAmount *int64 `form:"application_fee_amount"` - ExchangeRate *float64 `form:"exchange_rate"` - ReceiptEmail *string `form:"receipt_email"` - StatementDescriptor *string `form:"statement_descriptor"` + Amount *int64 `form:"amount"` + ApplicationFeeAmount *int64 `form:"application_fee_amount"` + ExchangeRate *float64 `form:"exchange_rate"` + ReceiptEmail *string `form:"receipt_email"` + StatementDescriptor *string `form:"statement_descriptor"` + TransferGroup *string `form:"transfer_group"` + TransferData *ChargeTransferDataParams `form:"transfer_data"` // This property is considered deprecated. Prefer using ApplicationFeeAmount ApplicationFee *int64 `form:"application_fee"` diff --git a/customer.go b/customer.go index ef14a98443..ffdd54334b 100644 --- a/customer.go +++ b/customer.go @@ -25,21 +25,36 @@ const ( // CustomerParams is the set of parameters that can be used when creating or updating a customer. // For more details see https://stripe.com/docs/api#create_customer and https://stripe.com/docs/api#update_customer. type CustomerParams struct { - Params `form:"*"` - AccountBalance *int64 `form:"account_balance"` - Coupon *string `form:"coupon"` - DefaultSource *string `form:"default_source"` - Description *string `form:"description"` - Email *string `form:"email"` - InvoicePrefix *string `form:"invoice_prefix"` - Plan *string `form:"plan"` - Quantity *int64 `form:"quantity"` - Shipping *CustomerShippingDetailsParams `form:"shipping"` - Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*" - TaxInfo *CustomerTaxInfoParams `form:"tax_info"` - TaxPercent *float64 `form:"tax_percent"` - Token *string `form:"-"` // This doesn't seem to be used? - TrialEnd *int64 `form:"trial_end"` + Params `form:"*"` + AccountBalance *int64 `form:"account_balance"` + Coupon *string `form:"coupon"` + DefaultSource *string `form:"default_source"` + Description *string `form:"description"` + Email *string `form:"email"` + InvoicePrefix *string `form:"invoice_prefix"` + InvoiceSettings *CustomerInvoiceSettingsParams `form:"invoice_settings"` + Plan *string `form:"plan"` + Quantity *int64 `form:"quantity"` + Shipping *CustomerShippingDetailsParams `form:"shipping"` + Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*" + TaxInfo *CustomerTaxInfoParams `form:"tax_info"` + TaxPercent *float64 `form:"tax_percent"` + Token *string `form:"-"` // This doesn't seem to be used? + TrialEnd *int64 `form:"trial_end"` +} + +// CustomerInvoiceCustomFieldParams represents the parameters associated with one custom field on +// the customer's invoices. +type CustomerInvoiceCustomFieldParams struct { + Name *string `form:"name"` + Value *string `form:"value"` +} + +// CustomerInvoiceSettingsParams is the structure containing the default settings for invoices +// associated with this customer. +type CustomerInvoiceSettingsParams struct { + CustomFields []*CustomerInvoiceCustomFieldParams `form:"custom_fields"` + Footer *string `form:"footer"` } // CustomerShippingDetailsParams is the structure containing shipping information. @@ -69,6 +84,7 @@ type CustomerListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + Email *string `form:"email"` } // Customer is the resource representing a Stripe customer. diff --git a/invoice.go b/invoice.go index 42ba563771..d8f756663e 100644 --- a/invoice.go +++ b/invoice.go @@ -123,8 +123,9 @@ type InvoiceListParams struct { Billing *string `form:"billing"` Customer *string `form:"customer"` Created *int64 `form:"created"` - CreatedRange *RangeQueryParams `form:"created_range"` + CreatedRange *RangeQueryParams `form:"created"` DueDate *int64 `form:"due_date"` + DueDateRange *RangeQueryParams `form:"due_date"` Subscription *string `form:"subscription"` } diff --git a/invoiceitem.go b/invoiceitem.go index 432c80d304..e5522fc5c7 100644 --- a/invoiceitem.go +++ b/invoiceitem.go @@ -6,15 +6,22 @@ import "encoding/json" // For more details see https://stripe.com/docs/api#create_invoiceitem and https://stripe.com/docs/api#update_invoiceitem. type InvoiceItemParams struct { Params `form:"*"` - Amount *int64 `form:"amount"` - Currency *string `form:"currency"` - Customer *string `form:"customer"` - Description *string `form:"description"` - Discountable *bool `form:"discountable"` - Invoice *string `form:"invoice"` - Quantity *int64 `form:"quantity"` - Subscription *string `form:"subscription"` - UnitAmount *int64 `form:"unit_amount"` + Amount *int64 `form:"amount"` + Currency *string `form:"currency"` + Customer *string `form:"customer"` + Description *string `form:"description"` + Discountable *bool `form:"discountable"` + Invoice *string `form:"invoice"` + Period *InvoiceItemPeriodParams `form:"period"` + Quantity *int64 `form:"quantity"` + Subscription *string `form:"subscription"` + UnitAmount *int64 `form:"unit_amount"` +} + +// InvoiceItemPeriodParams represents the period associated with that invoice item. +type InvoiceItemPeriodParams struct { + End *int64 `form:"end"` + Start *int64 `form:"start"` } // InvoiceItemListParams is the set of parameters that can be used when listing invoice items. diff --git a/issuerfraudrecord.go b/issuerfraudrecord.go index c52fbbdd2e..0bfe593d87 100644 --- a/issuerfraudrecord.go +++ b/issuerfraudrecord.go @@ -26,7 +26,7 @@ type IssuerFraudRecordParams struct { // https://stripe.com/docs#list_issuer_fraud_records. type IssuerFraudRecordListParams struct { ListParams `form:"*"` - Charge *string `form:"-"` + Charge *string `form:"charge"` } // IssuerFraudRecordList is a list of issuer fraud records as retrieved from a diff --git a/issuing_authorization.go b/issuing_authorization.go index c88e5d5f4f..8816e28495 100644 --- a/issuing_authorization.go +++ b/issuing_authorization.go @@ -63,7 +63,8 @@ const ( // IssuingAuthorizationParams is the set of parameters that can be used when updating an issuing authorization. type IssuingAuthorizationParams struct { - Params `form:"*"` + Params `form:"*"` + HeldAmount *int64 `form:"held_amount"` } // IssuingAuthorizationListParams is the set of parameters that can be used when listing issuing authorizations. diff --git a/issuing_card.go b/issuing_card.go index c1a1c8e261..c740175fce 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -81,6 +81,7 @@ type IssuingCardListParams struct { CreatedRange *RangeQueryParams `form:"created"` ExpMonth *int64 `form:"exp_month"` ExpYear *int64 `form:"exp_year"` + Name *string `form:"name"` Last4 *string `form:"last4"` Source *string `form:"source"` Status *string `form:"status"` diff --git a/issuing_cardholder.go b/issuing_cardholder.go index c62ae0e169..175b16a966 100644 --- a/issuing_cardholder.go +++ b/issuing_cardholder.go @@ -32,8 +32,10 @@ type IssuingCardholderParams struct { Params `form:"*"` Billing *IssuingBillingParams `form:"billing"` Email *string `form:"email"` + IsDefault *bool `form:"is_default"` Name *string `form:"name"` PhoneNumber *string `form:"phone_number"` + Status *string `form:"status"` Type *string `form:"type"` } @@ -43,6 +45,7 @@ type IssuingCardholderListParams struct { Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` Email *string `form:"email"` + IsDefault *bool `form:"is_default"` PhoneNumber *string `form:"phone_number"` Status *string `form:"status"` Type *string `form:"type"` diff --git a/issuing_dispute.go b/issuing_dispute.go index a34bbdefda..50904f025e 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -53,10 +53,11 @@ type IssuingDisputeParams struct { // IssuingDisputeListParams is the set of parameters that can be used when listing issuing dispute. type IssuingDisputeListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` - CreatedRange *RangeQueryParams `form:"created"` - Transaction *string `form:"transaction"` + ListParams `form:"*"` + Created *int64 `form:"created"` + CreatedRange *RangeQueryParams `form:"created"` + DisputedTransaction *string `form:"disputed_transaction"` + Transaction *string `form:"transaction"` } // IssuingDisputeEvidenceFraudulent is the resource representing the evidence hash on an issuing dispute diff --git a/issuing_transaction.go b/issuing_transaction.go index 75534826ee..d9865c3164 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -25,6 +25,7 @@ type IssuingTransactionListParams struct { Cardholder *string `form:"cardholder"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + Dispute *string `form:"dispute"` } // IssuingTransaction is the resource representing a Stripe issuing transaction. diff --git a/loginlink.go b/loginlink.go index 59e0180685..b89ef32566 100644 --- a/loginlink.go +++ b/loginlink.go @@ -3,8 +3,9 @@ package stripe // LoginLinkParams is the set of parameters that can be used when creating a login_link. // For more details see https://stripe.com/docs/api#create_login_link. type LoginLinkParams struct { - Params `form:"*"` - Account *string `form:"-"` // Included in URL + Params `form:"*"` + Account *string `form:"-"` // Included in URL + RedirectURL *string `form:"redirect_url"` } // LoginLink is the resource representing a login link for Express accounts. diff --git a/order.go b/order.go index 79e609a6c4..e0a62c963d 100644 --- a/order.go +++ b/order.go @@ -149,6 +149,7 @@ type Order struct { Status string `json:"status"` StatusTransitions StatusTransitions `json:"status_transitions"` Updated int64 `json:"updated"` + UpstreamID string `json:"upstream_id"` } // OrderList is a list of orders as retrieved from a list endpoint. @@ -166,6 +167,7 @@ type OrderListParams struct { IDs []*string `form:"ids"` Status *string `form:"status"` StatusTransitions *StatusTransitionsFilterParams `form:"status_transitions"` + UpstreamIDs []*string `form:"upstream_ids"` } // StatusTransitionsFilterParams are parameters that can used to filter on status_transition when listing orders. diff --git a/paymentintent.go b/paymentintent.go index d1734ce664..9ba8e96420 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -111,7 +111,9 @@ type PaymentIntentParams struct { // PaymentIntentListParams is the set of parameters that can be used when listing payment intents. // For more details see https://stripe.com/docs/api#list_payouts. type PaymentIntentListParams struct { - ListParams `form:"*"` + ListParams `form:"*"` + Created *int64 `form:"created"` + CreatedRange *RangeQueryParams `form:"created"` } // PaymentIntentLastPaymentError represents the last error happening on a payment intent. diff --git a/payout.go b/payout.go index 0d3e11b39c..fcc8af26d6 100644 --- a/payout.go +++ b/payout.go @@ -85,6 +85,7 @@ type PayoutParams struct { Params `form:"*"` Amount *int64 `form:"amount"` Currency *string `form:"currency"` + Description *string `form:"description"` Destination *string `form:"destination"` Method *string `form:"method"` SourceType *string `form:"source_type"` @@ -114,6 +115,7 @@ type Payout struct { Card *Card `json:"card"` Created int64 `json:"created"` Currency Currency `json:"currency"` + Description *string `json:"description"` Destination *PayoutDestination `json:"destination"` FailureBalanceTransaction *BalanceTransaction `json:"failure_balance_transaction"` FailureCode PayoutFailureCode `json:"failure_code"` diff --git a/plan.go b/plan.go index c86922dde2..ba6c580714 100644 --- a/plan.go +++ b/plan.go @@ -168,10 +168,12 @@ func (p *PlanTierParams) AppendTo(body *form.Values, keyParts []string) { // This can only be used on plan creation and won't work on plan update. // For more details see https://stripe.com/docs/api#create_plan-product and https://stripe.com/docs/api#update_plan-product type PlanProductParams struct { + Active *bool `form:"active"` ID *string `form:"id"` Name *string `form:"name"` Metadata map[string]string `form:"metadata"` StatementDescriptor *string `form:"statement_descriptor"` + UnitLabel *string `form:"unit_label"` } // UnmarshalJSON handles deserialization of a Plan. diff --git a/product.go b/product.go index 67f55ff67f..de6785a933 100644 --- a/product.go +++ b/product.go @@ -79,12 +79,14 @@ type ProductList struct { // ProductListParams is the set of parameters that can be used when listing products. type ProductListParams struct { - ListParams `form:"*"` - Active *bool `form:"active"` - IDs []*string `form:"ids"` - Shippable *bool `form:"shippable"` - URL *string `form:"url"` - Type *string `form:"type"` + ListParams `form:"*"` + Active *bool `form:"active"` + Created *int64 `form:"created"` + CreatedRange *RangeQueryParams `form:"created"` + IDs []*string `form:"ids"` + Shippable *bool `form:"shippable"` + URL *string `form:"url"` + Type *string `form:"type"` } // UnmarshalJSON handles deserialization of a Product. diff --git a/refund.go b/refund.go index d821dce1cf..8d717768fa 100644 --- a/refund.go +++ b/refund.go @@ -38,6 +38,7 @@ type RefundParams struct { // For more details see https://stripe.com/docs/api#list_refunds. type RefundListParams struct { ListParams `form:"*"` + Charge *string `form:"charge"` } // Refund is the resource representing a Stripe refund. diff --git a/reversal.go b/reversal.go index dd84cca432..d017016021 100644 --- a/reversal.go +++ b/reversal.go @@ -6,6 +6,7 @@ import "encoding/json" type ReversalParams struct { Params `form:"*"` Amount *int64 `form:"amount"` + Description *string `form:"description"` RefundApplicationFee *bool `form:"refund_application_fee"` Transfer *string `form:"-"` // Included in URL } @@ -22,6 +23,7 @@ type Reversal struct { BalanceTransaction *BalanceTransaction `json:"balance_transaction"` Created int64 `json:"created"` Currency Currency `json:"currency"` + Description string `json:"description"` DestinationPaymentRefund *Refund `json:"destination_payment_refund"` ID string `json:"id"` Metadata map[string]string `json:"metadata"` diff --git a/sub.go b/sub.go index 61bd7f6cd7..d618fc9fd7 100644 --- a/sub.go +++ b/sub.go @@ -102,12 +102,13 @@ func (p *SubscriptionParams) AppendTo(body *form.Values, keyParts []string) { // SubscriptionItemsParams is the set of parameters that can be used when creating or updating a subscription item on a subscription // For more details see https://stripe.com/docs/api#create_subscription and https://stripe.com/docs/api#update_subscription. type SubscriptionItemsParams struct { - Params `form:"*"` - ClearUsage *bool `form:"clear_usage"` - Deleted *bool `form:"deleted"` - ID *string `form:"id"` - Plan *string `form:"plan"` - Quantity *int64 `form:"quantity"` + Params `form:"*"` + BillingThresholds *SubscriptionItemBillingThresholdsParams `form:"billing_thresholds"` + ClearUsage *bool `form:"clear_usage"` + Deleted *bool `form:"deleted"` + ID *string `form:"id"` + Plan *string `form:"plan"` + Quantity *int64 `form:"quantity"` } // SubscriptionListParams is the set of parameters that can be used when listing active subscriptions. diff --git a/subschedule.go b/subschedule.go index c5ca7b0ca0..1e4cd61972 100644 --- a/subschedule.go +++ b/subschedule.go @@ -48,10 +48,19 @@ type SubscriptionSchedulePhaseParams struct { EndDate *int64 `form:"end_date"` Iterations *int64 `form:"iterations"` Plans []*SubscriptionSchedulePhaseItemParams `form:"plans"` + StartDate *int64 `form:"start_date"` + TaxPercent *float64 `form:"tax_percent"` Trial *bool `form:"trial"` TrialEnd *int64 `form:"trial_end"` } +// SubscriptionScheduleRenewalIntervalParams is a structure representing the renewal interval +// for a given subscription schedule. +type SubscriptionScheduleRenewalIntervalParams struct { + Interval *string `form:"interval"` + Length *int64 `form:"length"` +} + // SubscriptionScheduleParams is the set of parameters that can be used when creating or updating a // subscription schedule. type SubscriptionScheduleParams struct { @@ -62,7 +71,9 @@ type SubscriptionScheduleParams struct { FromSubscription *string `form:"from_subscription"` InvoiceSettings *SubscriptionScheduleInvoiceSettingsParams `form:"invoice_settings"` Phases []*SubscriptionSchedulePhaseParams `form:"phases"` + Prorate *bool `form:"prorate"` RenewalBehavior *string `form:"renewal_behavior"` + RenewalInterval *SubscriptionScheduleRenewalIntervalParams `form:"renewal_interval"` StartDate *int64 `form:"start_date"` } diff --git a/token.go b/token.go index 3cfc773420..f9958d6a1d 100644 --- a/token.go +++ b/token.go @@ -46,6 +46,6 @@ type Token struct { // PIIParams are parameters for personal identifiable information (PII). type PIIParams struct { - Params `form:"*"` - PersonalIDNumber *string `form:"personal_id_number"` + Params `form:"*"` + IDNumber *string `form:"id_number"` } diff --git a/token/client_test.go b/token/client_test.go index 3cdd5ec259..b9e4704280 100644 --- a/token/client_test.go +++ b/token/client_test.go @@ -41,7 +41,7 @@ func TestTokenNew_WithCard(t *testing.T) { func TestTokenNew_WithPII(t *testing.T) { token, err := New(&stripe.TokenParams{ PII: &stripe.PIIParams{ - PersonalIDNumber: stripe.String("000000000"), + IDNumber: stripe.String("000000000"), }, }) assert.Nil(t, err) diff --git a/topup.go b/topup.go index 2ac8092dc7..cf0e8527a4 100644 --- a/topup.go +++ b/topup.go @@ -9,6 +9,7 @@ type TopupParams struct { Description *string `form:"description"` Source *SourceParams `form:"*"` // SourceParams has custom encoding so brought to top level with "*" StatementDescriptor *string `form:"statement_descriptor"` + TransferGroup *string `form:"transfer_group"` } // SetSource adds valid sources to a TopupParams object, @@ -50,4 +51,5 @@ type Topup struct { Source *PaymentSource `json:"source"` StatementDescriptor string `json:"statement_descriptor"` Status string `json:"status"` + TransferGroup string `json:"transfer_group"` } diff --git a/transfer.go b/transfer.go index 3b2b332ec2..ef61de580b 100644 --- a/transfer.go +++ b/transfer.go @@ -27,6 +27,7 @@ type TransferParams struct { Params `form:"*"` Amount *int64 `form:"amount"` Currency *string `form:"currency"` + Description *string `form:"description"` Destination *string `form:"destination"` SourceTransaction *string `form:"source_transaction"` SourceType *string `form:"source_type"` @@ -51,6 +52,7 @@ type Transfer struct { BalanceTransaction *BalanceTransaction `json:"balance_transaction"` Created int64 `json:"created"` Currency Currency `json:"currency"` + Description string `json:"description"` Destination *TransferDestination `json:"destination"` DestinationPayment *Charge `json:"destination_payment"` ID string `json:"id"`