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

Update generated code for beta #1963

Merged
merged 19 commits into from
Jan 18, 2025
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
64 changes: 28 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
lint:
name: Lint

runs-on: ubuntu-latest
runs-on: "ubuntu-24.04"

steps:
- uses: extractions/setup-just@v2
- uses: actions/checkout@master

- name: Setup go
Expand All @@ -34,50 +35,41 @@ jobs:

- name: lint
run: |
go install honnef.co/go/tools/cmd/[email protected] &&
go install golang.org/x/tools/cmd/[email protected] &&
$HOME/go/bin/staticcheck &&
make vet &&
make check-gofmt
just lint format-check

test:
runs-on: ubuntu-latest
strategy:
matrix:
go:
- "1.23"
- "1.22"
- "1.21"
- "1.20"
- "1.19"
- "1.18"
- "1.17"
- "1.16"
- "1.15"
name: "Test: go v${{ matrix.go }}"
steps:
- uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- uses: stripe/openapi/actions/stripe-mock@master
- name: Test
run: make ci-test
- name: Coveralls
run: make coverage && make coveralls
if: matrix.go == '1.16'
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: Go-${{ matrix.go }}
runs-on: "ubuntu-24.04"
strategy:
matrix:
go:
- "1.23"
- "1.22"
- "1.21"
- "1.20"
- "1.19"
- "1.18"
- "1.17"
- "1.16"
- "1.15"
name: "Test: go v${{ matrix.go }}"
steps:
- uses: extractions/setup-just@v2
- uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- uses: stripe/openapi/actions/stripe-mock@master
- name: Test
run: just ci-test

publish:
name: Publish
if: >-
(github.event_name == 'workflow_dispatch' || github.event_name == 'push') &&
startsWith(github.ref, 'refs/tags/v') &&
endsWith(github.actor, '-stripe')
runs-on: ubuntu-latest
runs-on: "ubuntu-24.04"
steps:
- uses: actions/checkout@v2
- uses: stripe/openapi/actions/notify-release@master
Expand Down
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# Contributing

We welcome bug reports, feature requests, and code contributions in a pull request.

For most pull requests, we request that you identify or create an associated issue that has the necessary context. We use these issues to reach agreement on an approach and save the PR author from having to redo work. Fixing typos or documentation issues likely do not need an issue; for any issue that introduces substantial code changes, changes the public interface, or if you aren't sure, please find or [create an issue](https://www.github.com/stripe/stripe-go/issues/new/choose).

## Contributor License Agreement

All contributors must sign the Contributor License Agreement (CLA) before we can accept their contribution. If you have not yet signed the agreement, you will be given an option to do so when you open a pull request. You can then sign by clicking on the badge in the comment from @CLAassistant.

## Generated code

This project has a combination of manually maintained code and code generated from our private code generator. If your contribution involves changes to generated code, please call this out in the issue or pull request as we will likely need to make a change to our code generator before accepting the contribution.

To identify files with purely generated code, look for the comment `File generated from our OpenAPI spec.` at the start of the file. Generated blocks of code within hand-written files will be between comments that say `The beginning of the section generated from our OpenAPI spec` and `The end of the section generated from our OpenAPI spec`.

## Compatibility with supported language and runtime versions

