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

Template changes #43

Merged
merged 7 commits into from
Sep 24, 2024
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ go mod tidy
Then, reference gocardless-pro-go in a Go program with `import`:
``` go
import (
gocardless "github.com/gocardless/gocardless-pro-go/v3"
gocardless "github.com/gocardless/gocardless-pro-go/v4"
)
```

Expand All @@ -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.12.0
go get -u github.com/gocardless/gocardless-pro-go@v4.0.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.12.0
4.0.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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down
2 changes: 1 addition & 1 deletion bank_details_lookup_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down
93 changes: 63 additions & 30 deletions billing_request_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type BillingRequestLinks struct {
PaymentProvider string `url:"payment_provider,omitempty" json:"payment_provider,omitempty"`
PaymentRequest string `url:"payment_request,omitempty" json:"payment_request,omitempty"`
PaymentRequestPayment string `url:"payment_request_payment,omitempty" json:"payment_request_payment,omitempty"`
SubscriptionRequest string `url:"subscription_request,omitempty" json:"subscription_request,omitempty"`
}

type BillingRequestMandateRequestConstraintsPeriodicLimits struct {
Expand Down Expand Up @@ -168,19 +169,35 @@ type BillingRequestResources struct {
CustomerBillingDetail *BillingRequestResourcesCustomerBillingDetail `url:"customer_billing_detail,omitempty" json:"customer_billing_detail,omitempty"`
}

type BillingRequestSubscriptionRequest struct {
Amount int `url:"amount,omitempty" json:"amount,omitempty"`
AppFee int `url:"app_fee,omitempty" json:"app_fee,omitempty"`
Count int `url:"count,omitempty" json:"count,omitempty"`
Currency string `url:"currency,omitempty" json:"currency,omitempty"`
DayOfMonth int `url:"day_of_month,omitempty" json:"day_of_month,omitempty"`
Interval int `url:"interval,omitempty" json:"interval,omitempty"`
IntervalUnit string `url:"interval_unit,omitempty" json:"interval_unit,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
Month string `url:"month,omitempty" json:"month,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
PaymentReference string `url:"payment_reference,omitempty" json:"payment_reference,omitempty"`
StartDate string `url:"start_date,omitempty" json:"start_date,omitempty"`
}

// BillingRequest model
type BillingRequest struct {
Actions []BillingRequestActions `url:"actions,omitempty" json:"actions,omitempty"`
CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
FallbackEnabled bool `url:"fallback_enabled,omitempty" json:"fallback_enabled,omitempty"`
Id string `url:"id,omitempty" json:"id,omitempty"`
Links *BillingRequestLinks `url:"links,omitempty" json:"links,omitempty"`
MandateRequest *BillingRequestMandateRequest `url:"mandate_request,omitempty" json:"mandate_request,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
PaymentRequest *BillingRequestPaymentRequest `url:"payment_request,omitempty" json:"payment_request,omitempty"`
PurposeCode string `url:"purpose_code,omitempty" json:"purpose_code,omitempty"`
Resources *BillingRequestResources `url:"resources,omitempty" json:"resources,omitempty"`
Status string `url:"status,omitempty" json:"status,omitempty"`
Actions []BillingRequestActions `url:"actions,omitempty" json:"actions,omitempty"`
CreatedAt string `url:"created_at,omitempty" json:"created_at,omitempty"`
FallbackEnabled bool `url:"fallback_enabled,omitempty" json:"fallback_enabled,omitempty"`
Id string `url:"id,omitempty" json:"id,omitempty"`
Links *BillingRequestLinks `url:"links,omitempty" json:"links,omitempty"`
MandateRequest *BillingRequestMandateRequest `url:"mandate_request,omitempty" json:"mandate_request,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
PaymentRequest *BillingRequestPaymentRequest `url:"payment_request,omitempty" json:"payment_request,omitempty"`
PurposeCode string `url:"purpose_code,omitempty" json:"purpose_code,omitempty"`
Resources *BillingRequestResources `url:"resources,omitempty" json:"resources,omitempty"`
Status string `url:"status,omitempty" json:"status,omitempty"`
SubscriptionRequest *BillingRequestSubscriptionRequest `url:"subscription_request,omitempty" json:"subscription_request,omitempty"`
}

type BillingRequestService interface {
Expand Down Expand Up @@ -241,14 +258,30 @@ type BillingRequestCreateParamsPaymentRequest struct {
Scheme string `url:"scheme,omitempty" json:"scheme,omitempty"`
}

type BillingRequestCreateParamsSubscriptionRequest struct {
Amount int `url:"amount,omitempty" json:"amount,omitempty"`
AppFee int `url:"app_fee,omitempty" json:"app_fee,omitempty"`
Count int `url:"count,omitempty" json:"count,omitempty"`
Currency string `url:"currency,omitempty" json:"currency,omitempty"`
DayOfMonth int `url:"day_of_month,omitempty" json:"day_of_month,omitempty"`
Interval int `url:"interval,omitempty" json:"interval,omitempty"`
IntervalUnit string `url:"interval_unit,omitempty" json:"interval_unit,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
Month string `url:"month,omitempty" json:"month,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
PaymentReference string `url:"payment_reference,omitempty" json:"payment_reference,omitempty"`
StartDate string `url:"start_date,omitempty" json:"start_date,omitempty"`
}

// BillingRequestCreateParams parameters
type BillingRequestCreateParams struct {
FallbackEnabled bool `url:"fallback_enabled,omitempty" json:"fallback_enabled,omitempty"`
Links *BillingRequestCreateParamsLinks `url:"links,omitempty" json:"links,omitempty"`
MandateRequest *BillingRequestCreateParamsMandateRequest `url:"mandate_request,omitempty" json:"mandate_request,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
PaymentRequest *BillingRequestCreateParamsPaymentRequest `url:"payment_request,omitempty" json:"payment_request,omitempty"`
PurposeCode string `url:"purpose_code,omitempty" json:"purpose_code,omitempty"`
FallbackEnabled bool `url:"fallback_enabled,omitempty" json:"fallback_enabled,omitempty"`
Links *BillingRequestCreateParamsLinks `url:"links,omitempty" json:"links,omitempty"`
MandateRequest *BillingRequestCreateParamsMandateRequest `url:"mandate_request,omitempty" json:"mandate_request,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
PaymentRequest *BillingRequestCreateParamsPaymentRequest `url:"payment_request,omitempty" json:"payment_request,omitempty"`
PurposeCode string `url:"purpose_code,omitempty" json:"purpose_code,omitempty"`
SubscriptionRequest *BillingRequestCreateParamsSubscriptionRequest `url:"subscription_request,omitempty" json:"subscription_request,omitempty"`
}

// Create
Expand Down Expand Up @@ -290,7 +323,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -422,7 +455,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -553,7 +586,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -655,7 +688,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -755,7 +788,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -855,7 +888,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -968,7 +1001,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -1077,7 +1110,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -1169,7 +1202,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.0")
req.Header.Set("User-Agent", userAgent)

for key, value := range o.headers {
Expand Down Expand Up @@ -1272,7 +1305,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -1371,7 +1404,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -1477,7 +1510,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.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 @@ -1577,7 +1610,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.12.0")
req.Header.Set("GoCardless-Client-Version", "4.0.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down
Loading
Loading