Skip to content

Commit

Permalink
API Updates for beta branch (#1488)
Browse files Browse the repository at this point in the history
* Fix test assert to allow beta versions (#1478)

* Codegen for openapi v157 (#1477)

* Bump version to 72.115.0

* Use the generated API version (#1482)

* Use the generated API version 2

* remove comment

* API Updates (#1481)

* API Updates (#1484)

* Bump version to 72.116.0

* Document use of undocumented parameters/properties (#1483)

* Document use of undocumented parameters/properties

* Correcting function call

Copied over the dotnet function (i think).  Resolving that error.

* Update README.md

Co-authored-by: Dominic Charley-Roy <[email protected]>

* Update README.md

Co-authored-by: Dominic Charley-Roy <[email protected]>

Co-authored-by: Dominic Charley-Roy <[email protected]>

* Add feature/** and release/** to PR CI triggers (#1486)

* Add feature/** and release/** to PR CI triggers

* Remove extra stuff

* Rename release to sdk-release in CI triggers

* API Updates (#1487)

* Bump version to 72.117.0

* Set version to 72.117.0 to simplify merge

* Reset version to 72.115.0-beta.1

* Codegen for openapi v161

Co-authored-by: Kamil Pajdzik <[email protected]>
Co-authored-by: Kamil Pajdzik <[email protected]>
Co-authored-by: yejia-stripe <[email protected]>
Co-authored-by: Dominic Charley-Roy <[email protected]>
Co-authored-by: Dominic Charley-Roy <[email protected]>
Co-authored-by: rmanzer-stripe <[email protected]>
  • Loading branch information
7 people authored Jun 30, 2022
1 parent 2efb19b commit c1979ac
Show file tree
Hide file tree
Showing 20 changed files with 1,719 additions and 1,418 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ on:
branches:
- master
- beta
- sdk-release/**
- feature/**
pull_request:
branches:
- master
- beta
- sdk-release/**
- feature/**

jobs:
lint:
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 72.117.0 - 2022-06-29
* [#1487](https://github.com/stripe/stripe-go/pull/1487) API Updates
* Add support for `DeliverCard`, `FailCard`, `ReturnCard`, and `ShipCard` test helper methods on resource `Issuing.Card`
* Change type of `PaymentLinkPaymentMethodTypesParams` and `PaymentLinkPaymentMethodTypes` from `literal('card')` to `enum`
* Add support for `HostedRegulatoryReceiptURL` on `TreasuryReceivedCredit` and `TreasuryReceivedDebit`

* [#1483](https://github.com/stripe/stripe-go/pull/1483) Document use of undocumented parameters/properties

## 72.116.0 - 2022-06-23
* [#1484](https://github.com/stripe/stripe-go/pull/1484) API Updates
* Add support for `CaptureMethod` on `PaymentIntentConfirmParams` and `PaymentIntentParams`
* [#1481](https://github.com/stripe/stripe-go/pull/1481) API Updates
* Add support for `PromptPayPayments` on `AccountCapabilitiesParams` and `AccountCapabilities`
* Add support for `PromptPay` on `ChargePaymentMethodDetails`, `PaymentIntentConfirmPaymentMethodDataParams`, `PaymentIntentConfirmPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodDataParams`, `PaymentIntentPaymentMethodOptionsParams`, `PaymentIntentPaymentMethodOptions`, `PaymentMethodParams`, `PaymentMethod`, `SetupIntentConfirmPaymentMethodDataParams`, and `SetupIntentPaymentMethodDataParams`
* Add support for `SubtotalExcludingTax` on `CreditNote` and `Invoice`
* Add support for `AmountExcludingTax` and `UnitAmountExcludingTax` on `CreditNoteLineItem` and `InvoiceLineItem`
* Add support for `RenderingOptions` on `InvoiceParams`
* Add support for `TotalExcludingTax` on `Invoice`
* Add support for new value `promptpay` on enums `InvoicePaymentSettingsPaymentMethodTypes` and `SubscriptionPaymentSettingsPaymentMethodTypes`
* Add support for `AutomaticPaymentMethods` on `OrderPaymentSettings`
* Add support for `PromptPayDisplayQRCode` on `PaymentIntentNextAction`
* Add support for new value `promptpay` on enum `PaymentMethodType`

* [#1482](https://github.com/stripe/stripe-go/pull/1482) Use the generated API version

## 72.115.0 - 2022-06-17
* [#1477](https://github.com/stripe/stripe-go/pull/1477) API Updates
* Add support for `FundCashBalance` test helper method on resource `Customer`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v158
v161
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,47 @@ c, _ := charge.Retrieve("ch_123", p)
c.Customer.ID // ID is still available
c.Customer.Name // Name is now also available (if it had a value)
```
### How to use undocumented parameters and properties

stripe-go is a typed library and it supports all public properties or parameters.

Stripe sometimes launches private beta features which introduce new properties or parameters that are not immediately public. These will not have typed accessors in the stripe-go library but can still be used.

#### Parameters

To pass undocumented parameters to Stripe using stripe-go you need to use the `AddExtra()` method, as shown below:

```go

params := &stripe.CustomerParams{
Email: stripe.String("[email protected]")
}

params.AddExtra("secret_feature_enabled", "true")
params.AddExtra("secret_parameter[primary]","primary value")
params.AddExtra("secret_parameter[secondary]","secondary value")

customer, err := customer.Create(params)
```

#### Properties

You can access undocumented properties returned by Stripe by querying the raw response JSON object. An example of this is shown below:

```go
customer, _ = customer.Get("cus_1234", nil);

var rawData map[string]interface{}
_ = json.Unmarshal(customer.LastResponse.RawJSON, &rawData)

secret_feature_enabled, _ := string(rawData["secret_feature_enabled"].(bool))

secret_parameter, ok := rawData["secret_parameter"].(map[string]interface{})
if ok {
primary := secret_parameter["primary"].(string)
seconardy := secret_parameter["secondary"].(string)
}
```
### Writing a Plugin

If you're writing a plugin that uses the library, we'd appreciate it if you
Expand Down
16 changes: 8 additions & 8 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ const (
)

// The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges.
type AccountCapabilitiesPromptpayPayments string
type AccountCapabilitiesPromptPayPayments string

// List of values that AccountCapabilitiesPromptpayPayments can take
// List of values that AccountCapabilitiesPromptPayPayments can take
const (
AccountCapabilitiesPromptpayPaymentsActive AccountCapabilitiesPromptpayPayments = "active"
AccountCapabilitiesPromptpayPaymentsInactive AccountCapabilitiesPromptpayPayments = "inactive"
AccountCapabilitiesPromptpayPaymentsPending AccountCapabilitiesPromptpayPayments = "pending"
AccountCapabilitiesPromptPayPaymentsActive AccountCapabilitiesPromptPayPayments = "active"
AccountCapabilitiesPromptPayPaymentsInactive AccountCapabilitiesPromptPayPayments = "inactive"
AccountCapabilitiesPromptPayPaymentsPending AccountCapabilitiesPromptPayPayments = "pending"
)

// The status of the banking capability, or whether the account can have bank accounts.
Expand Down Expand Up @@ -458,7 +458,7 @@ type AccountCapabilitiesPayNowPaymentsParams struct {
}

// The promptpay_payments capability.
type AccountCapabilitiesPromptpayPaymentsParams struct {
type AccountCapabilitiesPromptPayPaymentsParams struct {
// Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays.
Requested *bool `form:"requested"`
}
Expand Down Expand Up @@ -556,7 +556,7 @@ type AccountCapabilitiesParams struct {
// The paynow_payments capability.
PayNowPayments *AccountCapabilitiesPayNowPaymentsParams `form:"paynow_payments"`
// The promptpay_payments capability.
PromptpayPayments *AccountCapabilitiesPromptpayPaymentsParams `form:"promptpay_payments"`
PromptPayPayments *AccountCapabilitiesPromptPayPaymentsParams `form:"promptpay_payments"`
// The sepa_debit_payments capability.
SEPADebitPayments *AccountCapabilitiesSEPADebitPaymentsParams `form:"sepa_debit_payments"`
// The sofort_payments capability.
Expand Down Expand Up @@ -964,7 +964,7 @@ type AccountCapabilities struct {
// The status of the paynow payments capability of the account, or whether the account can directly process paynow charges.
PayNowPayments AccountCapabilitiesPayNowPayments `json:"paynow_payments"`
// The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges.
PromptpayPayments AccountCapabilitiesPromptpayPayments `json:"promptpay_payments"`
PromptPayPayments AccountCapabilitiesPromptPayPayments `json:"promptpay_payments"`
// The status of the SEPA Direct Debits payments capability of the account, or whether the account can directly process SEPA Direct Debits charges.
SEPADebitPayments AccountCapabilityStatus `json:"sepa_debit_payments"`
// The status of the Sofort payments capability of the account, or whether the account can directly process Sofort charges.
Expand Down
5 changes: 0 additions & 5 deletions api_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@ package stripe
const (
apiVersion string = "2020-08-27"
)

//
// Suppress the unused constant warning
// The constant is not used for GA releases but is used in betas
var _ = apiVersion
4 changes: 2 additions & 2 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ type ChargePaymentMethodDetailsPayNow struct {
// Reference number associated with this PayNow payment
Reference string `json:"reference"`
}
type ChargePaymentMethodDetailsPromptpay struct {
type ChargePaymentMethodDetailsPromptPay struct {
// Bill reference generated by PromptPay
Reference string `json:"reference"`
}
Expand Down Expand Up @@ -881,7 +881,7 @@ type ChargePaymentMethodDetails struct {
OXXO *ChargePaymentMethodDetailsOXXO `json:"oxxo"`
P24 *ChargePaymentMethodDetailsP24 `json:"p24"`
PayNow *ChargePaymentMethodDetailsPayNow `json:"paynow"`
Promptpay *ChargePaymentMethodDetailsPromptpay `json:"promptpay"`
PromptPay *ChargePaymentMethodDetailsPromptPay `json:"promptpay"`
SepaCreditTransfer *ChargePaymentMethodDetailsSepaCreditTransfer `json:"sepa_credit_transfer"`
SepaDebit *ChargePaymentMethodDetailsSepaDebit `json:"sepa_debit"`
Sofort *ChargePaymentMethodDetailsSofort `json:"sofort"`
Expand Down
4 changes: 2 additions & 2 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1348,7 +1348,7 @@ type CheckoutSessionCustomerDetailsTaxIDs struct {
Value string `json:"value"`
}

// The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in `payment` or `subscription` mode.
// The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in `setup` mode.
type CheckoutSessionCustomerDetails struct {
// The customer's address at the time of checkout. Note: This property is populated only for sessions on or after March 30, 2022.
Address *Address `json:"address"`
Expand Down Expand Up @@ -1711,7 +1711,7 @@ type CheckoutSession struct {
Customer *Customer `json:"customer"`
// Configure whether a Checkout Session creates a Customer when the Checkout Session completes.
CustomerCreation CheckoutSessionCustomerCreation `json:"customer_creation"`
// The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in `payment` or `subscription` mode.
// The customer details including the customer's tax exempt status and the customer's tax IDs. Only the customer's email is present on Sessions in `setup` mode.
CustomerDetails *CheckoutSessionCustomerDetails `json:"customer_details"`
// If provided, this value will be used when the Customer object is created.
// If not provided, customers will be asked to enter their email address.
Expand Down
4 changes: 4 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import (
terminallocation "github.com/stripe/stripe-go/v72/terminal/location"
terminalreader "github.com/stripe/stripe-go/v72/terminal/reader"
testhelperscustomer "github.com/stripe/stripe-go/v72/testhelpers/customer"
testhelpersissuingcard "github.com/stripe/stripe-go/v72/testhelpers/issuing/card"
testhelpersrefund "github.com/stripe/stripe-go/v72/testhelpers/refund"
testhelpersterminalreader "github.com/stripe/stripe-go/v72/testhelpers/terminal/reader"
testhelperstestclock "github.com/stripe/stripe-go/v72/testhelpers/testclock"
Expand Down Expand Up @@ -277,6 +278,8 @@ type API struct {
TerminalReaders *terminalreader.Client
// TestHelpersCustomers is the client used to invoke /customers APIs.
TestHelpersCustomers *testhelperscustomer.Client
// TestHelpersIssuingCards is the client used to invoke /issuing/cards APIs.
TestHelpersIssuingCards *testhelpersissuingcard.Client
// TestHelpersRefunds is the client used to invoke /refunds APIs.
TestHelpersRefunds *testhelpersrefund.Client
// TestHelpersTerminalReaders is the client used to invoke /terminal/readers APIs.
Expand Down Expand Up @@ -417,6 +420,7 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.TerminalLocations = &terminallocation.Client{B: backends.API, Key: key}
a.TerminalReaders = &terminalreader.Client{B: backends.API, Key: key}
a.TestHelpersCustomers = &testhelperscustomer.Client{B: backends.API, Key: key}
a.TestHelpersIssuingCards = &testhelpersissuingcard.Client{B: backends.API, Key: key}
a.TestHelpersRefunds = &testhelpersrefund.Client{B: backends.API, Key: key}
a.TestHelpersTerminalReaders = &testhelpersterminalreader.Client{B: backends.API, Key: key}
a.TestHelpersTestClocks = &testhelperstestclock.Client{B: backends.API, Key: key}
Expand Down
Loading

0 comments on commit c1979ac

Please sign in to comment.