Skip to content

Commit

Permalink
Merge pull request #37 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Template changes
  • Loading branch information
KarmanLeung authored May 30, 2024
2 parents f3b8118 + e2c049f commit 1326ccb
Show file tree
Hide file tree
Showing 72 changed files with 609 additions and 232 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ toolchain will resolve and fetch the gocardless-pro-go module automatically.
Alternatively, you can also explicitly `go get` the package into a project:

```
go get -u github.com/gocardless/gocardless-pro-go@v3.9.0
go get -u github.com/gocardless/gocardless-pro-go@v3.10.0
```

## Initializing the client
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.0
3.10.0
4 changes: 2 additions & 2 deletions bank_authorisation_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (s *BankAuthorisationServiceImpl) Create(ctx context.Context, p BankAuthori
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -179,7 +179,7 @@ func (s *BankAuthorisationServiceImpl) Get(ctx context.Context, identity string,
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down
19 changes: 13 additions & 6 deletions bank_details_lookup_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,24 @@ type BankDetailsLookupService interface {

// BankDetailsLookupCreateParams parameters
type BankDetailsLookupCreateParams struct {
AccountNumber string `url:"account_number,omitempty" json:"account_number,omitempty"`
BankCode string `url:"bank_code,omitempty" json:"bank_code,omitempty"`
BranchCode string `url:"branch_code,omitempty" json:"branch_code,omitempty"`
CountryCode string `url:"country_code,omitempty" json:"country_code,omitempty"`
Iban string `url:"iban,omitempty" json:"iban,omitempty"`
AccountHolderName string `url:"account_holder_name,omitempty" json:"account_holder_name,omitempty"`
AccountNumber string `url:"account_number,omitempty" json:"account_number,omitempty"`
BankCode string `url:"bank_code,omitempty" json:"bank_code,omitempty"`
BranchCode string `url:"branch_code,omitempty" json:"branch_code,omitempty"`
CountryCode string `url:"country_code,omitempty" json:"country_code,omitempty"`
Iban string `url:"iban,omitempty" json:"iban,omitempty"`
}

// Create
// Performs a bank details lookup. As part of the lookup, a modulus check and
// reachability check are performed.
//
// For UK-based bank accounts, where an account holder name is provided (and an
// account number, a sort code or an iban
// are already present), we verify that the account holder name and bank account
// number match the details held by
// the relevant bank.
//
// If your request returns an [error](#api-usage-errors) or the
// `available_debit_schemes`
// attribute is an empty array, you will not be able to collect payments from
Expand Down Expand Up @@ -106,7 +113,7 @@ func (s *BankDetailsLookupServiceImpl) Create(ctx context.Context, p BankDetails
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down
4 changes: 2 additions & 2 deletions billing_request_flow_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (s *BillingRequestFlowServiceImpl) Create(ctx context.Context, p BillingReq
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -255,7 +255,7 @@ func (s *BillingRequestFlowServiceImpl) Initialise(ctx context.Context, identity
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down
60 changes: 34 additions & 26 deletions billing_request_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,14 @@ type BillingRequestPaymentRequestLinks struct {
}

type BillingRequestPaymentRequest struct {
Amount int `url:"amount,omitempty" json:"amount,omitempty"`
AppFee int `url:"app_fee,omitempty" json:"app_fee,omitempty"`
Currency string `url:"currency,omitempty" json:"currency,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
Links *BillingRequestPaymentRequestLinks `url:"links,omitempty" json:"links,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
Scheme string `url:"scheme,omitempty" json:"scheme,omitempty"`
Amount int `url:"amount,omitempty" json:"amount,omitempty"`
AppFee int `url:"app_fee,omitempty" json:"app_fee,omitempty"`
Currency string `url:"currency,omitempty" json:"currency,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
FundsSettlement string `url:"funds_settlement,omitempty" json:"funds_settlement,omitempty"`
Links *BillingRequestPaymentRequestLinks `url:"links,omitempty" json:"links,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
Scheme string `url:"scheme,omitempty" json:"scheme,omitempty"`
}

type BillingRequestResourcesCustomer struct {
Expand Down Expand Up @@ -227,12 +228,13 @@ type BillingRequestCreateParamsMandateRequest struct {
}

type BillingRequestCreateParamsPaymentRequest struct {
Amount int `url:"amount,omitempty" json:"amount,omitempty"`
AppFee int `url:"app_fee,omitempty" json:"app_fee,omitempty"`
Currency string `url:"currency,omitempty" json:"currency,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
Scheme string `url:"scheme,omitempty" json:"scheme,omitempty"`
Amount int `url:"amount,omitempty" json:"amount,omitempty"`
AppFee int `url:"app_fee,omitempty" json:"app_fee,omitempty"`
Currency string `url:"currency,omitempty" json:"currency,omitempty"`
Description string `url:"description,omitempty" json:"description,omitempty"`
FundsSettlement string `url:"funds_settlement,omitempty" json:"funds_settlement,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
Scheme string `url:"scheme,omitempty" json:"scheme,omitempty"`
}

// BillingRequestCreateParams parameters
Expand Down Expand Up @@ -284,7 +286,7 @@ func (s *BillingRequestServiceImpl) Create(ctx context.Context, p BillingRequest
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -416,7 +418,7 @@ func (s *BillingRequestServiceImpl) CollectCustomerDetails(ctx context.Context,
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -502,6 +504,12 @@ type BillingRequestCollectBankAccountParams struct {
// Direct Debit. If a bank account is discovered to be closed or invalid, the
// customer is requested to adjust the account number/routing number and
// succeed in this check to continue with the flow.
//
// _BACS scheme_ [Payer Name
// Verification](https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB)
// is enabled by default for UK based bank accounts, meaning we verify the
// account holder name and bank account
// number match the details held by the relevant bank.
func (s *BillingRequestServiceImpl) CollectBankAccount(ctx context.Context, identity string, p BillingRequestCollectBankAccountParams, opts ...RequestOption) (*BillingRequest, error) {
uri, err := url.Parse(fmt.Sprintf(s.config.Endpoint()+"/billing_requests/%v/actions/collect_bank_account",
identity))
Expand Down Expand Up @@ -541,7 +549,7 @@ func (s *BillingRequestServiceImpl) CollectBankAccount(ctx context.Context, iden
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -643,7 +651,7 @@ func (s *BillingRequestServiceImpl) ConfirmPayerDetails(ctx context.Context, ide
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -743,7 +751,7 @@ func (s *BillingRequestServiceImpl) Fulfil(ctx context.Context, identity string,
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -843,7 +851,7 @@ func (s *BillingRequestServiceImpl) Cancel(ctx context.Context, identity string,
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -956,7 +964,7 @@ func (s *BillingRequestServiceImpl) List(ctx context.Context, p BillingRequestLi
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -1065,7 +1073,7 @@ func (c *BillingRequestListPagingIterator) Value(ctx context.Context) (*BillingR
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -1157,7 +1165,7 @@ func (s *BillingRequestServiceImpl) Get(ctx context.Context, identity string, op
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -1260,7 +1268,7 @@ func (s *BillingRequestServiceImpl) Notify(ctx context.Context, identity string,
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -1359,7 +1367,7 @@ func (s *BillingRequestServiceImpl) Fallback(ctx context.Context, identity strin
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -1465,7 +1473,7 @@ func (s *BillingRequestServiceImpl) ChooseCurrency(ctx context.Context, identity
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -1565,7 +1573,7 @@ func (s *BillingRequestServiceImpl) SelectInstitution(ctx context.Context, ident
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down
10 changes: 5 additions & 5 deletions billing_request_template_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (s *BillingRequestTemplateServiceImpl) List(ctx context.Context, p BillingR
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -218,7 +218,7 @@ func (c *BillingRequestTemplateListPagingIterator) Value(ctx context.Context) (*
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -310,7 +310,7 @@ func (s *BillingRequestTemplateServiceImpl) Get(ctx context.Context, identity st
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -422,7 +422,7 @@ func (s *BillingRequestTemplateServiceImpl) Create(ctx context.Context, p Billin
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down Expand Up @@ -534,7 +534,7 @@ func (s *BillingRequestTemplateServiceImpl) Update(ctx context.Context, identity
req.Header.Set("Authorization", "Bearer "+s.config.Token())
req.Header.Set("GoCardless-Version", "2015-07-06")
req.Header.Set("GoCardless-Client-Library", "gocardless-pro-go")
req.Header.Set("GoCardless-Client-Version", "3.9.0")
req.Header.Set("GoCardless-Client-Version", "3.10.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down
Loading

0 comments on commit 1326ccb

Please sign in to comment.