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 all missing error codes #897

Merged
merged 1 commit into from
Jul 25, 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
106 changes: 92 additions & 14 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,98 @@ type ErrorCode string

// List of values that ErrorCode can take.
const (
ErrorCodeCardDeclined ErrorCode = "card_declined"
ErrorCodeExpiredCard ErrorCode = "expired_card"
ErrorCodeIncorrectCVC ErrorCode = "incorrect_cvc"
ErrorCodeIncorrectZip ErrorCode = "incorrect_zip"
ErrorCodeIncorrectNumber ErrorCode = "incorrect_number"
ErrorCodeInvalidCVC ErrorCode = "invalid_cvc"
ErrorCodeInvalidExpiryMonth ErrorCode = "invalid_expiry_month"
ErrorCodeInvalidExpiryYear ErrorCode = "invalid_expiry_year"
ErrorCodeInvalidNumber ErrorCode = "invalid_number"
ErrorCodeInvalidSwipeData ErrorCode = "invalid_swipe_data"
ErrorCodeMissing ErrorCode = "missing"
ErrorCodeProcessingError ErrorCode = "processing_error"
ErrorCodeRateLimit ErrorCode = "rate_limit"
ErrorCodeResourceMissing ErrorCode = "resource_missing"
ErrorCodeAccountAlreadyExists ErrorCode = "account_already_exists"
ErrorCodeAccountCountryInvalidAddress ErrorCode = "account_country_invalid_address"
ErrorCodeAccountInvalid ErrorCode = "account_invalid"
ErrorCodeAccountNumberInvalid ErrorCode = "account_number_invalid"
ErrorCodeAlipayUpgradeRequired ErrorCode = "alipay_upgrade_required"
ErrorCodeAmountTooLarge ErrorCode = "amount_too_large"
ErrorCodeAmountTooSmall ErrorCode = "amount_too_small"
ErrorCodeAPIKeyExpired ErrorCode = "api_key_expired"
ErrorCodeBalanceInsufficient ErrorCode = "balance_insufficient"
ErrorCodeBankAccountExists ErrorCode = "bank_account_exists"
ErrorCodeBankAccountUnusable ErrorCode = "bank_account_unusable"
ErrorCodeBankAccountUnverified ErrorCode = "bank_account_unverified"
ErrorCodeBitcoinUpgradeRequired ErrorCode = "bitcoin_upgrade_required"
ErrorCodeCardDeclined ErrorCode = "card_declined"
ErrorCodeChargeAlreadyCaptured ErrorCode = "charge_already_captured"
ErrorCodeChargeAlreadyRefunded ErrorCode = "charge_already_refunded"
ErrorCodeChargeDisputed ErrorCode = "charge_disputed"
ErrorCodeChargeExceedsSourceLimit ErrorCode = "charge_exceeds_source_limit"
ErrorCodeChargeExpiredForCapture ErrorCode = "charge_expired_for_capture"
ErrorCodeCountryUnsupported ErrorCode = "country_unsupported"
ErrorCodeCouponExpired ErrorCode = "coupon_expired"
ErrorCodeCustomerMaxSubscriptions ErrorCode = "customer_max_subscriptions"
ErrorCodeEmailInvalid ErrorCode = "email_invalid"
ErrorCodeExpiredCard ErrorCode = "expired_card"
ErrorCodeIdempotencyKeyInUse ErrorCode = "idempotency_key_in_use"
ErrorCodeIncorrectAddress ErrorCode = "incorrect_address"
ErrorCodeIncorrectCVC ErrorCode = "incorrect_cvc"
ErrorCodeIncorrectNumber ErrorCode = "incorrect_number"
ErrorCodeIncorrectZip ErrorCode = "incorrect_zip"
ErrorCodeInstantPayoutsUnsupported ErrorCode = "instant_payouts_unsupported"
ErrorCodeInvalidCardType ErrorCode = "invalid_card_type"
ErrorCodeInvalidChargeAmount ErrorCode = "invalid_charge_amount"
ErrorCodeInvalidCVC ErrorCode = "invalid_cvc"
ErrorCodeInvalidExpiryMonth ErrorCode = "invalid_expiry_month"
ErrorCodeInvalidExpiryYear ErrorCode = "invalid_expiry_year"
ErrorCodeInvalidNumber ErrorCode = "invalid_number"
ErrorCodeInvalidSourceUsage ErrorCode = "invalid_source_usage"
ErrorCodeInvoiceNoCustomerLineItems ErrorCode = "invoice_no_customer_line_items"
ErrorCodeInvoiceNoSubscriptionLineItems ErrorCode = "invoice_no_subscription_line_items"
ErrorCodeInvoiceNotEditable ErrorCode = "invoice_not_editable"
ErrorCodeInvoiceUpcomingNone ErrorCode = "invoice_upcoming_none"
ErrorCodeLivemodeMismatch ErrorCode = "livemode_mismatch"
ErrorCodeMissing ErrorCode = "missing"
ErrorCodeNotAllowedOnStandardAccount ErrorCode = "not_allowed_on_standard_account"
ErrorCodeOrderCreationFailed ErrorCode = "order_creation_failed"
ErrorCodeOrderRequiredSettings ErrorCode = "order_required_settings"
ErrorCodeOrderStatusInvalid ErrorCode = "order_status_invalid"
ErrorCodeOrderUpstreamTimeout ErrorCode = "order_upstream_timeout"
ErrorCodeOutOfInventory ErrorCode = "out_of_inventory"
ErrorCodeParameterInvalidEmpty ErrorCode = "parameter_invalid_empty"
ErrorCodeParameterInvalidInteger ErrorCode = "parameter_invalid_integer"
ErrorCodeParameterInvalidStringBlank ErrorCode = "parameter_invalid_string_blank"
ErrorCodeParameterInvalidStringEmpty ErrorCode = "parameter_invalid_string_empty"
ErrorCodeParameterMissing ErrorCode = "parameter_missing"
ErrorCodeParameterUnknown ErrorCode = "parameter_unknown"
ErrorCodeParametersExclusive ErrorCode = "parameters_exclusive"
ErrorCodePaymentIntentAuthenticationFailure ErrorCode = "payment_intent_authentication_failure"
ErrorCodePaymentIntentIncompatiblePaymentMethod ErrorCode = "payment_intent_incompatible_payment_method"
ErrorCodePaymentIntentInvalidParameter ErrorCode = "payment_intent_invalid_parameter"
ErrorCodePaymentIntentPaymentAttemptFailed ErrorCode = "payment_intent_payment_attempt_failed"
ErrorCodePaymentIntentUnexpectedState ErrorCode = "payment_intent_unexpected_state"
ErrorCodePaymentMethodUnactivated ErrorCode = "payment_method_unactivated"
ErrorCodePaymentMethodUnexpectedState ErrorCode = "payment_method_unexpected_state"
ErrorCodePayoutsNotAllowed ErrorCode = "payouts_not_allowed"
ErrorCodePlatformAPIKeyExpired ErrorCode = "platform_api_key_expired"
ErrorCodePostalCodeInvalid ErrorCode = "postal_code_invalid"
ErrorCodeProcessingError ErrorCode = "processing_error"
ErrorCodeProductInactive ErrorCode = "product_inactive"
ErrorCodeRateLimit ErrorCode = "rate_limit"
ErrorCodeResourceAlreadyExists ErrorCode = "resource_already_exists"
ErrorCodeResourceMissing ErrorCode = "resource_missing"
ErrorCodeRoutingNumberInvalid ErrorCode = "routing_number_invalid"
ErrorCodeSecretKeyRequired ErrorCode = "secret_key_required"
ErrorCodeSepaUnsupportedAccount ErrorCode = "sepa_unsupported_account"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last one Remi: I think we want to go with "SEPA" instead of "Sepa" here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use Sepa everywhere else in the library though for SepaDebit. I don't think we should change that one but happy to make the change if you prefer on that one

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, k. I looked around online and I think "SEPA" is definitely the overall preferred casing (and use in Stripe's docs, etc. too).

That said, given we have pre-existing Sepa in stripe-go, I'm good just keeping it like this for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm unsure on that one, I think both would make sense so deferring to you but happy to make the change

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K cool. Easiest to go with "Sepa" for now then, so just leave it. Thanks!

ErrorCodeSetupAttemptFailed ErrorCode = "setup_attempt_failed"
ErrorCodeSetupIntentAuthenticationFailure ErrorCode = "setup_intent_authentication_failure"
ErrorCodeSetupIntentUnexpectedState ErrorCode = "setup_intent_unexpected_state"
ErrorCodeShippingCalculationFailed ErrorCode = "shipping_calculation_failed"
ErrorCodeSkuInactive ErrorCode = "sku_inactive"
ErrorCodeStateUnsupported ErrorCode = "state_unsupported"
ErrorCodeTaxIDInvalid ErrorCode = "tax_id_invalid"
ErrorCodeTaxesCalculationFailed ErrorCode = "taxes_calculation_failed"
ErrorCodeTestmodeChargesOnly ErrorCode = "testmode_charges_only"
ErrorCodeTLSVersionUnsupported ErrorCode = "tls_version_unsupported"
ErrorCodeTokenAlreadyUsed ErrorCode = "token_already_used"
ErrorCodeTokenInUse ErrorCode = "token_in_use"
ErrorCodeTransfersNotAllowed ErrorCode = "transfers_not_allowed"
ErrorCodeUpstreamOrderCreationFailed ErrorCode = "upstream_order_creation_failed"
ErrorCodeURLInvalid ErrorCode = "url_invalid"

// The following error code can be returned though is undocumented
ErrorCodeInvalidSwipeData ErrorCode = "invalid_swipe_data"
)

// Error is the response returned when a call is unsuccessful.
Expand Down