This project supports [many different langauge and runtime versions](README.md#requirements) and we are unable to accept any contribution that does not work on _all_ supported versions. If, after discussing the approach in the associated issue, your change must use an API / feature that isn't available in all supported versions, please call this out explicitly in the issue or pull request so we can help figure out the best way forward.

## Set up your dev environment

Please refer to this project's [README.md](README.md#development) for instructions on how to set up your development environment.

4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# NOTE: this file is deprecated and slated for deletion; prefer using the equivalent `just` commands.

all: test bench vet lint check-api-clients check-gofmt ci-test

bench:
Expand Down Expand Up @@ -43,7 +45,7 @@ codegen-format: normalize-imports
go install golang.org/x/tools/cmd/[email protected] && goimports -w example/generated_examples_test.go

CURRENT_MAJOR_VERSION := $(shell cat VERSION | sed 's/\..*//')
normalize-imports:
normalize-imports:
@perl -pi -e 's|github.com/stripe/stripe-go/v\d+|github.com/stripe/stripe-go/v$(CURRENT_MAJOR_VERSION)|' go.mod
@find . -name '*.go' -exec perl -pi -e 's|github.com/stripe/stripe-go/(v\d+\|\[MAJOR_VERSION\])|github.com/stripe/stripe-go/v$(CURRENT_MAJOR_VERSION)|' {} +

Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1435
v1454
31 changes: 18 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![Go Reference](https://pkg.go.dev/badge/github.com/stripe/stripe-go)](https://pkg.go.dev/github.com/stripe/stripe-go/v81)
[![Build Status](https://github.com/stripe/stripe-go/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-go/actions/workflows/ci.yml?query=branch%3Amaster)
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-go/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-go?branch=master)

The official [Stripe][stripe] Go client library.

Expand Down Expand Up @@ -628,6 +627,7 @@ func make_raw_request() error {
}

```

See more examples in the [/example/v2 folder](example/v2).

## Support
Expand All @@ -641,19 +641,15 @@ the following guidelines in mind:

1. Code must be `go fmt` compliant.
2. All types, structs and funcs should be documented.
3. Ensure that `make test` succeeds.

## Test
3. Ensure that `just test` succeeds.

The test suite needs testify's `require` package to run:
[Other contribution guidelines for this project](CONTRIBUTING.md)

github.com/stretchr/testify/require

Before running the tests, make sure to grab all of the package's dependencies:
## Test

go get -t -v
We use [just](https://github.com/casey/just) for conveniently running development tasks. You can use them directly, or copy the commands out of the `justfile`. To our help docs, run `just`.

It also depends on [stripe-mock][stripe-mock], so make sure to fetch and run it from a
This package depends on [stripe-mock][stripe-mock], so make sure to fetch and run it from a
background terminal ([stripe-mock's README][stripe-mock-usage] also contains
instructions for installing via Homebrew and other methods):

Expand All @@ -662,15 +658,24 @@ instructions for installing via Homebrew and other methods):

Run all tests:

make test
```sh
just test
# or: go test ./...
```

Run tests for one package:

go test ./invoice
```sh
just test ./invoice
# or: go test ./invoice
```

Run a single test:

go test ./invoice -run TestInvoiceGet
```sh
just test ./invoice -run TestInvoiceGet
# or: go test ./invoice -run TestInvoiceGet
```

For any requests, bug or comments, please [open an issue][issues] or [submit a
pull request][pulls].
Expand Down
30 changes: 30 additions & 0 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,12 @@ type AccountCapabilitiesP24PaymentsParams struct {
Requested *bool `form:"requested"`
}

// The pay_by_bank_payments capability.
type AccountCapabilitiesPayByBankPaymentsParams 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"`
}

// The payco_payments capability.
type AccountCapabilitiesPaycoPaymentsParams 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.
Expand Down Expand Up @@ -836,6 +842,8 @@ type AccountCapabilitiesParams struct {
OXXOPayments *AccountCapabilitiesOXXOPaymentsParams `form:"oxxo_payments"`
// The p24_payments capability.
P24Payments *AccountCapabilitiesP24PaymentsParams `form:"p24_payments"`
// The pay_by_bank_payments capability.
PayByBankPayments *AccountCapabilitiesPayByBankPaymentsParams `form:"pay_by_bank_payments"`
// The payco_payments capability.
PaycoPayments *AccountCapabilitiesPaycoPaymentsParams `form:"payco_payments"`
// The paynow_payments capability.
Expand Down Expand Up @@ -924,6 +932,16 @@ type AccountCompanyAddressKanjiParams struct {
Town *string `form:"town"`
}

// This hash is used to attest that the directors information provided to Stripe is both current and correct.
type AccountCompanyDirectorshipDeclarationParams struct {
// The Unix timestamp marking when the directorship declaration attestation was made.
Date *int64 `form:"date"`
// The IP address from which the directorship declaration attestation was made.
IP *string `form:"ip"`
// The user agent of the browser from which the directorship declaration attestation was made.
UserAgent *string `form:"user_agent"`
}

// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
type AccountCompanyOwnershipDeclarationParams struct {
// The Unix timestamp marking when the beneficial owner attestation was made.
Expand Down Expand Up @@ -956,6 +974,8 @@ type AccountCompanyParams struct {
AddressKana *AccountCompanyAddressKanaParams `form:"address_kana"`
// The Kanji variation of the company's primary address (Japan only).
AddressKanji *AccountCompanyAddressKanjiParams `form:"address_kanji"`
// This hash is used to attest that the directors information provided to Stripe is both current and correct.
DirectorshipDeclaration *AccountCompanyDirectorshipDeclarationParams `form:"directorship_declaration"`
// Whether the company's directors have been provided. Set this Boolean to `true` after creating all the company's directors with [the Persons API](https://stripe.com/api/persons) for accounts with a `relationship.director` requirement. This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided.
DirectorsProvided *bool `form:"directors_provided"`
// Whether the company's executives have been provided. Set this Boolean to `true` after creating all the company's executives with [the Persons API](https://stripe.com/api/persons) for accounts with a `relationship.executive` requirement.
Expand Down Expand Up @@ -1035,6 +1055,12 @@ type AccountDocumentsProofOfRegistrationParams struct {
Files []*string `form:"files"`
}

// One or more documents that demonstrate proof of ultimate beneficial ownership.
type AccountDocumentsProofOfUltimateBeneficialOwnershipParams struct {
// One or more document ids returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `account_requirement`.
Files []*string `form:"files"`
}

// Documents that may be submitted to satisfy various informational requests.
type AccountDocumentsParams struct {
// One or more documents that support the [Bank account ownership verification](https://support.stripe.com/questions/bank-account-ownership-verification) requirement. Must be a document associated with the account's primary active bank account that displays the last 4 digits of the account number, either a statement or a check.
Expand All @@ -1051,6 +1077,8 @@ type AccountDocumentsParams struct {
CompanyTaxIDVerification *AccountDocumentsCompanyTaxIDVerificationParams `form:"company_tax_id_verification"`
// One or more documents showing the company's proof of registration with the national business registry.
ProofOfRegistration *AccountDocumentsProofOfRegistrationParams `form:"proof_of_registration"`
// One or more documents that demonstrate proof of ultimate beneficial ownership.
ProofOfUltimateBeneficialOwnership *AccountDocumentsProofOfUltimateBeneficialOwnershipParams `form:"proof_of_ultimate_beneficial_ownership"`
}

// AccountExternalAccountParams are the parameters allowed to reference an
Expand Down Expand Up @@ -1496,6 +1524,8 @@ type AccountCapabilities struct {
OXXOPayments AccountCapabilityStatus `json:"oxxo_payments"`
// The status of the P24 payments capability of the account, or whether the account can directly process P24 charges.
P24Payments AccountCapabilityStatus `json:"p24_payments"`
// The status of the pay_by_bank payments capability of the account, or whether the account can directly process pay_by_bank charges.
PayByBankPayments AccountCapabilityStatus `json:"pay_by_bank_payments"`
// The status of the Payco capability of the account, or whether the account can directly process Payco payments.
PaycoPayments AccountCapabilityStatus `json:"payco_payments"`
// The status of the paynow payments capability of the account, or whether the account can directly process paynow charges.
Expand Down
Loading