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

Remove all beta features from Issuing APIs #1052

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cache:
env:
global:
# If changing this number, please also change it in `testing/testing.go`.
- STRIPE_MOCK_VERSION=0.86.0
- STRIPE_MOCK_VERSION=0.87.0

go:
- "1.9.x"
Expand Down
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
13 changes: 0 additions & 13 deletions issuing/card/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,6 @@ func (c Client) List(listParams *stripe.IssuingCardListParams) *Iter {
})}
}

// Details retrieves an issuing card details.
func Details(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCardDetails, error) {
return getC().Details(id, params)
}

// Details retrieves an issuing card details.
func (c Client) Details(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCardDetails, error) {
path := stripe.FormatURLPath("/v1/issuing/cards/%s/details", id)
cardDetails := &stripe.IssuingCardDetails{}
err := c.B.Call(http.MethodGet, path, c.Key, params, cardDetails)
return cardDetails, err
}

// Iter is an iterator for issuing cards.
type Iter struct {
*stripe.Iter
Expand Down
7 changes: 0 additions & 7 deletions issuing/card/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ import (
_ "github.com/stripe/stripe-go/testing"
)

func TestIssuingCardDetails(t *testing.T) {
cardDetails, err := Details("ic_123", nil)
assert.Nil(t, err)
assert.NotNil(t, cardDetails)
assert.Equal(t, "issuing.card_details", cardDetails.Object)
}

func TestIssuingCardGet(t *testing.T) {
card, err := Get("ic_123", nil)
assert.Nil(t, err)
Expand Down
3 changes: 1 addition & 2 deletions issuing/cardholder/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ func TestIssuingCardholderList(t *testing.T) {

func TestIssuingCardholderNew(t *testing.T) {
cardholder, err := New(&stripe.IssuingCardholderParams{
Billing: &stripe.IssuingBillingParams{
Billing: &stripe.IssuingCardholderBillingParams{
Address: &stripe.AddressParams{
Country: stripe.String("US"),
Line1: stripe.String("line1"),
City: stripe.String("city"),
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
139 changes: 24 additions & 115 deletions issuing_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ type IssuingAuthorizationRequestHistoryReason string

// List of values that IssuingAuthorizationRequestHistoryReason can take.
const (
IssuingAuthorizationRequestHistoryReasonAccountComplianceDisabled IssuingAuthorizationRequestHistoryReason = "account_compliance_disabled"
IssuingAuthorizationRequestHistoryReasonAccountInactive IssuingAuthorizationRequestHistoryReason = "account_inactive"
IssuingAuthorizationRequestHistoryReasonAccountDisabled IssuingAuthorizationRequestHistoryReason = "account_disabled"
IssuingAuthorizationRequestHistoryReasonCardActive IssuingAuthorizationRequestHistoryReason = "card_active"
IssuingAuthorizationRequestHistoryReasonCardInactive IssuingAuthorizationRequestHistoryReason = "card_inactive"
IssuingAuthorizationRequestHistoryReasonCardholderInactive IssuingAuthorizationRequestHistoryReason = "cardholder_inactive"
Expand All @@ -59,14 +58,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 +70,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 All @@ -102,16 +81,6 @@ const (
IssuingAuthorizationVerificationDataCheckNotProvided IssuingAuthorizationVerificationDataCheck = "not_provided"
)

// IssuingAuthorizationVerificationDataThreeDSecureResult is the list of possible values for result of 3DS.
type IssuingAuthorizationVerificationDataThreeDSecureResult string

// List of values that IssuingAuthorizationVerificationDataThreeDSecureResult can take.
const (
IssuingAuthorizationVerificationDataThreeDSecureResultAttemptAcknowledged IssuingAuthorizationVerificationDataThreeDSecureResult = "attempt_acknowledged"
IssuingAuthorizationVerificationDataThreeDSecureResultAuthenticated IssuingAuthorizationVerificationDataThreeDSecureResult = "authenticated"
IssuingAuthorizationVerificationDataThreeDSecureResultFailed IssuingAuthorizationVerificationDataThreeDSecureResult = "failed"
)

// IssuingAuthorizationWalletType is the list of possible values for the authorization's wallet provider.
type IssuingAuthorizationWalletType string

Expand All @@ -122,25 +91,20 @@ 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:"*"`
}

// 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 +117,15 @@ 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"`
}

// IssuingAuthorizationPendingRequest is the resource representing details about the pending authorization request.
Expand All @@ -172,14 +137,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,36 +146,14 @@ 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.
type IssuingAuthorizationVerificationDataThreeDSecure struct {
Result IssuingAuthorizationVerificationDataThreeDSecureResult `json:"result"`
}

// IssuingAuthorizationVerificationData is the resource representing verification data on an issuing authorization.
type IssuingAuthorizationVerificationData struct {
AddressLine1Check IssuingAuthorizationVerificationDataCheck `json:"address_line1_check"`
AddressPostalCodeCheck IssuingAuthorizationVerificationDataCheck `json:"address_postal_code_check"`
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"`
AddressLine1Check IssuingAuthorizationVerificationDataCheck `json:"address_line1_check"`
AddressPostalCodeCheck IssuingAuthorizationVerificationDataCheck `json:"address_postal_code_check"`
CVCCheck IssuingAuthorizationVerificationDataCheck `json:"cvc_check"`
ExpiryCheck IssuingAuthorizationVerificationDataCheck `json:"expiry_check"`
}

// IssuingAuthorization is the resource representing a Stripe issuing authorization.
Expand All @@ -236,7 +171,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 +180,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