Skip to content
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 ViolatedAuthorizationControls on Issuing Authorization #989

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions issuing_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,30 @@ const (
IssuingAuthorizationAuthorizationMethodSwipe IssuingAuthorizationAuthorizationMethod = "swipe"
)

// IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity is the list of possible values
// for the entity that owns the authorization control.
type IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity string

// List of values that IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity can take.
const (
IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntityAccount IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity = "account"
IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntityCard IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity = "card"
IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntityCardholder IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity = "cardholder"
)

// IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName is the list of possible values
// for the name associated with the authorization control.
type IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName string

// List of values that IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName can take.
const (
IssuingAuthorizationRequestHistoryViolatedAuthorizationControlNameAllowedCategories IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName = "allowed_categories"
IssuingAuthorizationRequestHistoryViolatedAuthorizationControlNameBlockedCategories IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName = "blocked_categories"
IssuingAuthorizationRequestHistoryViolatedAuthorizationControlNameMaxAmount IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName = "max_amount"
IssuingAuthorizationRequestHistoryViolatedAuthorizationControlNameMaxApprovals IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName = "max_approvals"
IssuingAuthorizationRequestHistoryViolatedAuthorizationControlNameSpendingLimits IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName = "spending_limits"
)

// IssuingAuthorizationRequestHistoryReason is the list of possible values for the request history
// reason on an issuing authorization.
type IssuingAuthorizationRequestHistoryReason string
Expand Down Expand Up @@ -98,15 +122,23 @@ type IssuingAuthorizationAuthorizationControls struct {
MaxApprovals int64 `json:"max_approvals"`
}

// IssuingAuthorizationRequestHistoryViolatedAuthorizationControl is the resource representing an
// authorizaton control that caused the authorization to fail.
type IssuingAuthorizationRequestHistoryViolatedAuthorizationControl struct {
Entity IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity `json:"entity"`
Name IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName `json:"name"`
}

// IssuingAuthorizationRequestHistory is the resource representing a request history on an issuing authorization.
type IssuingAuthorizationRequestHistory struct {
Approved bool `json:"approved"`
AuthorizedAmount int64 `json:"authorized_amount"`
AuthorizedCurrency Currency `json:"authorized_currency"`
Created int64 `json:"created"`
HeldAmount int64 `json:"held_amount"`
HeldCurrency Currency `json:"held_currency"`
Reason IssuingAuthorizationRequestHistoryReason `json:"reason"`
Approved bool `json:"approved"`
AuthorizedAmount int64 `json:"authorized_amount"`
AuthorizedCurrency Currency `json:"authorized_currency"`
Created int64 `json:"created"`
HeldAmount int64 `json:"held_amount"`
HeldCurrency Currency `json:"held_currency"`
Reason IssuingAuthorizationRequestHistoryReason `json:"reason"`
ViolatedAuthorizationControls []*IssuingAuthorizationRequestHistoryViolatedAuthorizationControl `json:"violated_authorization_controls"`
}

// IssuingAuthorizationVerificationData is the resource representing verification data on an issuing authorization.
Expand Down