Skip to content

Commit

Permalink
Remove all beta features from Issuing APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Apr 16, 2020
1 parent 28c24cf commit 35aa632
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 314 deletions.
8 changes: 4 additions & 4 deletions issuing/authorization/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ type Client struct {
}

// Approve approves an issuing authorization.
func Approve(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {
func Approve(id string, params *stripe.IssuingAuthorizationApproveParams) (*stripe.IssuingAuthorization, error) {
return getC().Approve(id, params)
}

// Approve updates an issuing authorization.
func (c Client) Approve(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {
func (c Client) Approve(id string, params *stripe.IssuingAuthorizationApproveParams) (*stripe.IssuingAuthorization, error) {
path := stripe.FormatURLPath("/v1/issuing/authorizations/%s/approve", id)
authorization := &stripe.IssuingAuthorization{}
err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)
return authorization, err
}

// Decline decline an issuing authorization.
func Decline(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {
func Decline(id string, params *stripe.IssuingAuthorizationDeclineParams) (*stripe.IssuingAuthorization, error) {
return getC().Decline(id, params)
}

// Decline updates an issuing authorization.
func (c Client) Decline(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) {
func (c Client) Decline(id string, params *stripe.IssuingAuthorizationDeclineParams) (*stripe.IssuingAuthorization, error) {
path := stripe.FormatURLPath("/v1/issuing/authorizations/%s/decline", id)
authorization := &stripe.IssuingAuthorization{}
err := c.B.Call(http.MethodPost, path, c.Key, params, authorization)
Expand Down
4 changes: 2 additions & 2 deletions issuing/authorization/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
)

func TestIssuingAuthorizationApprove(t *testing.T) {
authorization, err := Approve("iauth_123", &stripe.IssuingAuthorizationParams{})
authorization, err := Approve("iauth_123", &stripe.IssuingAuthorizationApproveParams{})
assert.Nil(t, err)
assert.NotNil(t, authorization)
assert.Equal(t, "issuing.authorization", authorization.Object)
}

func TestIssuingAuthorizationDecline(t *testing.T) {
authorization, err := Decline("iauth_123", &stripe.IssuingAuthorizationParams{})
authorization, err := Decline("iauth_123", &stripe.IssuingAuthorizationDeclineParams{})
assert.Nil(t, err)
assert.NotNil(t, authorization)
assert.Equal(t, "issuing.authorization", authorization.Object)
Expand Down
1 change: 0 additions & 1 deletion issuing/cardholder/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func TestIssuingCardholderNew(t *testing.T) {
PostalCode: stripe.String("90210"),
State: stripe.String("CA"),
},
Name: stripe.String("billing name"),
},
Individual: &stripe.IssuingCardholderIndividualParams{
DOB: &stripe.IssuingCardholderIndividualDOBParams{
Expand Down
5 changes: 1 addition & 4 deletions issuing/dispute/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ func TestIssuingDisputeList(t *testing.T) {
}

func TestIssuingDisputeNew(t *testing.T) {
params := &stripe.IssuingDisputeParams{}
params.AddMetadata("key", "value")
dispute, err := New(params)
dispute, err := New(&stripe.IssuingDisputeParams{})
assert.Nil(t, err)
assert.NotNil(t, dispute)
assert.Equal(t, "issuing.dispute", dispute.Object)
}

func TestIssuingDisputeUpdate(t *testing.T) {
params := &stripe.IssuingDisputeParams{}
params.AddMetadata("key", "value")
dispute, err := Update("idp_123", params)
assert.Nil(t, err)
assert.NotNil(t, dispute)
Expand Down
114 changes: 21 additions & 93 deletions issuing_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ const (
IssuingAuthorizationRequestHistoryReasonWebhookApproved IssuingAuthorizationRequestHistoryReason = "webhook_approved"
IssuingAuthorizationRequestHistoryReasonWebhookDeclined IssuingAuthorizationRequestHistoryReason = "webhook_declined"
IssuingAuthorizationRequestHistoryReasonWebhookTimeout IssuingAuthorizationRequestHistoryReason = "webhook_timeout"

// The following value is deprecated. Use IssuingAuthorizationRequestHistoryReasonSpendingControls instead.
IssuingAuthorizationRequestHistoryReasonAuthorizationControls IssuingAuthorizationRequestHistoryReason = "authorization_controls"

// The following values are deprecated. Use IssuingAuthorizationRequestHistoryReasonVerificationFailed instead
IssuingAuthorizationRequestHistoryReasonAuthenticationFailed IssuingAuthorizationRequestHistoryReason = "authentication_failed"
IssuingAuthorizationRequestHistoryReasonIncorrectCVC IssuingAuthorizationRequestHistoryReason = "incorrect_cvc"
IssuingAuthorizationRequestHistoryReasonIncorrectExpiry IssuingAuthorizationRequestHistoryReason = "incorrect_expiry"
)

// IssuingAuthorizationStatus is the possible values for status for an issuing authorization.
Expand All @@ -79,18 +71,6 @@ const (
IssuingAuthorizationStatusReversed IssuingAuthorizationStatus = "reversed"
)

// IssuingAuthorizationVerificationDataAuthentication is the list of possible values for the result
// of an authentication on an issuing authorization.
type IssuingAuthorizationVerificationDataAuthentication string

// List of values that IssuingAuthorizationVerificationDataCheck can take.
const (
IssuingAuthorizationVerificationDataAuthenticationExempt IssuingAuthorizationVerificationDataAuthentication = "exempt"
IssuingAuthorizationVerificationDataAuthenticationFailure IssuingAuthorizationVerificationDataAuthentication = "failure"
IssuingAuthorizationVerificationDataAuthenticationNone IssuingAuthorizationVerificationDataAuthentication = "none"
IssuingAuthorizationVerificationDataAuthenticationSuccess IssuingAuthorizationVerificationDataAuthentication = "success"
)

// IssuingAuthorizationVerificationDataCheck is the list of possible values for result of a check
// for verification data on an issuing authorization.
type IssuingAuthorizationVerificationDataCheck string
Expand Down Expand Up @@ -122,25 +102,21 @@ const (
IssuingAuthorizationWalletTypeSamsungPay IssuingAuthorizationWalletType = "samsung_pay"
)

// IssuingAuthorizationWalletProviderType is the list of possible values for the authorization's wallet provider.
// TODO remove in the next major version
type IssuingAuthorizationWalletProviderType string

// List of values that IssuingAuthorizationWalletProviderType can take.
const (
IssuingAuthorizationWalletProviderTypeApplePay IssuingAuthorizationWalletProviderType = "apple_pay"
IssuingAuthorizationWalletProviderTypeGooglePay IssuingAuthorizationWalletProviderType = "google_pay"
IssuingAuthorizationWalletProviderTypeSamsungPay IssuingAuthorizationWalletProviderType = "samsung_pay"
)

// IssuingAuthorizationParams is the set of parameters that can be used when updating an issuing authorization.
type IssuingAuthorizationParams struct {
Params `form:"*"`
Amount *int64 `form:"amount"`
}

// IssuingAuthorizationApproveParams is the set of parameters that can be used when approving an issuing authorization.
type IssuingAuthorizationApproveParams struct {
Params `form:"*"`
Amount *int64 `form:"amount"`
}

// The following parameter is deprecated, use Amount instead.
// TODO: remove in a future major version
HeldAmount *int64 `form:"held_amount"`
// IssuingAuthorizationDeclineParams is the set of parameters that can be used when declining an issuing authorization.
type IssuingAuthorizationDeclineParams struct {
Params `form:"*"`
}

// IssuingAuthorizationListParams is the set of parameters that can be used when listing issuing authorizations.
Expand All @@ -153,14 +129,16 @@ type IssuingAuthorizationListParams struct {
Status *string `form:"status"`
}

// IssuingAuthorizationAuthorizationControls is the resource representing authorization controls on an issuing authorization.
// This is deprecated and will be removed in the next major version
type IssuingAuthorizationAuthorizationControls 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"`
// IssuingAuthorizationMerchantData is the resource representing merchant data on Issuing APIs.
type IssuingAuthorizationMerchantData struct {
Category string `json:"category"`
City string `json:"city"`
Country string `json:"country"`
Name string `json:"name"`
NetworkID string `json:"network_id"`
PostalCode string `json:"postal_code"`
State string `json:"state"`
URL string `json:"url"`
}

// IssuingAuthorizationPendingRequest is the resource representing details about the pending authorization request.
Expand All @@ -172,14 +150,6 @@ type IssuingAuthorizationPendingRequest struct {
MerchantCurrency Currency `json:"merchant_currency"`
}

// IssuingAuthorizationRequestHistoryViolatedAuthorizationControl is the resource representing an
// authorizaton control that caused the authorization to fail.
// This is deprecated and will be removed in the next major version
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 {
Amount int64 `json:"amount"`
Expand All @@ -189,14 +159,6 @@ type IssuingAuthorizationRequestHistory struct {
MerchantAmount int64 `json:"merchant_amount"`
MerchantCurrency Currency `json:"merchant_currency"`
Reason IssuingAuthorizationRequestHistoryReason `json:"reason"`

// The following properties are deprecated
// TODO: remove in the next major version
AuthorizedAmount int64 `json:"authorized_amount"`
AuthorizedCurrency Currency `json:"authorized_currency"`
HeldAmount int64 `json:"held_amount"`
HeldCurrency Currency `json:"held_currency"`
ViolatedAuthorizationControls []*IssuingAuthorizationRequestHistoryViolatedAuthorizationControl `json:"violated_authorization_controls"`
}

// IssuingAuthorizationVerificationDataThreeDSecure is the resource representing 3DS results.
Expand All @@ -211,14 +173,6 @@ type IssuingAuthorizationVerificationData struct {
CVCCheck IssuingAuthorizationVerificationDataCheck `json:"cvc_check"`
ExpiryCheck IssuingAuthorizationVerificationDataCheck `json:"expiry_check"`
ThreeDSecure *IssuingAuthorizationVerificationDataThreeDSecure `json:"three_d_secure"`

// The property is considered deprecated. Use AddressPostalCodeCheck instead.
// TODO remove in the next major version
AddressZipCheck IssuingAuthorizationVerificationDataCheck `json:"address_zip_check"`

// The property is considered deprecated. Use ThreeDSecure instead.
// TODO remove in the next major version
Authentication IssuingAuthorizationVerificationDataAuthentication `json:"authentication"`
}

// IssuingAuthorization is the resource representing a Stripe issuing authorization.
Expand All @@ -236,7 +190,7 @@ type IssuingAuthorization struct {
Livemode bool `json:"livemode"`
MerchantAmount int64 `json:"merchant_amount"`
MerchantCurrency Currency `json:"merchant_currency"`
MerchantData *IssuingMerchantData `json:"merchant_data"`
MerchantData *IssuingAuthorizationMerchantData `json:"merchant_data"`
Metadata map[string]string `json:"metadata"`
Object string `json:"object"`
PendingRequest *IssuingAuthorizationPendingRequest `json:"pending_request"`
Expand All @@ -245,32 +199,6 @@ type IssuingAuthorization struct {
Transactions []*IssuingTransaction `json:"transactions"`
VerificationData *IssuingAuthorizationVerificationData `json:"verification_data"`
Wallet IssuingAuthorizationWalletType `json:"wallet"`

// This property is deprecated and we recommend that you use Wallet instead.
// TODO: remove in the next major version
WalletProvider IssuingAuthorizationWalletProviderType `json:"wallet_provider"`

// The following properties are considered deprecated
// TODO: remove in the next major version
AuthorizedAmount int64 `json:"authorized_amount"`
AuthorizedCurrency Currency `json:"authorized_currency"`
HeldAmount int64 `json:"held_amount"`
HeldCurrency Currency `json:"held_currency"`
IsHeldAmountControllable bool `json:"is_held_amount_controllable"`
PendingAuthorizedAmount int64 `json:"pending_authorized_amount"`
PendingHeldAmount int64 `json:"pending_held_amount"`
}

// IssuingMerchantData is the resource representing merchant data on Issuing APIs.
type IssuingMerchantData struct {
Category string `json:"category"`
City string `json:"city"`
Country string `json:"country"`
Name string `json:"name"`
NetworkID string `json:"network_id"`
PostalCode string `json:"postal_code"`
State string `json:"state"`
URL string `json:"url"`
}

// IssuingAuthorizationList is a list of issuing authorizations as retrieved from a list endpoint.
Expand Down
Loading

0 comments on commit 35aa632

Please sign in to comment.