Skip to content

Commit

Permalink
feat: add auto_capture_at field within the invoice object (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: ProcessOut Fountain <[email protected]>
  • Loading branch information
roshan-gorasia-cko and processout-machine authored Apr 10, 2024
1 parent d46ca8f commit 4e8ce65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ type Invoice struct {
UnsupportedFeatureBypass *UnsupportedFeatureBypass `json:"unsupported_feature_bypass,omitempty"`
// Verification is the a boolean to indicate if an invoice is a verification invoice. This is used to manually create a verification invoice.
Verification *bool `json:"verification,omitempty"`
// AutoCaptureAt is the a timestamp to indicate when an auto capture should take place following an authorization. This takes priority over the value sent in the authorization request.
AutoCaptureAt *time.Time `json:"auto_capture_at,omitempty"`

client *ProcessOut
}
Expand Down Expand Up @@ -224,6 +226,7 @@ func (s *Invoice) Prefill(c *Invoice) *Invoice {
s.Billing = c.Billing
s.UnsupportedFeatureBypass = c.UnsupportedFeatureBypass
s.Verification = c.Verification
s.AutoCaptureAt = c.AutoCaptureAt

return s
}
Expand Down Expand Up @@ -1387,6 +1390,7 @@ func (s Invoice) Create(options ...InvoiceCreateParameters) (*Invoice, error) {
Billing interface{} `json:"billing"`
UnsupportedFeatureBypass interface{} `json:"unsupported_feature_bypass"`
Verification interface{} `json:"verification"`
AutoCaptureAt interface{} `json:"auto_capture_at"`
}{
Options: opt.Options,
CustomerID: s.CustomerID,
Expand Down Expand Up @@ -1421,6 +1425,7 @@ func (s Invoice) Create(options ...InvoiceCreateParameters) (*Invoice, error) {
Billing: s.Billing,
UnsupportedFeatureBypass: s.UnsupportedFeatureBypass,
Verification: s.Verification,
AutoCaptureAt: s.AutoCaptureAt,
}

body, err := json.Marshal(data)
Expand Down
2 changes: 1 addition & 1 deletion processout.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func New(projectID, projectSecret string) *ProcessOut {
func setupRequest(client *ProcessOut, opt *Options, req *http.Request) {
req.Header.Set("Content-Type", "application/json")
req.Header.Set("API-Version", client.APIVersion)
req.Header.Set("User-Agent", "ProcessOut Go-Bindings/v4.37.0")
req.Header.Set("User-Agent", "ProcessOut Go-Bindings/v4.38.0")
req.Header.Set("Accept", "application/json")
if client.UserAgent != "" {
req.Header.Set("User-Agent", client.UserAgent)
Expand Down

0 comments on commit 4e8ce65

Please sign in to comment.