-
Notifications
You must be signed in to change notification settings - Fork 463
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
Add support for spending_limits
with Issuing Card and Cardholder
#831
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,12 +45,37 @@ const ( | |
IssuingCardTypeVirtual IssuingCardType = "virtual" | ||
) | ||
|
||
// IssuingSpendingLimitInterval is the list of possible values for the interval of a given | ||
// spending limit on an issuing card or cardholder. | ||
type IssuingSpendingLimitInterval string | ||
|
||
// List of values that IssuingCardShippingStatus can take. | ||
const ( | ||
IssuingSpendingLimitIntervalAllTime IssuingSpendingLimitInterval = "all_time" | ||
IssuingSpendingLimitIntervalDaily IssuingSpendingLimitInterval = "daily" | ||
IssuingSpendingLimitIntervalMonthly IssuingSpendingLimitInterval = "monthly" | ||
IssuingSpendingLimitIntervalPerAuthorization IssuingSpendingLimitInterval = "per_authorization" | ||
IssuingSpendingLimitIntervalWeekly IssuingSpendingLimitInterval = "weekly" | ||
IssuingSpendingLimitIntervalYearly IssuingSpendingLimitInterval = "yearly" | ||
) | ||
|
||
// IssuingAuthorizationControlsSpendingLimitsParams is the set of parameters that can be used for | ||
// the spending limits associated with a given issuing card or cardholder. | ||
type IssuingAuthorizationControlsSpendingLimitsParams struct { | ||
Amount *int64 `form:"amount"` | ||
Categories []*string `form:"categories"` | ||
Interval *string `form:"interval"` | ||
} | ||
|
||
// AuthorizationControlsParams is the set of parameters that can be used for the shipping parameter. | ||
type AuthorizationControlsParams struct { | ||
AllowedCategories []*string `form:"allowed_categories"` | ||
BlockedCategories []*string `form:"blocked_categories"` | ||
MaxAmount *int64 `form:"max_amount"` | ||
MaxApprovals *int64 `form:"max_approvals"` | ||
AllowedCategories []*string `form:"allowed_categories"` | ||
BlockedCategories []*string `form:"blocked_categories"` | ||
SpendingLimits *IssuingAuthorizationControlsSpendingLimitsParams `form:"spending_limits"` | ||
|
||
// The following parameters are considered deprecated and only apply to issuing cards | ||
MaxAmount *int64 `form:"max_amount"` | ||
MaxApprovals *int64 `form:"max_approvals"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doing this as this is going away in a future API version and is technically unsupported on Cardholder |
||
} | ||
|
||
// IssuingCardShippingParams is the set of parameters that can be used for the shipping parameter. | ||
|
@@ -98,13 +123,25 @@ type IssuingCardDetails struct { | |
Object string `json:"object"` | ||
} | ||
|
||
// IssuingAuthorizationControlsSpendingLimits is the resource representing spending limits | ||
// associated with a card or cardholder. | ||
type IssuingAuthorizationControlsSpendingLimits struct { | ||
Amount int64 `json:"amount"` | ||
Categories []string `json:"categories"` | ||
Interval IssuingSpendingLimitInterval `json:"interval"` | ||
} | ||
|
||
// IssuingCardAuthorizationControls is the resource representing authorization controls on an issuing card. | ||
// TODO: Rename to IssuingAuthorizationControls in the next major | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flagging this as I am using the bad class name in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1. |
||
type IssuingCardAuthorizationControls struct { | ||
AllowedCategories []string `json:"allowed_categories"` | ||
BlockedCategories []string `json:"blocked_categories"` | ||
Currency Currency `json:"currency"` | ||
MaxAmount int64 `json:"max_amount"` | ||
MaxApprovals int64 `json:"max_approvals"` | ||
AllowedCategories []string `json:"allowed_categories"` | ||
BlockedCategories []string `json:"blocked_categories"` | ||
SpendingLimits *IssuingAuthorizationControlsSpendingLimits `json:"spending_limits"` | ||
|
||
// The properties below are considered deprecated and can only be used for an issuing card. | ||
Currency Currency `json:"currency"` | ||
MaxAmount int64 `json:"max_amount"` | ||
MaxApprovals int64 `json:"max_approvals"` | ||
} | ||
|
||
// IssuingCardShipping is the resource representing shipping on an issuing card. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason I never prefixed this with Issuing. Do you agree it's better to rename in the next major? (there will be an API version).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I noticed that too. Yeah, I think it's fine to just wait for the next major.