Skip to content

Commit

Permalink
Merge pull request #44 from gocardless/template-changes
Browse files Browse the repository at this point in the history
Template changes
  • Loading branch information
bekundayo authored Nov 8, 2024
2 parents 2fa1815 + 2946cb1 commit 9ed2935
Show file tree
Hide file tree
Showing 69 changed files with 245 additions and 274 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@v4.0.0
go get -u github.com/gocardless/gocardless-pro-go@v4.1.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 @@
4.0.0
4.1.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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down
6 changes: 4 additions & 2 deletions billing_request_flow_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type BillingRequestFlow struct {
SessionToken string `url:"session_token,omitempty" json:"session_token,omitempty"`
ShowRedirectButtons bool `url:"show_redirect_buttons,omitempty" json:"show_redirect_buttons,omitempty"`
ShowSuccessRedirectButton bool `url:"show_success_redirect_button,omitempty" json:"show_success_redirect_button,omitempty"`
SkipSuccessScreen bool `url:"skip_success_screen,omitempty" json:"skip_success_screen,omitempty"`
}

type BillingRequestFlowService interface {
Expand Down Expand Up @@ -113,6 +114,7 @@ type BillingRequestFlowCreateParams struct {
RedirectUri string `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"`
ShowRedirectButtons bool `url:"show_redirect_buttons,omitempty" json:"show_redirect_buttons,omitempty"`
ShowSuccessRedirectButton bool `url:"show_success_redirect_button,omitempty" json:"show_success_redirect_button,omitempty"`
SkipSuccessScreen bool `url:"skip_success_screen,omitempty" json:"skip_success_screen,omitempty"`
}

// Create
Expand Down Expand Up @@ -155,7 +157,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 +257,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.0")
req.Header.Set("User-Agent", userAgent)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", o.idempotencyKey)
Expand Down
95 changes: 32 additions & 63 deletions billing_request_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ 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 @@ -169,35 +168,20 @@ 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"`
SubscriptionRequest *BillingRequestSubscriptionRequest `url:"subscription_request,omitempty" json:"subscription_request,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"`
FallbackOccurred bool `url:"fallback_occurred,omitempty" json:"fallback_occurred,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"`
}

type BillingRequestService interface {
Expand Down Expand Up @@ -255,33 +239,18 @@ type BillingRequestCreateParamsPaymentRequest struct {
FundsSettlement string `url:"funds_settlement,omitempty" json:"funds_settlement,omitempty"`
Metadata map[string]interface{} `url:"metadata,omitempty" json:"metadata,omitempty"`
Reference string `url:"reference,omitempty" json:"reference,omitempty"`
RetryIfPossible bool `url:"retry_if_possible,omitempty" json:"retry_if_possible,omitempty"`
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"`
SubscriptionRequest *BillingRequestCreateParamsSubscriptionRequest `url:"subscription_request,omitempty" json:"subscription_request,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"`
}

// Create
Expand Down Expand Up @@ -323,7 +292,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -455,7 +424,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -586,7 +555,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -688,7 +657,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -788,7 +757,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -888,7 +857,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -1001,7 +970,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.0")
req.Header.Set("User-Agent", userAgent)

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

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

for key, value := range o.headers {
Expand Down Expand Up @@ -1305,7 +1274,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -1404,7 +1373,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -1510,7 +1479,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 @@ -1610,7 +1579,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", "4.0.0")
req.Header.Set("GoCardless-Client-Version", "4.1.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 9ed2935

Please sign in to comment.