Repository: dj-stripe/dj-stripe

Issue:
ApiErrorCode needs to be updated
https://stripe.com/docs/error-codes


Discussion:

Resolving patch:
diff --git a/djstripe/enums.py b/djstripe/enums.py
--- a/djstripe/enums.py
+++ b/djstripe/enums.py
@@ -51,21 +51,98 @@ class ApiErrorCode(Enum):
 	"""
 	Charge failure error codes.
 
-	https://stripe.com/docs/api#error-codes
+	https://stripe.com/docs/error-codes
 	"""
 
-	invalid_number = _("Invalid number")
-	invalid_expiry_month = _("Invalid expiration month")
-	invalid_expiry_year = _("Invalid expiration year")
-	invalid_cvc = _("Invalid security code")
-	invalid_swipe_data = _("Invalid swipe data")
-	incorrect_number = _("Incorrect number")
+	account_already_exists = _("Account already exists")
+	account_country_invalid_address = _("Account country invalid address")
+	account_invalid = _("Account invalid")
+	account_number_invalid = _("Account number invalid")
+	alipay_upgrade_required = _("Alipay upgrade required")
+	amount_too_large = _("Amount too large")
+	amount_too_small = _("Amount too small")
+	api_key_expired = _("Api key expired")
+	balance_insufficient = _("Balance insufficient")
+	bank_account_exists = _("Bank account exists")
+	bank_account_unusable = _("Bank account unusable")
+	bank_account_unverified = _("Bank account unverified")
+	bitcoin_upgrade_required = _("Bitcoin upgrade required")
+	card_declined = _("Card was declined")
+	charge_already_captured = _("Charge already captured")
+	charge_already_refunded = _("Charge already refunded")
+	charge_disputed = _("Charge disputed")
+	charge_exceeds_source_limit = _("Charge exceeds source limit")
+	charge_expired_for_capture = _("Charge expired for capture")
+	country_unsupported = _("Country unsupported")
+	coupon_expired = _("Coupon expired")
+	customer_max_subscriptions = _("Customer max subscriptions")
+	email_invalid = _("Email invalid")
 	expired_card = _("Expired card")
+	idempotency_key_in_use = _("Idempotency key in use")
+	incorrect_address = _("Incorrect address")
 	incorrect_cvc = _("Incorrect security code")
+	incorrect_number = _("Incorrect number")
 	incorrect_zip = _("ZIP code failed validation")
-	card_declined = _("Card was declined")
+	instant_payouts_unsupported = _("Instant payouts unsupported")
+	invalid_card_type = _("Invalid card type")
+	invalid_charge_amount = _("Invalid charge amount")
+	invalid_cvc = _("Invalid security code")
+	invalid_expiry_month = _("Invalid expiration month")
+	invalid_expiry_year = _("Invalid expiration year")
+	invalid_number = _("Invalid number")
+	invalid_source_usage = _("Invalid source usage")
+	invoice_no_customer_line_items = _("Invoice no customer line items")
+	invoice_no_subscription_line_items = _("Invoice no subscription line items")
+	invoice_not_editable = _("Invoice not editable")
+	invoice_upcoming_none = _("Invoice upcoming none")
+	livemode_mismatch = _("Livemode mismatch")
 	missing = _("No card being charged")
+	not_allowed_on_standard_account = _("Not allowed on standard account")
+	order_creation_failed = _("Order creation failed")
+	order_required_settings = _("Order required settings")
+	order_status_invalid = _("Order status invalid")
+	order_upstream_timeout = _("Order upstream timeout")
+	out_of_inventory = _("Out of inventory")
+	parameter_invalid_empty = _("Parameter invalid empty")
+	parameter_invalid_integer = _("Parameter invalid integer")
+	parameter_invalid_string_blank = _("Parameter invalid string blank")
+	parameter_invalid_string_empty = _("Parameter invalid string empty")
+	parameter_missing = _("Parameter missing")
+	parameter_unknown = _("Parameter unknown")
+	parameters_exclusive = _("Parameters exclusive")
+	payment_intent_authentication_failure = _("Payment intent authentication failure")
+	payment_intent_incompatible_payment_method = _("Payment intent incompatible payment method")
+	payment_intent_invalid_parameter = _("Payment intent invalid parameter")
+	payment_intent_payment_attempt_failed = _("Payment intent payment attempt failed")
+	payment_intent_unexpected_state = _("Payment intent unexpected state")
+	payment_method_unactivated = _("Payment method unactivated")
+	payment_method_unexpected_state = _("Payment method unexpected state")
+	payouts_not_allowed = _("Payouts not allowed")
+	platform_api_key_expired = _("Platform api key expired")
+	postal_code_invalid = _("Postal code invalid")
 	processing_error = _("Processing error")
+	product_inactive = _("Product inactive")
+	rate_limit = _("Rate limit")
+	resource_already_exists = _("Resource already exists")
+	resource_missing = _("Resource missing")
+	routing_number_invalid = _("Routing number invalid")
+	secret_key_required = _("Secret key required")
+	sepa_unsupported_account = _("SEPA unsupported account")
+	shipping_calculation_failed = _("Shipping calculation failed")
+	sku_inactive = _("SKU inactive")
+	state_unsupported = _("State unsupported")
+	tax_id_invalid = _("Tax id invalid")
+	taxes_calculation_failed = _("Taxes calculation failed")
+	testmode_charges_only = _("Testmode charges only")
+	tls_version_unsupported = _("TLS version unsupported")
+	token_already_used = _("Token already used")
+	token_in_use = _("Token in use")
+	transfers_not_allowed = _("Transfers not allowed")
+	upstream_order_creation_failed = _("Upstream order creation failed")
+	url_invalid = _("URL invalid")
+
+	# deprecated
+	invalid_swipe_data = _("Invalid swipe data")
 
 
 class AccountType(Enum):
diff --git a/djstripe/migrations/0003_auto_20181117_2328.py b/djstripe/migrations/0003_auto_20181117_2328.py
--- a/djstripe/migrations/0003_auto_20181117_2328.py
+++ b/djstripe/migrations/0003_auto_20181117_2328.py
@@ -946,7 +946,7 @@ class Migration(migrations.Migration):
 				default="",
 				enum=djstripe.enums.ApiErrorCode,
 				help_text="Error code explaining reason for charge failure if available.",
-				max_length=20,
+				max_length=42,
 			),
 		),
 		migrations.AlterField(


Test patch: