From 5681a4343f52761a5b909de6bf07ddb51524e917 Mon Sep 17 00:00:00 2001 From: Recurly Integrations Date: Wed, 17 Jan 2024 20:09:57 +0000 Subject: [PATCH] Generated Latest Changes for v2021-02-25 --- fraud_risk_rule.go | 122 +++++++++++++++++++++++++++++++ invoice.go | 8 ++- invoice_create.go | 8 ++- openapi/api.yaml | 95 +++++++++++++++++++----- purchase_create.go | 8 ++- scripts/clean | 2 + subscription.go | 8 ++- subscription_change_create.go | 3 +- subscription_create.go | 8 ++- subscription_update.go | 8 ++- transaction.go | 3 + transaction_fraud_info.go | 131 ++++++++++++++++++++++++++++++++++ 12 files changed, 366 insertions(+), 38 deletions(-) create mode 100644 fraud_risk_rule.go create mode 100644 transaction_fraud_info.go diff --git a/fraud_risk_rule.go b/fraud_risk_rule.go new file mode 100644 index 0000000..2614d51 --- /dev/null +++ b/fraud_risk_rule.go @@ -0,0 +1,122 @@ +// This file is automatically created by Recurly's OpenAPI generation process +// and thus any edits you make by hand will be lost. If you wish to make a +// change to this file, please create a Github issue explaining the changes you +// need and we will usher them to the appropriate places. +package recurly + +import ( + "context" + "net/http" +) + +type FraudRiskRule struct { + recurlyResponse *ResponseMetadata + + // The Kount rule number. + Code string `json:"code,omitempty"` + + // Description of why the rule was triggered + Message string `json:"message,omitempty"` +} + +// GetResponse returns the ResponseMetadata that generated this resource +func (resource *FraudRiskRule) GetResponse() *ResponseMetadata { + return resource.recurlyResponse +} + +// setResponse sets the ResponseMetadata that generated this resource +func (resource *FraudRiskRule) setResponse(res *ResponseMetadata) { + resource.recurlyResponse = res +} + +// internal struct for deserializing accounts +type fraudRiskRuleList struct { + ListMetadata + Data []FraudRiskRule `json:"data"` + recurlyResponse *ResponseMetadata +} + +// GetResponse returns the ResponseMetadata that generated this resource +func (resource *fraudRiskRuleList) GetResponse() *ResponseMetadata { + return resource.recurlyResponse +} + +// setResponse sets the ResponseMetadata that generated this resource +func (resource *fraudRiskRuleList) setResponse(res *ResponseMetadata) { + resource.recurlyResponse = res +} + +// FraudRiskRuleList allows you to paginate FraudRiskRule objects +type FraudRiskRuleList struct { + client HTTPCaller + requestOptions *RequestOptions + nextPagePath string + hasMore bool + data []FraudRiskRule +} + +func NewFraudRiskRuleList(client HTTPCaller, nextPagePath string, requestOptions *RequestOptions) *FraudRiskRuleList { + return &FraudRiskRuleList{ + client: client, + requestOptions: requestOptions, + nextPagePath: nextPagePath, + hasMore: true, + } +} + +type FraudRiskRuleLister interface { + Fetch() error + FetchWithContext(ctx context.Context) error + Count() (*int64, error) + CountWithContext(ctx context.Context) (*int64, error) + Data() []FraudRiskRule + HasMore() bool + Next() string +} + +func (list *FraudRiskRuleList) HasMore() bool { + return list.hasMore +} + +func (list *FraudRiskRuleList) Next() string { + return list.nextPagePath +} + +func (list *FraudRiskRuleList) Data() []FraudRiskRule { + return list.data +} + +// Fetch fetches the next page of data into the `Data` property +func (list *FraudRiskRuleList) FetchWithContext(ctx context.Context) error { + resources := &fraudRiskRuleList{} + err := list.client.Call(ctx, http.MethodGet, list.nextPagePath, nil, nil, list.requestOptions, resources) + if err != nil { + return err + } + // copy over properties from the response + list.nextPagePath = resources.Next + list.hasMore = resources.HasMore + list.data = resources.Data + return nil +} + +// Fetch fetches the next page of data into the `Data` property +func (list *FraudRiskRuleList) Fetch() error { + return list.FetchWithContext(context.Background()) +} + +// Count returns the count of items on the server that match this pager +func (list *FraudRiskRuleList) CountWithContext(ctx context.Context) (*int64, error) { + resources := &fraudRiskRuleList{} + err := list.client.Call(ctx, http.MethodHead, list.nextPagePath, nil, nil, list.requestOptions, resources) + if err != nil { + return nil, err + } + resp := resources.GetResponse() + return resp.TotalRecords, nil +} + +// Count returns the count of items on the server that match this pager +func (list *FraudRiskRuleList) Count() (*int64, error) { + return list.CountWithContext(context.Background()) +} diff --git a/invoice.go b/invoice.go index 0ce83da..82bf65e 100644 --- a/invoice.go +++ b/invoice.go @@ -55,14 +55,16 @@ type Invoice struct { // Integer paired with `Net Terms Type` and representing the number // of days past the current date (for `net` Net Terms Type) or days after // the last day of the current month (for `eom` Net Terms Type) that the - // invoice will become past due. For any value, an additional 24 hours is + // invoice will become past due. For `manual` collection method, an additional 24 hours is // added to ensure the customer has the entire last day to make payment before - // becoming past due. For example: + // becoming past due. For example: // If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. // If an invoice is due `net 30`, it will become past due at 31 days exactly. // If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + // For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. // When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - // For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. NetTerms int `json:"net_terms,omitempty"` // Optionally supplied string that may be either `net` or `eom` (end-of-month). diff --git a/invoice_create.go b/invoice_create.go index 242a67b..28e64a2 100644 --- a/invoice_create.go +++ b/invoice_create.go @@ -23,14 +23,16 @@ type InvoiceCreate struct { // Integer paired with `Net Terms Type` and representing the number // of days past the current date (for `net` Net Terms Type) or days after // the last day of the current month (for `eom` Net Terms Type) that the - // invoice will become past due. For any value, an additional 24 hours is + // invoice will become past due. For `manual` collection method, an additional 24 hours is // added to ensure the customer has the entire last day to make payment before - // becoming past due. For example: + // becoming past due. For example: // If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. // If an invoice is due `net 30`, it will become past due at 31 days exactly. // If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + // For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. // When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - // For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. NetTerms *int `json:"net_terms,omitempty"` // Optionally supplied string that may be either `net` or `eom` (end-of-month). diff --git a/openapi/api.yaml b/openapi/api.yaml index c9e015a..79ef24e 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -19422,16 +19422,19 @@ components: Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: @@ -19617,16 +19620,19 @@ components: Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: @@ -21733,16 +21739,19 @@ components: Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: @@ -22314,7 +22323,8 @@ components: month (for `eom` Net Terms Type) that the invoice will become past due. During a subscription change, it's not necessary to provide both the `Net Terms Type` and `Net Terms` parameters. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: @@ -22527,16 +22537,19 @@ components: Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: @@ -22720,16 +22733,19 @@ components: Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: @@ -23154,6 +23170,44 @@ components: For all other countries this will come from the VAT Number field in the Billing Info. title: VAT Number + fraud_info: + "$ref": "#/components/schemas/TransactionFraudInfo" + TransactionFraudInfo: + type: object + title: Fraud information + readOnly: true + properties: + object: + type: string + title: Object type + readOnly: true + score: + type: integer + title: Kount score + minimum: 1 + maximum: 99 + decision: + title: Kount decision + maxLength: 10 + "$ref": "#/components/schemas/KountDecisionEnum" + reference: + type: string + title: Kount transaction reference ID + risk_rules_triggered: + type: array + title: Risk Rules Triggered + description: A list of fraud risk rules that were triggered for the transaction. + items: + "$ref": "#/components/schemas/FraudRiskRule" + FraudRiskRule: + type: object + properties: + code: + type: string + title: The Kount rule number. + message: + type: string + title: Description of why the rule was triggered ExternalTransaction: type: object properties: @@ -23457,16 +23511,19 @@ components: Integer paired with `Net Terms Type` and representing the number of days past the current date (for `net` Net Terms Type) or days after the last day of the current month (for `eom` Net Terms Type) that the - invoice will become past due. For any value, an additional 24 hours is + invoice will become past due. For `manual` collection method, an additional 24 hours is added to ensure the customer has the entire last day to make payment before - becoming past due. For example: + becoming past due. For example: If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. If an invoice is due `net 30`, it will become past due at 31 days exactly. If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + + For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. minimum: 0 default: 0 net_terms_type: diff --git a/purchase_create.go b/purchase_create.go index 8dd4751..a363506 100644 --- a/purchase_create.go +++ b/purchase_create.go @@ -25,14 +25,16 @@ type PurchaseCreate struct { // Integer paired with `Net Terms Type` and representing the number // of days past the current date (for `net` Net Terms Type) or days after // the last day of the current month (for `eom` Net Terms Type) that the - // invoice will become past due. For any value, an additional 24 hours is + // invoice will become past due. For `manual` collection method, an additional 24 hours is // added to ensure the customer has the entire last day to make payment before - // becoming past due. For example: + // becoming past due. For example: // If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. // If an invoice is due `net 30`, it will become past due at 31 days exactly. // If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + // For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. // When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - // For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. NetTerms *int `json:"net_terms,omitempty"` // Optionally supplied string that may be either `net` or `eom` (end-of-month). diff --git a/scripts/clean b/scripts/clean index 113a79d..bb1cc90 100755 --- a/scripts/clean +++ b/scripts/clean @@ -23,6 +23,8 @@ rm -f transaction.go rm -f invoice_mini.go rm -f address_with_name.go rm -f transaction_payment_gateway.go +rm -f transaction_fraud_info.go +rm -f fraud_risk_rule.go rm -f coupon_redemption.go rm -f coupon.go rm -f plan_mini.go diff --git a/subscription.go b/subscription.go index a0194e8..3fbfd24 100644 --- a/subscription.go +++ b/subscription.go @@ -121,14 +121,16 @@ type Subscription struct { // Integer paired with `Net Terms Type` and representing the number // of days past the current date (for `net` Net Terms Type) or days after // the last day of the current month (for `eom` Net Terms Type) that the - // invoice will become past due. For any value, an additional 24 hours is + // invoice will become past due. For `manual` collection method, an additional 24 hours is // added to ensure the customer has the entire last day to make payment before - // becoming past due. For example: + // becoming past due. For example: // If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. // If an invoice is due `net 30`, it will become past due at 31 days exactly. // If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + // For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. // When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - // For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. NetTerms int `json:"net_terms,omitempty"` // Optionally supplied string that may be either `net` or `eom` (end-of-month). diff --git a/subscription_change_create.go b/subscription_change_create.go index d1098f3..f41e228 100644 --- a/subscription_change_create.go +++ b/subscription_change_create.go @@ -65,7 +65,8 @@ type SubscriptionChangeCreate struct { // the current date (for `net` Net Terms Type) or days after the last day of the current // month (for `eom` Net Terms Type) that the invoice will become past due. During a subscription // change, it's not necessary to provide both the `Net Terms Type` and `Net Terms` parameters. - // For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. NetTerms *int `json:"net_terms,omitempty"` // Optionally supplied string that may be either `net` or `eom` (end-of-month). diff --git a/subscription_create.go b/subscription_create.go index e16e078..a3fb9b4 100644 --- a/subscription_create.go +++ b/subscription_create.go @@ -87,14 +87,16 @@ type SubscriptionCreate struct { // Integer paired with `Net Terms Type` and representing the number // of days past the current date (for `net` Net Terms Type) or days after // the last day of the current month (for `eom` Net Terms Type) that the - // invoice will become past due. For any value, an additional 24 hours is + // invoice will become past due. For `manual` collection method, an additional 24 hours is // added to ensure the customer has the entire last day to make payment before - // becoming past due. For example: + // becoming past due. For example: // If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. // If an invoice is due `net 30`, it will become past due at 31 days exactly. // If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + // For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. // When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - // For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. NetTerms *int `json:"net_terms,omitempty"` // Optionally supplied string that may be either `net` or `eom` (end-of-month). diff --git a/subscription_update.go b/subscription_update.go index 55be1dd..1ce9b52 100644 --- a/subscription_update.go +++ b/subscription_update.go @@ -43,14 +43,16 @@ type SubscriptionUpdate struct { // Integer paired with `Net Terms Type` and representing the number // of days past the current date (for `net` Net Terms Type) or days after // the last day of the current month (for `eom` Net Terms Type) that the - // invoice will become past due. For any value, an additional 24 hours is + // invoice will become past due. For `manual` collection method, an additional 24 hours is // added to ensure the customer has the entire last day to make payment before - // becoming past due. For example: + // becoming past due. For example: // If an invoice is due `net 0`, it is due 'On Receipt' and will become past due 24 hours after it's created. // If an invoice is due `net 30`, it will become past due at 31 days exactly. // If an invoice is due `eom 30`, it will become past due 31 days from the last day of the current month. + // For `automatic` collection method, the additional 24 hours is not added. For example, On-Receipt is due immediately, and `net 30` will become due exactly 30 days from invoice generation, at which point Recurly will attempt collection. // When `eom` Net Terms Type is passed, the value for `Net Terms` is restricted to `0, 15, 30, 45, 60, or 90`. - // For more information please visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // For more information on how net terms work with `manual` collection visit our docs page (https://docs.recurly.com/docs/manual-payments#section-collection-terms) + // or visit (https://docs.recurly.com/docs/automatic-invoicing-terms#section-collection-terms) for information about net terms using `automatic` collection. NetTerms *int `json:"net_terms,omitempty"` // Optionally supplied string that may be either `net` or `eom` (end-of-month). diff --git a/transaction.go b/transaction.go index d05cfd0..00be0ef 100644 --- a/transaction.go +++ b/transaction.go @@ -136,6 +136,9 @@ type Transaction struct { // VAT number for the customer on this transaction. If the customer's Billing Info country is BR or AR, then this will be their Tax Identifier. For all other countries this will come from the VAT Number field in the Billing Info. VatNumber string `json:"vat_number,omitempty"` + + // Fraud information + FraudInfo TransactionFraudInfo `json:"fraud_info,omitempty"` } // GetResponse returns the ResponseMetadata that generated this resource diff --git a/transaction_fraud_info.go b/transaction_fraud_info.go new file mode 100644 index 0000000..f6b1bcd --- /dev/null +++ b/transaction_fraud_info.go @@ -0,0 +1,131 @@ +// This file is automatically created by Recurly's OpenAPI generation process +// and thus any edits you make by hand will be lost. If you wish to make a +// change to this file, please create a Github issue explaining the changes you +// need and we will usher them to the appropriate places. +package recurly + +import ( + "context" + "net/http" +) + +type TransactionFraudInfo struct { + recurlyResponse *ResponseMetadata + + // Object type + Object string `json:"object,omitempty"` + + // Kount score + Score int `json:"score,omitempty"` + + // Kount decision + Decision string `json:"decision,omitempty"` + + // Kount transaction reference ID + Reference string `json:"reference,omitempty"` + + // A list of fraud risk rules that were triggered for the transaction. + RiskRulesTriggered []FraudRiskRule `json:"risk_rules_triggered,omitempty"` +} + +// GetResponse returns the ResponseMetadata that generated this resource +func (resource *TransactionFraudInfo) GetResponse() *ResponseMetadata { + return resource.recurlyResponse +} + +// setResponse sets the ResponseMetadata that generated this resource +func (resource *TransactionFraudInfo) setResponse(res *ResponseMetadata) { + resource.recurlyResponse = res +} + +// internal struct for deserializing accounts +type transactionFraudInfoList struct { + ListMetadata + Data []TransactionFraudInfo `json:"data"` + recurlyResponse *ResponseMetadata +} + +// GetResponse returns the ResponseMetadata that generated this resource +func (resource *transactionFraudInfoList) GetResponse() *ResponseMetadata { + return resource.recurlyResponse +} + +// setResponse sets the ResponseMetadata that generated this resource +func (resource *transactionFraudInfoList) setResponse(res *ResponseMetadata) { + resource.recurlyResponse = res +} + +// TransactionFraudInfoList allows you to paginate TransactionFraudInfo objects +type TransactionFraudInfoList struct { + client HTTPCaller + requestOptions *RequestOptions + nextPagePath string + hasMore bool + data []TransactionFraudInfo +} + +func NewTransactionFraudInfoList(client HTTPCaller, nextPagePath string, requestOptions *RequestOptions) *TransactionFraudInfoList { + return &TransactionFraudInfoList{ + client: client, + requestOptions: requestOptions, + nextPagePath: nextPagePath, + hasMore: true, + } +} + +type TransactionFraudInfoLister interface { + Fetch() error + FetchWithContext(ctx context.Context) error + Count() (*int64, error) + CountWithContext(ctx context.Context) (*int64, error) + Data() []TransactionFraudInfo + HasMore() bool + Next() string +} + +func (list *TransactionFraudInfoList) HasMore() bool { + return list.hasMore +} + +func (list *TransactionFraudInfoList) Next() string { + return list.nextPagePath +} + +func (list *TransactionFraudInfoList) Data() []TransactionFraudInfo { + return list.data +} + +// Fetch fetches the next page of data into the `Data` property +func (list *TransactionFraudInfoList) FetchWithContext(ctx context.Context) error { + resources := &transactionFraudInfoList{} + err := list.client.Call(ctx, http.MethodGet, list.nextPagePath, nil, nil, list.requestOptions, resources) + if err != nil { + return err + } + // copy over properties from the response + list.nextPagePath = resources.Next + list.hasMore = resources.HasMore + list.data = resources.Data + return nil +} + +// Fetch fetches the next page of data into the `Data` property +func (list *TransactionFraudInfoList) Fetch() error { + return list.FetchWithContext(context.Background()) +} + +// Count returns the count of items on the server that match this pager +func (list *TransactionFraudInfoList) CountWithContext(ctx context.Context) (*int64, error) { + resources := &transactionFraudInfoList{} + err := list.client.Call(ctx, http.MethodHead, list.nextPagePath, nil, nil, list.requestOptions, resources) + if err != nil { + return nil, err + } + resp := resources.GetResponse() + return resp.TotalRecords, nil +} + +// Count returns the count of items on the server that match this pager +func (list *TransactionFraudInfoList) Count() (*int64, error) { + return list.CountWithContext(context.Background()) +}