Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1491

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v160
v162
16 changes: 6 additions & 10 deletions cashbalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ const (

// Retrieves a customer's cash balance.
type CashBalanceParams struct {
Params `form:"*"`
Params `form:"*"`
// A hash of settings for this cash balance.
Settings *CashBalanceSettingsParams `form:"settings"`
Customer *string `form:"-"` // Included in URL
}

// A hash of settings for this cash balance.
type CashBalanceSettingsParams struct {
// Method for using the customer balance to pay outstanding
// `customer_balance` PaymentIntents. If set to `automatic`, all available
// funds will automatically be used to pay any outstanding PaymentIntent.
// If set to `manual`, only customer balance funds from bank transfers
// with a reference code matching
// `payment_intent.next_action.display_bank_transfer_intructions.reference_code` will
// automatically be used to pay the corresponding outstanding
// PaymentIntent.
// Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic` or `manual`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
ReconciliationMode *string `form:"reconciliation_mode"`
}
type CashBalanceSettings struct {
Expand All @@ -40,7 +36,7 @@ type CashBalanceSettings struct {
// A customer's `Cash balance` represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account.
type CashBalance struct {
APIResource
// A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0.
// A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
Available map[string]int64 `json:"available"`
// The ID of the customer whose cash balance this object represents.
Customer string `json:"customer"`
Expand Down
2 changes: 2 additions & 0 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ const (
// Returns a list of Checkout Sessions.
type CheckoutSessionListParams struct {
ListParams `form:"*"`
// Only return the Checkout Sessions for the Customer specified.
Customer *string `form:"customer"`
// Only return the Checkout Session for the PaymentIntent specified.
PaymentIntent *string `form:"payment_intent"`
// Only return the Checkout Session for the subscription specified.
Expand Down
9 changes: 1 addition & 8 deletions customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,7 @@ type CustomerListParams struct {
// Settings controlling the behavior of the customer's cash balance,
// such as reconciliation of funds received.
type CustomerCashBalanceSettingsParams struct {
// Method for using the customer balance to pay outstanding
// `customer_balance` PaymentIntents. If set to `automatic`, all available
// funds will automatically be used to pay any outstanding PaymentIntent.
// If set to `manual`, only customer balance funds from bank transfers
// with a reference code matching
// `payment_intent.next_action.display_bank_transfer_intructions.reference_code` will
// automatically be used to pay the corresponding outstanding
// PaymentIntent.
// Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic` or `manual`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation).
ReconciliationMode *string `form:"reconciliation_mode"`
}

Expand Down
68 changes: 34 additions & 34 deletions example/generated_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ func TestPaymentLinkListLineItems(t *testing.T) {
assert.Nil(t, result.Err())
}

func TestSetupAttemptList(t *testing.T) {
params := &stripe.SetupAttemptListParams{
SetupIntent: stripe.String("si_xyz"),
}
params.Limit = stripe.Int64(3)
result := setupattempt.List(params)
assert.NotNil(t, result)
assert.Nil(t, result.Err())
}

func TestSetupIntentVerifyMicrodeposits(t *testing.T) {
params := &stripe.SetupIntentVerifyMicrodepositsParams{}
result, _ := setupintent.VerifyMicrodeposits("seti_xxxxxxxxxxxxx", params)
Expand Down Expand Up @@ -354,6 +364,30 @@ func TestTestHelpersCustomerFundCashBalance(t *testing.T) {
assert.NotNil(t, result)
}

func TestTestHelpersIssuingCardDeliverCard(t *testing.T) {
params := &stripe.TestHelpersIssuingCardDeliverCardParams{}
result, _ := testhelpers_issuing_card.DeliverCard("card_123", params)
assert.NotNil(t, result)
}

func TestTestHelpersIssuingCardFailCard(t *testing.T) {
params := &stripe.TestHelpersIssuingCardFailCardParams{}
result, _ := testhelpers_issuing_card.FailCard("card_123", params)
assert.NotNil(t, result)
}

func TestTestHelpersIssuingCardReturnCard(t *testing.T) {
params := &stripe.TestHelpersIssuingCardReturnCardParams{}
result, _ := testhelpers_issuing_card.ReturnCard("card_123", params)
assert.NotNil(t, result)
}

func TestTestHelpersIssuingCardShipCard(t *testing.T) {
params := &stripe.TestHelpersIssuingCardShipCardParams{}
result, _ := testhelpers_issuing_card.ShipCard("card_123", params)
assert.NotNil(t, result)
}

func TestTestHelpersRefundExpire(t *testing.T) {
params := &stripe.TestHelpersRefundExpireParams{}
result, _ := testhelpers_refund.Expire("re_123", params)
Expand Down Expand Up @@ -470,40 +504,6 @@ func TestTestHelpersTreasuryReceivedDebitCreate(t *testing.T) {
assert.NotNil(t, result)
}

func TestSetupAttemptList(t *testing.T) {
params := &stripe.SetupAttemptListParams{
SetupIntent: stripe.String("si_xyz"),
}
params.Limit = stripe.Int64(3)
result := setupattempt.List(params)
assert.NotNil(t, result)
assert.Nil(t, result.Err())
}

func TestTestHelpersIssuingCardDeliverCard(t *testing.T) {
params := &stripe.TestHelpersIssuingCardDeliverCardParams{}
result, _ := testhelpers_issuing_card.DeliverCard("card_123", params)
assert.NotNil(t, result)
}

func TestTestHelpersIssuingCardFailCard(t *testing.T) {
params := &stripe.TestHelpersIssuingCardFailCardParams{}
result, _ := testhelpers_issuing_card.FailCard("card_123", params)
assert.NotNil(t, result)
}

func TestTestHelpersIssuingCardReturnCard(t *testing.T) {
params := &stripe.TestHelpersIssuingCardReturnCardParams{}
result, _ := testhelpers_issuing_card.ReturnCard("card_123", params)
assert.NotNil(t, result)
}

func TestTestHelpersIssuingCardShipCard(t *testing.T) {
params := &stripe.TestHelpersIssuingCardShipCardParams{}
result, _ := testhelpers_issuing_card.ShipCard("card_123", params)
assert.NotNil(t, result)
}

func TestAccountLinkCreate(t *testing.T) {
params := &stripe.AccountLinkParams{
Account: stripe.String("acct_xxxxxxxxxxxxx"),
Expand Down
2 changes: 1 addition & 1 deletion paymentlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ type PaymentLinkParams struct {
ShippingAddressCollection *PaymentLinkShippingAddressCollectionParams `form:"shipping_address_collection"`
// The shipping rate options to apply to [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link.
ShippingOptions []*PaymentLinkShippingOptionParams `form:"shipping_options"`
// Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button.
// Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button. Changing this value will also affect the hostname in the [url](https://stripe.com/docs/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`).
SubmitType *string `form:"submit_type"`
// When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use `subscription_data`.
SubscriptionData *PaymentLinkSubscriptionDataParams `form:"subscription_data"`
Expand Down
16 changes: 12 additions & 4 deletions refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ type RefundListParams struct {

// Create a refund.
type RefundParams struct {
Params `form:"*"`
Amount *int64 `form:"amount"`
Charge *string `form:"charge"`
InstructionsEmail *string `form:"instructions_email"`
Params `form:"*"`
// A positive integer representing how much to refund.
Amount *int64 `form:"amount"`
Charge *string `form:"charge"`
// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
Currency *string `form:"currency"`
// Customer whose customer balance to refund from.
Customer *string `form:"customer"`
// Address to send refund email, use customer email if not specified
InstructionsEmail *string `form:"instructions_email"`
// Origin of the refund
Origin *string `form:"origin"`
PaymentIntent *string `form:"payment_intent"`
Reason *string `form:"reason"`
RefundApplicationFee *bool `form:"refund_application_fee"`
Expand Down