Skip to content

Commit

Permalink
Add a long list of missing params and properties
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Mar 27, 2019
1 parent 869251a commit 2e49535
Show file tree
Hide file tree
Showing 24 changed files with 119 additions and 55 deletions.
15 changes: 9 additions & 6 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down Expand Up @@ -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"`
Expand Down
46 changes: 31 additions & 15 deletions customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
25 changes: 16 additions & 9 deletions invoiceitem.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion issuerfraudrecord.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion issuing_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions issuing_card.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
3 changes: 3 additions & 0 deletions issuing_cardholder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand All @@ -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"`
Expand Down
9 changes: 5 additions & 4 deletions issuing_dispute.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions issuing_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions loginlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions order.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion paymentintent.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions payout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
Expand Down
2 changes: 2 additions & 0 deletions plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 8 additions & 6 deletions product.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions reversal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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"`
Expand Down
13 changes: 7 additions & 6 deletions sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions subschedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"`
}

Expand Down
4 changes: 2 additions & 2 deletions token.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
2 changes: 1 addition & 1 deletion token/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions topup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"`
}
Loading

0 comments on commit 2e49535

Please sign in to comment.