Skip to content

Commit

Permalink
feat/add-new-transaction-and-invoice-fields (#15)
Browse files Browse the repository at this point in the history
Co-authored-by: ProcessOut Fountain <internal@processout.com>
  • Loading branch information
roshan-gorasia-cko and processout-machine authored Feb 16, 2024
1 parent d54dd56 commit 61ce646
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 318 deletions.
302 changes: 0 additions & 302 deletions api_request.go

This file was deleted.

10 changes: 10 additions & 0 deletions invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type Invoice struct {
URL *string `json:"url,omitempty"`
// Name is the name of the invoice
Name *string `json:"name,omitempty"`
// OrderID is the iD of the order for this transaction in merchant's system
OrderID *string `json:"order_id,omitempty"`
// Amount is the amount to be paid
Amount *string `json:"amount,omitempty"`
// Currency is the currency of the invoice
Expand Down Expand Up @@ -104,6 +106,8 @@ type Invoice struct {
Billing *InvoiceBilling `json:"billing,omitempty"`
// UnsupportedFeatureBypass is the flags to bypass unsupported features
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"`

client *ProcessOut
}
Expand Down Expand Up @@ -187,6 +191,7 @@ func (s *Invoice) Prefill(c *Invoice) *Invoice {
s.Details = c.Details
s.URL = c.URL
s.Name = c.Name
s.OrderID = c.OrderID
s.Amount = c.Amount
s.Currency = c.Currency
s.MerchantInitiatorType = c.MerchantInitiatorType
Expand Down Expand Up @@ -218,6 +223,7 @@ func (s *Invoice) Prefill(c *Invoice) *Invoice {
s.PaymentIntent = c.PaymentIntent
s.Billing = c.Billing
s.UnsupportedFeatureBypass = c.UnsupportedFeatureBypass
s.Verification = c.Verification

return s
}
Expand Down Expand Up @@ -1351,6 +1357,7 @@ func (s Invoice) Create(options ...InvoiceCreateParameters) (*Invoice, error) {
*Options
CustomerID interface{} `json:"customer_id"`
Name interface{} `json:"name"`
OrderID interface{} `json:"order_id"`
Amount interface{} `json:"amount"`
Currency interface{} `json:"currency"`
Metadata interface{} `json:"metadata"`
Expand Down Expand Up @@ -1379,10 +1386,12 @@ func (s Invoice) Create(options ...InvoiceCreateParameters) (*Invoice, error) {
PaymentType interface{} `json:"payment_type"`
Billing interface{} `json:"billing"`
UnsupportedFeatureBypass interface{} `json:"unsupported_feature_bypass"`
Verification interface{} `json:"verification"`
}{
Options: opt.Options,
CustomerID: s.CustomerID,
Name: s.Name,
OrderID: s.OrderID,
Amount: s.Amount,
Currency: s.Currency,
Metadata: s.Metadata,
Expand Down Expand Up @@ -1411,6 +1420,7 @@ func (s Invoice) Create(options ...InvoiceCreateParameters) (*Invoice, error) {
PaymentType: s.PaymentType,
Billing: s.Billing,
UnsupportedFeatureBypass: s.UnsupportedFeatureBypass,
Verification: s.Verification,
}

body, err := json.Marshal(data)
Expand Down
Loading

0 comments on commit 61ce646

Please sign in to comment.