Value inside translation yml file - ruby-on-rails

I need return a value inside the translation text in my Rails App. What i have now is something like this:
hint: 'Tú código de acceso es #{#customer.passcode}. Este código es de un solo uso.'

Assuming that you are using I18n standards you can do the following:
In the view:
<%= t('.hint', passcode: #customer.passcode) %>
In local.yml file:
hint: 'Tú código de acceso es %{passcode}. Este código es de un solo uso.'

The interpolation syntax you are using doesn't work in en.yml, change it to
hint: 'Tú código de acceso es %{passcode}. Este código es de un solo uso.'
And now you can use it as:
= I18n.t(:hint, passcode: #customer.passcode)
# OR
= t(:hint, passcode: #customer.passcode)

Related

How to render images from Markdown files with Rails 5.2?

I based my applications inline help on Markdown files, implemented with Redcarpet gem. Contextual help is displayed as expected, but embedded images are not.
The help files structure in the project is:
public/help/administration/Connection
- Business_resources_hierarchy.png
- connections-fr.md
The connection-fr.md files contains:
# CONNECTIONS
Décrit la gestion des connexions aux ressources de l'infrastructure informatique.
## Principe de fonctionnement
La connaissance des ressources techniques comporte un certain niveau de complexité :
* adresses IP et protocoles des services
* login et mot de passe des utilisateurs techniques
* droits d'utilisation de la ressource
* multipliés par le nombre d'environnements déployés dans l'organisation (Dev, Test, Prod ...)
La gestion des connexions permet au métier de s'affranchir de cette complexité en offrant une vue métier des ressources nécessaires à la production statistique au travers d'une hiérarchie :
![Hiérarchie des resources métiers](Business_resources_hierarchy.png)
## Eléments d'infrastructure
1. Les ressources métiers - offrent une vue fonctionnelle des
Markdown is supported by the application_helper.rb:
module ApplicationHelper
### Implementing Help files management with Markdown
def markdown
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true, tables: true)
end
def displayHelp
puts "Help requested for: #{params[:page_name]}.#{params[:format]}"
# Parse the request from the page -> namespace/class/controller
if params[:page_name].index('/')
domain = params[:page_name].split('/')[0]
page = params[:page_name].split('/')[1]
else
domain = ''
page = params[:page_name]
end
method = params[:format] # The method from the controller is not used yet
# Build the help file path and name using the current locale
case page
when 'Change_Log' # Does it still exist?
filename = File.join(Rails.root, 'public', "CHANGELOG.md")
when 'Release_notes' # Does it still exist?
filename = File.join(Rails.root, 'public', "Release_notes.md")
else
filename = File.join(Rails.root,
'public',
'help',
domain,
page.classify,
"#{page}-#{I18n.locale.to_s[0,2]}.md"
)
end
puts "Requested help file: #{filename}"
if not File.file?(filename)
filename = File.join(Rails.root, 'public', 'help', "help-index-#{I18n.locale.to_s[0,2]}.md")
end
begin
file = File.open(filename, "rb")
markdown.render(file.read).html_safe.force_encoding('UTF-8')
rescue Errno::ENOENT
render :file => "public/404.html", :status => 404
end
end
end
I tried a few ways to define the path to the image file, but it does not show up. When submitting the file URL to Rails, it raises the following error:
No route matches [GET] "/Business_resources_hierarchy.PNG"
How to define the path to the file, or configure the helper so that the image is displayed?

i18n dont find the translation

I18n cant find the translation even if the translation is present in my YML,
translation missing: fr.activerecord.errors.models.user.attributes.email.not_found
errors:
messages:
already_confirmed: a déjà été confirmé(e)
confirmation_period_expired: doit être confirmé(e) en %{period}, veuillez en demander un(e) autre
expired: est expiré, veuillez en demander un autre
not_found: n’a pas été trouvé(e)
not_locked: n’était pas verrouillé(e)
not_saved:
one: 'une erreur a empêché ce (cet ou cette) %{resource} d’être enregistré(e) :'
other: "%{count} erreurs ont empêché ce (cet ou cette) %{resource} d’être enregistré(e) :"
It must follows correctly the "pattern", the locale is the root, in this case fr:
fr:
activerecord:
errors:
models:
user:
attributes:
email:
not_found: Email not found

How to edit error messages in devise

I need to modify the error messages of devise. I want to change the message "is Invalid" to "Es inválido" . The problem is that I have to go to change these messages in the gem. Can I overwrite these messages in the model User
Rails console
1.9.3-p547 :014 > user.save
=> false
1.9.3-p547 :015 > user.errors
=> {:email=>["is invalid"], :password=>["is too short (minimum is 6 characters)"]}
1.9.3-p547 :016 >
User model
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
end
Devise Generates a devise.en.yml file in config/locales/
If you need your error messages to be in another language such as Spanish, replace your devise.en.yml with this file:
devise.es.yml
es:
errors:
messages:
expired: "ha expirado, por favor pide una nueva"
not_found: "no encontrado"
already_confirmed: "ya fue confirmada. Intenta ingresar."
not_locked: "no ha sido bloqueada"
not_saved:
one: "Ha habido 1 error:"
other: "Han habido %{count} errores:"
devise:
failure:
already_authenticated: 'Ya iniciaste sesión.'
unauthenticated: 'Tienes que registrarte o iniciar sesión antes de continuar.'
unconfirmed: 'Tienes que confirmar tu cuenta antes de continuar.'
locked: 'Tu cuente está bloqueada.'
invalid: 'Email o contraseña inválidos.'
invalid_token: 'Token de autentificación inválido.'
timeout: 'Tu sesión ha expirado. Inicia sesión nuevamente.'
inactive: 'Tu cuenta aun no ha sido activada.'
sessions:
signed_in: 'Iniciaste sesión correctamente.'
signed_out: 'Cerraste sesión correctamente.'
passwords:
send_instructions: 'Recibirás un email con instrucciones para reiniciar tu contraseña en unos minutos.'
updated: 'Tu contraseña fue cambiada correctamente. Has iniciado sesión.'
updated_not_active: 'Tu contraseña fue cambiada correctamente.'
send_paranoid_instructions: "Si tu email existe en el sistema, recibirás instrucciones para recuperar tu contraseña en él"
confirmations:
send_instructions: 'Recibirás instrucciones para confirmar tu cuenta en tu email en unos minutos.'
send_paranoid_instructions: 'Si tu email existe en el sistema, recibirás instrucciones para confirmar tu cuenta en tu email en unos minutos.'
confirmed: 'Tu cuenta fue confirmada. Has iniciado sesión.'
registrations:
signed_up: 'Bienvenido! Te has registrado correctamente.'
signed_up_but_unconfirmed: 'Te hemos enviado un email con instrucciones para que confirmes tu cuenta.'
signed_up_but_inactive: 'Te has registrado correctamente, pero tu cuenta aun no ha sido activada.'
signed_up_but_locked: 'Te has registrado correctamente, pero tu cuenta está bloqueada.'
updated: 'Actualizaste tu cuenta correctamente.'
update_needs_confirmation: "Actualizaste tu cuenta correctamente, pero tenemos que revalidar tu email. Revisa tu correo para confirmar la dirección."
destroyed: 'Adiós, tu cuenta ha sido eliminada. Esperamos verte de vuelta pronto!'
unlocks:
send_instructions: 'Recibirás un email con instrucciones para desbloquear tu cuenta en unos minutos'
unlocked: 'Tu cuenta ha sido desbloqueada. Inicia sesión para continuar.'
send_paranoid_instructions: 'Si tu cuenta existe, recibirás instrucciones para desbloquear tu cuenta en unos minutos'
omniauth_callbacks:
success: 'Te autentificaste correctamente con tu cuenta de %{kind}.'
failure: 'No pudimos autentificar tu cuenta de %{kind} por la siguiente razón: %{reason}.'
mailer:
confirmation_instructions:
subject: 'Instrucciones de confirmación'
reset_password_instructions:
subject: 'Instrucciones de cambio de contraseña'
unlock_instructions:
subject: 'Instrucciones de desbloqueo'
UPDATE
es:
activerecord:
errors:
models:
user:
attributes:
email:
blank: "El email no puede estar vacio"
This isn't Devise-specific. You can localize any of your ActiveRecord error messages in your config/locales/*.yml files.
In this case, you could, in config/local/es.yml, add something like the following:
es:
activerecord:
errors
models
user
attributes:
email:
invalid: "Es inválido"
Rails' localization is extremely configurable. There is a lot more information in the guides.
You can do the devise specific translations using the
devise.es.yml in your config/locales folder
List of all the different translations is given here in official devise wiki

Non-English texts in Stripe possible?

Successfully integrating Stripe into my online shop, I completely failed to get information on whether/how to configure Stripe to return error messages in German instead of English.
So my question is:
Is there a way to have localized error messages when using the client-side API "https://js.stripe.com/v2"?
Update 2014-05-03
I've asked the same question on Twitter and one of their staff (I guess) told me that this is currently not possible and on their TODO list.
For further reference:
While you can't use human messages on stripe errors to be displayed directly on localized pages, you can take advantage of response.error.code to provide your own translations.
var errorMessages = {
incorrect_number: "The card number is incorrect.",
invalid_number: "The card number is not a valid credit card number.",
invalid_expiry_month: "The card's expiration month is invalid.",
invalid_expiry_year: "The card's expiration year is invalid.",
invalid_cvc: "The card's security code is invalid.",
expired_card: "The card has expired.",
incorrect_cvc: "The card's security code is incorrect.",
incorrect_zip: "The card's zip code failed validation.",
card_declined: "The card was declined.",
missing: "There is no card on a customer that is being charged.",
processing_error: "An error occurred while processing the card.",
rate_limit: "An error occurred due to requests hitting the API too quickly. Please let us know if you're consistently running into this error."
};
function stripeHandler( status, response ){
if ( response.error && response.error.type == 'card_error' ){
$( '.errors' ).text( errorMessages[ response.error.code ] );
}
else {
// do other stuff (and handle api/request errors)
}
}
The list of codes is documented here (currently, right column, in the "codes" section).
NOTE
The text is not production ready. It's just the developer text.
Some errors shouldn't be showed to the user. If I have some better texts I will re edit this. If someone has the time to do so, feel free to edit.
If you would like to provide their english text:
Stripe V3:
online payment error codes
https://stripe.com/docs/error-codes
export const online_payment_error_codes = {
account_already_exists: "The email address provided for the creation of a deferred account already has an account associated with it. Use the OAuth flow to connect the existing account to your platform.",
account_country_invalid_address: "The country of the business address provided does not match the country of the account. Businesses must be located in the same country as the account.",
account_invalid: "The account ID provided as a value for the Stripe-Account header is invalid. Check that your requests are specifying a valid account ID.",
account_number_invalid: "The bank account number provided is invalid (e.g., missing digits). Bank account information varies from country to country. We recommend creating validations in your entry forms based on the bank account formats we provide.",
alipay_upgrade_required: "This method for creating Alipay payments is not supported anymore. Please upgrade your integration to use Sources instead.",
amount_too_large: "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again.",
amount_too_small: "The specified amount is less than the minimum amount allowed. Use a higher amount and try again.",
api_key_expired: "The API key provided has expired. Obtain your current API keys from the Dashboard and update your integration to use them.",
balance_insufficient: "The transfer or payout could not be completed because the associated account does not have a sufficient balance available. Create a new transfer or payout using an amount less than or equal to the account’s available balance.",
bank_account_exists: "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again.",
bank_account_unusable: "The bank account provided cannot be used for payouts. A different bank account must be used.",
bank_account_unverified: "Your Connect platform is attempting to share an unverified bank account with a connected account.",
bitcoin_upgrade_required: "This method for creating Bitcoin payments is not supported anymore. Please upgrade your integration to use Sources instead.",
card_declined: "The card has been declined. When a card is declined, the error returned also includes the decline_code attribute with the reason why the card was declined. Refer to our decline codes documentation to learn more.",
charge_already_captured: "The charge you’re attempting to capture has already been captured. Update the request with an uncaptured charge ID.",
charge_already_refunded: "The charge you’re attempting to refund has already been refunded. Update the request to use the ID of a charge that has not been refunded.",
charge_disputed: "The charge you’re attempting to refund has been charged back. Check the disputes documentation to learn how to respond to the dispute.",
charge_exceeds_source_limit: "This charge would cause you to exceed your rolling-window processing limit for this source type. Please retry the charge later, or contact us to request a higher processing limit.",
charge_expired_for_capture: "The charge cannot be captured as the authorization has expired. Auth and capture charges must be captured within seven days.",
country_unsupported: "Your platform attempted to create a custom account in a country that is not yet supported. Make sure that users can only sign up in countries supported by custom accounts.",
coupon_expired: "The coupon provided for a subscription or order has expired. Either create a new coupon, or use an existing one that is valid.",
customer_max_subscriptions: "The maximum number of subscriptions for a customer has been reached. Contact us if you are receiving this error.",
email_invalid: "The email address is invalid (e.g., not properly formatted). Check that the email address is properly formatted and only includes allowed characters.",
expired_card: "The card has expired. Check the expiration date or use a different card.",
idempotency_key_in_use: "The idempotency key provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously.",
incorrect_address: "The card’s address is incorrect. Check the card’s address or use a different card.",
incorrect_cvc: "The card’s security code is incorrect. Check the card’s security code or use a different card.",
incorrect_number: "The card number is incorrect. Check the card’s number or use a different card.",
incorrect_zip: "The card’s postal code is incorrect. Check the card’s postal code or use a different card.",
instant_payouts_unsupported: "The debit card provided as an external account does not support instant payouts. Provide another debit card or use a bank account instead.",
invalid_card_type: "The card provided as an external account is not a debit card. Provide a debit card or use a bank account instead.",
invalid_charge_amount: "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount.",
invalid_cvc: "The card’s security code is invalid. Check the card’s security code or use a different card.",
invalid_expiry_month: "The card’s expiration month is incorrect. Check the expiration date or use a different card.",
invalid_expiry_year: "The card’s expiration year is incorrect. Check the expiration date or use a different card.",
invalid_number: "The card number is invalid. Check the card details or use a different card.",
invalid_source_usage: "The source cannot be used because it is not in the correct state (e.g., a charge request is trying to use a source with a pending, failed, or consumed source). Check the status of the source you are attempting to use.",
invoice_no_customer_line_items: "An invoice cannot be generated for the specified customer as there are no pending invoice items. Check that the correct customer is being specified or create any necessary invoice items first.",
invoice_no_subscription_line_items: "An invoice cannot be generated for the specified subscription as there are no pending invoice items. Check that the correct subscription is being specified or create any necessary invoice items first.",
invoice_not_editable: "The specified invoice can no longer be edited. Instead, consider creating additional invoice items that will be applied to the next invoice. You can either manually generate the next invoice or wait for it to be automatically generated at the end of the billing cycle.",
invoice_upcoming_none: "There is no upcoming invoice on the specified customer to preview. Only customers with active subscriptions or pending invoice items have invoices that can be previewed.",
livemode_mismatch: "Test and live mode API keys, requests, and objects are only available within the mode they are in.",
missing: "Both a customer and source ID have been provided, but the source has not been saved to the customer. To create a charge for a customer with a specified source, you must first save the card details.",
not_allowed_on_standard_account: "Transfers and payouts on behalf of a Standard connected account are not allowed.",
order_creation_failed: "The order could not be created. Check the order details and then try again.",
order_required_settings: "The order could not be processed as it is missing required information. Check the information provided and try again.",
order_status_invalid: "The order cannot be updated because the status provided is either invalid or does not follow the order lifecycle (e.g., an order cannot transition from created to fulfilled without first transitioning to paid).",
order_upstream_timeout: "The request timed out. Try again later.",
out_of_inventory: "The SKU is out of stock. If more stock is available, update the SKU’s inventory quantity and try again.",
parameter_invalid_empty: "One or more required values were not provided. Make sure requests include all required parameters.",
parameter_invalid_integer: "One or more of the parameters requires an integer, but the values provided were a different type. Make sure that only supported values are provided for each attribute. Refer to our API documentation to look up the type of data each attribute supports.",
parameter_invalid_string_blank: "One or more values provided only included whitespace. Check the values in your request and update any that contain only whitespace.",
parameter_invalid_string_empty: "One or more required string values is empty. Make sure that string values contain at least one character.",
parameter_missing: "One or more required values are missing. Check our API documentation to see which values are required to create or modify the specified resource.",
parameter_unknown: "The request contains one or more unexpected parameters. Remove these and try again.",
parameters_exclusive: "Two or more mutually exclusive parameters were provided. Check our API documentation or the returned error message to see which values are permitted when creating or modifying the specified resource.",
payment_intent_authentication_failure: "The provided source has failed authentication. Provide source_data or a new source to attempt to fulfill this PaymentIntent again.",
payment_intent_incompatible_payment_method: "The PaymentIntent expected a payment method with different properties than what was provided.",
payment_intent_invalid_parameter: "One or more provided parameters was not allowed for the given operation on the PaymentIntent. Check our API reference or the returned error message to see which values were not correct for that PaymentIntent.",
payment_intent_payment_attempt_failed: "The latest payment attempt for the PaymentIntent has failed. Check the last_payment_error property on the PaymentIntent for more details, and provide source_data or a new source to attempt to fulfill this PaymentIntent again.",
payment_intent_unexpected_state: "The PaymentIntent’s state was incompatible with the operation you were trying to perform.",
payment_method_unactivated: "The charge cannot be created as the payment method used has not been activated. Activate the payment method in the Dashboard, then try again.",
payment_method_unexpected_state: "The provided payment method’s state was incompatible with the operation you were trying to perform. Confirm that the payment method is in an allowed state for the given operation before attempting to perform it.",
payouts_not_allowed: "Payouts have been disabled on the connected account. Check the connected account’s status to see if any additional information needs to be provided, or if payouts have been disabled for another reason.",
platform_api_key_expired: "The API key provided by your Connect platform has expired. This occurs if your platform has either generated a new key or the connected account has been disconnected from the platform. Obtain your current API keys from the Dashboard and update your integration, or reach out to the user and reconnect the account.",
postal_code_invalid: "The postal code provided was incorrect.",
processing_error: "An error occurred while processing the card. Check the card details are correct or use a different card.",
product_inactive: "The product this SKU belongs to is no longer available for purchase.",
rate_limit: "Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.",
resource_already_exists: "A resource with a user-specified ID (e.g., plan or coupon) already exists. Use a different, unique value for id and try again.",
resource_missing: "The ID provided is not valid. Either the resource does not exist, or an ID for a different resource has been provided.",
routing_number_invalid: "The bank routing number provided is invalid.",
secret_key_required: "The API key provided is a publishable key, but a secret key is required. Obtain your current API keys from the Dashboard and update your integration to use them.",
sepa_unsupported_account: "Your account does not support SEPA payments.",
shipping_calculation_failed: "Shipping calculation failed as the information provided was either incorrect or could not be verified.",
sku_inactive: "The SKU is inactive and no longer available for purchase. Use a different SKU, or make the current SKU active again.",
state_unsupported: "Occurs when providing the legal_entity information for a U.S. custom account, if the provided state is not supported. (This is mostly associated states and territories.)",
tax_id_invalid: "The tax ID number provided is invalid (e.g., missing digits). Tax ID information varies from country to country, but must be at least nine digits.",
taxes_calculation_failed: "Tax calculation for the order failed.",
testmode_charges_only: "Your account has not been activated and can only make test charges. Activate your account in the Dashboard to begin processing live charges.",
tls_version_unsupported: "Your integration is using an older version of TLS that is unsupported. You must be using TLS 1.2 or above.",
token_already_used: "The token provided has already been used. You must create a new token before you can retry this request.",
token_in_use: "The token provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously.",
transfers_not_allowed: "The requested transfer cannot be created. Contact us if you are receiving this error.",
upstream_order_creation_failed: "The order could not be created. Check the order details and then try again.",
url_invalid: "The URL provided is invalid."
};
declined error codes
https://stripe.com/docs/declines/codes
export const online_payment_declined_codes = {
approve_with_id: {
"description": "The payment cannot be authorized.",
"next_steps": "The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."
},
call_issuer: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer needs to contact their card issuer for more information."
},
card_not_supported: {
"description": "The card does not support this type of purchase.",
"next_steps": "The customer needs to contact their card issuer to make sure their card can be used to make this type of purchase."
},
card_velocity_exceeded: {
"description": "The customer has exceeded the balance or credit limit available on their card.",
"next_steps": "The customer should contact their card issuer for more information."
},
currency_not_supported: {
"description": "The card does not support the specified currency.",
"next_steps": "The customer needs to check with the issuer whether the card can be used for the type of currency specified."
},
do_not_honor: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer needs to contact their card issuer for more information."
},
do_not_try_again: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer should contact their card issuer for more information."
},
duplicate_transaction: {
"description": "A transaction with identical amount and credit card information was submitted very recently.",
"next_steps": "Check to see if a recent payment already exists."
},
expired_card: {
"description": "The card has expired.",
"next_steps": "The customer should use another card."
},
fraudulent: {
"description": "The payment has been declined as Stripe suspects it is fraudulent.",
"next_steps": "Do not report more detailed information to your customer. Instead, present as you would the generic_decline described below."
},
generic_decline: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer needs to contact their card issuer for more information."
},
incorrect_number: {
"description": "The card number is incorrect.",
"next_steps": "The customer should try again using the correct card number."
},
incorrect_cvc: {
"description": "The CVC number is incorrect.",
"next_steps": "The customer should try again using the correct CVC."
},
incorrect_pin: {
"description": "The PIN entered is incorrect. This decline code only applies to payments made with a card reader. ",
"next_steps": "The customer should try again using the correct PIN."
},
incorrect_zip: {
"description": "The ZIP/postal code is incorrect.",
"next_steps": "The customer should try again using the correct billing ZIP/postal code."
},
insufficient_funds: {
"description": "The card has insufficient funds to complete the purchase.",
"next_steps": "The customer should use an alternative payment method."
},
invalid_account: {
"description": "The card, or account the card is connected to, is invalid.",
"next_steps": "The customer needs to contact their card issuer to check that the card is working correctly."
},
invalid_amount: {
"description": "The payment amount is invalid, or exceeds the amount that is allowed.",
"next_steps": "If the amount appears to be correct, the customer needs to check with their card issuer that they can make purchases of that amount."
},
invalid_cvc: {
"description": "The CVC number is incorrect.",
"next_steps": "The customer should try again using the correct CVC."
},
invalid_expiry_year: {
"description": "The expiration year invalid.",
"next_steps": "The customer should try again using the correct expiration date."
},
invalid_number: {
"description": "The card number is incorrect.",
"next_steps": "The customer should try again using the correct card number."
},
invalid_pin: {
"description": "The PIN entered is incorrect. This decline code only applies to payments made with a card reader.",
"next_steps": "The customer should try again using the correct PIN."
},
issuer_not_available: {
"description": "The card issuer could not be reached, so the payment could not be authorized.",
"next_steps": "The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."
},
lost_card: {
"description": "The payment has been declined because the card is reported lost.",
"next_steps": "The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline."
},
merchant_blacklist: {
"description": "The payment has been declined because it matches a value on the Stripe user's blocklist.",
"next_steps": "Do not report more detailed information to your customer. Instead, present as you would the generic_decline described above."
},
new_account_information_available: {
"description": "The card, or account the card is connected to, is invalid.",
"next_steps": "The customer needs to contact their card issuer for more information."
},
no_action_taken: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer should contact their card issuer for more information."
},
not_permitted: {
"description": "The payment is not permitted.",
"next_steps": "The customer needs to contact their card issuer for more information."
},
pickup_card: {
"description": "The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",
"next_steps": "The customer needs to contact their card issuer for more information."
},
pin_try_exceeded: {
"description": "The allowable number of PIN tries has been exceeded.",
"next_steps": "The customer must use another card or method of payment."
},
processing_error: {
"description": "An error occurred while processing the card.",
"next_steps": "The payment should be attempted again. If it still cannot be processed, try again later."
},
reenter_transaction: {
"description": "The payment could not be processed by the issuer for an unknown reason.",
"next_steps": "The payment should be attempted again. If it still cannot be processed, the customer needs to contact their card issuer."
},
restricted_card: {
"description": "The card cannot be used to make this payment (it is possible it has been reported lost or stolen).",
"next_steps": "The customer needs to contact their card issuer for more information."
},
revocation_of_all_authorizations: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer should contact their card issuer for more information."
},
revocation_of_authorization: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer should contact their card issuer for more information."
},
security_violation: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer needs to contact their card issuer for more information."
},
service_not_allowed: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer should contact their card issuer for more information."
},
stolen_card: {
"description": "The payment has been declined because the card is reported stolen.",
"next_steps": "The specific reason for the decline should not be reported to the customer. Instead, it needs to be presented as a generic decline."
},
stop_payment_order: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer should contact their card issuer for more information."
},
testmode_decline: {
"description": "A Stripe test card number was used.",
"next_steps": "A genuine card must be used to make a payment."
},
transaction_not_allowed: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "The customer needs to contact their card issuer for more information."
},
try_again_later: {
"description": "The card has been declined for an unknown reason.",
"next_steps": "Ask the customer to attempt the payment again. If subsequent payments are declined, the customer should contact their card issuer for more information."
},
withdrawal_count_limit_exceeded: {
"description": "The customer has exceeded the balance or credit limit available on their card. ",
"next_steps": "The customer should use an alternative payment method."
}
};
Stripe error message in french
var online_payment_error_codes = {account_already_exists: "L'adresse e-mail fournie pour la création d'un compte différé est déjà associée à un compte. Utilisez le flux OAuth pour connecter le compte existant à votre plateforme.",
account_country_invalid_address: " Le pays de l'adresse professionnelle fournie ne correspond pas au pays du compte. Les entreprises doivent être situées dans le même pays que le compte.",
account_invalid: " L'ID de compte fourni comme valeur pour l'en-tête Stripe-Account n'est pas valide. Vérifiez que vos demandes spécifient un identifiant de compte valide.",
account_number_invalid: " Le numéro de compte bancaire fourni n'est pas valide (par exemple, des chiffres manquants). Les informations de compte bancaire varient d'un pays à l'autre. Nous vous recommandons de créer des validations dans vos formulaires de saisie en fonction des formats de compte bancaire que nous fournissons.",
alipay_upgrade_required: " Cette méthode de création de paiements Alipay n'est plus prise en charge. Veuillez mettre à niveau votre intégration pour utiliser des sources à la place.",
amount_too_large: " Le montant spécifié est supérieur au montant maximum autorisé. Utilisez une quantité inférieure et réessayez.",
amount_too_small: " Le montant spécifié est inférieur au montant minimum autorisé. Utilisez une quantité plus élevée et réessayez.",
api_key_expired: " La clé API fournie a expiré. Obtenez vos clés API actuelles à partir du tableau de bord et mettez à jour votre intégration pour les utiliser.",
balance_insufficient: " Le transfert ou le paiement n'a pas pu être effectué car le compte associé ne dispose pas d'un solde disponible suffisant. Créez un nouveau virement ou paiement en utilisant un montant inférieur ou égal au solde disponible du compte.",
bank_account_exists: " Le compte bancaire fourni existe déjà sur l'objet Client spécifié. Si le compte bancaire doit également être associé à un autre client, indiquez le bon numéro de client lors de la nouvelle demande.",
bank_account_unusable: " Le compte bancaire fourni ne peut pas être utilisé pour les paiements. Un autre compte bancaire doit être utilisé.",
bank_account_unverified: " Votre plateforme Connect tente de partager un compte bancaire non vérifié avec un compte connecté.",
bitcoin_upgrade_required: " Cette méthode de création de paiements Bitcoin n'est plus prise en charge. Veuillez mettre à niveau votre intégration pour utiliser des sources à la place.",
card_declined: " La carte a été refusée. Lorsqu'une carte est refusée, l'erreur renvoyée inclut également l'attribut déclin_code avec la raison pour laquelle la carte a été refusée. Consultez notre documentation sur les codes de refus pour en savoir plus.",
charge_already_captured: " La charge que vous essayez de capturer a déjà été capturée. Mettez à jour la demande avec un ID de facturation non capturé.",
charge_already_refunded: " Les frais que vous essayez de rembourser ont déjà été remboursés. Mettez à jour la demande d'utilisation de l'ID d'une charge qui n'a pas été remboursée.",
charge_disputed: " Les frais que vous essayez de rembourser ont été remboursés. Consultez la documentation relative aux litiges pour savoir comment réagir au litige.",
charge_exceeds_source_limit: " Ces frais vous amèneraient à dépasser votre limite de traitement de la fenêtre glissante pour ce type de source. Veuillez réessayer les frais plus tard ou contactez-nous pour demander une limite de traitement plus élevée.",
charge_expired_for_capture: " La charge ne peut pas être capturée car l'autorisation a expiré. Les frais d'authentification et de capture doivent être saisis dans les sept jours.",
country_unsupported: " Votre plate-forme a tenté de créer un compte personnalisé dans un pays qui n'est pas encore pris en charge. Assurez-vous que les utilisateurs ne peuvent s'inscrire que dans les pays pris en charge par des comptes personnalisés.",
coupon_expired: " Le coupon fourni pour un abonnement ou une commande a expiré. Créez un nouveau coupon ou utilisez-en un existant valide.",
customer_max_subscriptions: " Le nombre maximum d'abonnements pour un client a été atteint. Contactez-nous si vous recevez cette erreur.",
email_invalid: " L'adresse e-mail n'est pas valide (par exemple, n'est pas correctement formatée). Vérifiez que l'adresse e-mail est correctement formatée et ne comprend que les caractères autorisés.",
expired_card: " La carte a expiré. Vérifiez la date d'expiration ou utilisez une autre carte.",
idempotency_key_in_use: " La clé d'idempotence fournie est actuellement utilisée dans une autre demande. Cela se produit si votre intégration effectue des demandes en double simultanément.",
incorrect_address: " L’adresse de la carte est incorrecte. Vérifiez l’adresse de la carte ou utilisez une autre carte.",
incorrect_cvc: " Le code de sécurité de la carte est incorrect. Vérifiez le code de sécurité de la carte ou utilisez une autre carte.",
incorrect_number: " Le numéro de carte est incorrect. Vérifiez le numéro de la carte ou utilisez une autre carte.",
incorrect_zip: " Le code postal de la carte est incorrect. Vérifiez le code postal de la carte ou utilisez une autre carte.",
instant_payouts_unsupported: " La carte de débit fournie en tant que compte externe ne prend pas en charge les paiements instantanés. Fournissez une autre carte de débit ou utilisez un compte bancaire à la place.",
invalid_card_type: " La carte fournie en tant que compte externe n'est pas une carte de débit. Fournissez une carte de débit ou utilisez plutôt un compte bancaire.",
invalid_charge_amount: " Le montant spécifié n'est pas valide. Le montant des frais doit être un entier positif dans la plus petite unité monétaire et ne pas dépasser le montant minimum ou maximum.",
invalid_cvc: " Le code de sécurité de la carte n’est pas valide. Vérifiez le code de sécurité de la carte ou utilisez une autre carte.",
invalid_expiry_month: " Le mois d'expiration de la carte est incorrect. Vérifiez la date d'expiration ou utilisez une autre carte.",
invalid_expiry_year: " L’année d’expiration de la carte est incorrecte. Vérifiez la date d'expiration ou utilisez une autre carte.",
invalid_number: " Le numéro de carte n'est pas valide. Vérifiez les détails de la carte ou utilisez une autre carte.",
invalid_source_usage: " La source ne peut pas être utilisée car elle n'est pas dans l'état correct (par exemple, une demande de facturation tente d'utiliser une source avec une source en attente, en échec ou consommée). Vérifiez l'état de la source que vous essayez d'utiliser.",
invoice_no_customer_line_items: " Une facture ne peut pas être générée pour le client spécifié car il n'y a aucun poste de facture en attente. Vérifiez que le bon client est spécifié ou créez d'abord les éléments de facture nécessaires.",
invoice_no_subscription_line_items: " Une facture ne peut pas être générée pour l'abonnement spécifié car il n'y a aucun élément de facture en attente. Vérifiez que l'abonnement correct est spécifié ou créez d'abord les éléments de facture nécessaires.",
invoice_not_editable: " La facture spécifiée ne peut plus être modifiée. Au lieu de cela, envisagez de créer des éléments de facture supplémentaires qui seront appliqués à la prochaine facture. Vous pouvez soit générer manuellement la prochaine facture, soit attendre qu'elle soit générée automatiquement à la fin du cycle de facturation.",
invoice_upcoming_none: " Il n'y a pas de facture à venir sur le client spécifié à prévisualiser. Seuls les clients avec des abonnements actifs ou des éléments de facture en attente ont des factures qui peuvent être prévisualisées.",
livemode_mismatch: " Les clés d'API, les requêtes et les objets en mode test et en direct ne sont disponibles que dans le mode dans lequel ils se trouvent.",
missing: " Un client et un identifiant source ont été fournis, mais la source n'a pas été enregistrée pour le client. Pour créer des frais pour un client avec une source spécifiée, vous devez d'abord enregistrer les détails de la carte.",
not_allowed_on_standard_account: " Les transferts et paiements au nom d'un compte connecté Standard ne sont pas autorisés.",
order_creation_failed: " La commande n'a pas pu être créée. Vérifiez les détails de la commande, puis réessayez.",
order_required_settings: " La commande n'a pas pu être traitée car il manque les informations requises. Vérifiez les informations fournies et réessayez.",
order_status_invalid: " La commande ne peut pas être mise à jour car le statut fourni est soit invalide, soit ne suit pas le cycle de vie de la commande (par exemple, une commande ne peut pas passer de créée à exécutée sans passer d'abord à payée).",
order_upstream_timeout: " La demande a expiré. Réessayez plus tard.",
out_of_inventory: " Le SKU est en rupture de stock. Si plus de stock est disponible, mettez à jour la quantité d'inventaire du SKU et réessayez.",
parameter_invalid_empty: " Une ou plusieurs valeurs obligatoires n'ont pas été fournies. Assurez-vous que les demandes incluent tous les paramètres requis.",
parameter_invalid_integer: " Un ou plusieurs paramètres nécessitent un entier, mais les valeurs fournies étaient d'un type différent. Assurez-vous que seules les valeurs prises en charge sont fournies pour chaque attribut. Reportez-vous à notre documentation API pour rechercher le type de données pris en charge par chaque attribut.",
parameter_invalid_string_blank: " Une ou plusieurs valeurs fournies incluaient uniquement des espaces. Vérifiez les valeurs de votre demande et mettez à jour celles qui ne contiennent que des espaces.",
parameter_invalid_string_empty: " Une ou plusieurs valeurs de chaîne obligatoires sont vides. Assurez-vous que les valeurs de chaîne contiennent au moins un caractère.",
parameter_missing: " Une ou plusieurs valeurs obligatoires sont manquantes. Consultez notre documentation API pour voir quelles valeurs sont requises pour créer ou modifier la ressource spécifiée.",
parameter_unknown: " La demande contient un ou plusieurs paramètres inattendus. Supprimez-les et réessayez.",
parameters_exclusive: " Au moins deux paramètres mutuellement exclusifs ont été fournis. Consultez notre documentation API ou le message d'erreur renvoyé pour voir quelles valeurs sont autorisées lors de la création ou de la modification de la ressource spécifiée.",
payment_intent_authentication_failure: " L'authentification de la source fournie a échoué. Fournissez source_data ou une nouvelle source pour tenter de remplir à nouveau ce PaymentIntent.",
payment_intent_incompatible_payment_method: " PaymentIntent s'attendait à un mode de paiement avec des propriétés différentes de celles fournies.",
payment_intent_invalid_parameter: " Un ou plusieurs paramètres fournis n'étaient pas autorisés pour l'opération donnée sur PaymentIntent. Consultez notre référence API ou le message d'erreur renvoyé pour voir quelles valeurs n'étaient pas correctes pour ce PaymentIntent.",
payment_intent_payment_attempt_failed: " La dernière tentative de paiement pour PaymentIntent a échoué. Vérifiez la propriété last_payment_error sur le PaymentIntent pour plus de détails, et indiquez source_data ou une nouvelle source pour tenter à nouveau de remplir ce PaymentIntent.",
payment_intent_unexpected_state: " L'état de PaymentIntent était incompatible avec l'opération que vous tentiez d'effectuer.",
payment_method_unactivated: " Les frais ne peuvent pas être créés car le mode de paiement utilisé n'a pas été activé. Activez le mode de paiement dans le tableau de bord, puis réessayez.",
payment_method_unexpected_state: " L'état du mode de paiement fourni était incompatible avec l'opération que vous tentiez d'effectuer. Vérifiez que le mode de paiement est dans un état autorisé pour l'opération donnée avant de tenter de l'exécuter.",
payouts_not_allowed: " Les paiements ont été désactivés sur le compte connecté. Vérifiez l'état du compte connecté pour voir si des informations supplémentaires doivent être fournies ou si les paiements ont été désactivés pour une autre raison.",
platform_api_key_expired: " La clé API fournie par votre plateforme Connect a expiré. Cela se produit si votre plateforme a généré une nouvelle clé ou si le compte connecté a été déconnecté de la plateforme. Obtenez vos clés API actuelles à partir du tableau de bord et mettez à jour votre intégration, ou contactez l'utilisateur et reconnectez le compte.",
postal_code_invalid: " Le code postal fourni était incorrect.",
processing_error: " Une erreur s'est produite lors du traitement de la carte. Vérifiez que les détails de la carte sont corrects ou utilisez une autre carte.",
product_inactive: " Le produit auquel ce SKU appartient n'est plus disponible à l'achat.",
rate_limit: " Trop de demandes atteignent l'API trop rapidement. Nous recommandons un délai exponentiel de vos demandes.",
resource_already_exists: " Une ressource avec un ID spécifié par l'utilisateur (par exemple, plan ou coupon) existe déjà. Utilisez une valeur différente et unique pour id et réessayez.",
resource_missing: " L'identifiant fourni n'est pas valide. Soit la ressource n'existe pas, soit un ID pour une ressource différente a été fourni.",
routing_number_invalid: " Le numéro d'acheminement bancaire fourni n'est pas valide.",
secret_key_required: " La clé API fournie est une clé publiable, mais une clé secrète est requise. Obtenez vos clés API actuelles à partir du tableau de bord et mettez à jour votre intégration pour les utiliser.",
sepa_unsupported_account: " Votre compte ne prend pas en charge les paiements SEPA.",
shipping_calculation_failed: " Le calcul de l'expédition a échoué car les informations fournies étaient incorrectes ou n'ont pas pu être vérifiées.",
sku_inactive: " Le SKU est inactif et n'est plus disponible à l'achat. Utilisez un SKU différent ou réactivez le SKU actuel.",
state_unsupported: " Se produit lors de la fourniture des informations legal_entity pour un compte personnalisé américain, si l'état fourni n'est pas pris en charge. (Il s'agit principalement d'états et de territoires associés.)",
tax_id_invalid: " Le numéro d'identification fiscale fourni n'est pas valide (par exemple, des chiffres manquants). Les informations d'identification fiscale varient d'un pays à l'autre, mais doivent comporter au moins neuf chiffres.",
taxes_calculation_failed: " Le calcul de la taxe pour la commande a échoué.",
testmode_charges_only: " Votre compte n'a pas été activé et ne peut effectuer que des frais de test. Activez votre compte dans le tableau de bord pour commencer à traiter les frais réels.",
tls_version_unsupported: " Votre intégration utilise une ancienne version de TLS qui n'est pas prise en charge. Vous devez utiliser TLS 1.2 ou supérieur.",
token_already_used: " Le jeton fourni a déjà été utilisé. Vous devez créer un nouveau jeton avant de pouvoir réessayer cette demande.",
token_in_use: " Le jeton fourni est actuellement utilisé dans une autre demande. Cela se produit si votre intégration effectue des demandes en double simultanément.",
transfers_not_allowed: " Le transfert demandé ne peut pas être créé. Contactez-nous si vous recevez cette erreur.",
upstream_order_creation_failed: " La commande n'a pas pu être créée. Vérifiez les détails de la commande, puis réessayez.",
url_invalid: " L'URL fournie n'est pas valide." };
export default online_payment_error_codes;
If you are looking for French translation of declined errors:
export default {
authentication_required:
'La carte a été refusée car la transaction nécessite une authentification.',
approve_with_id: 'Le paiement ne peut être autorisé.',
call_issuer:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
card_not_supported: "La carte ne prend pas en charge ce type d'achat.",
card_velocity_exceeded:
'Le solde ou la limite de crédit disponible sur la carte a été dépassé.',
currency_not_supported:
'La carte ne prend pas en charge la devise spécifiée.',
do_not_honor:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
do_not_try_again:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
duplicate_transaction:
'Une transaction avec un montant et des informations de carte de crédit identiques a été soumise très récemment.',
expired_card:
"La carte est expirée. Vérifiez la date d'expiration ou utilisez une autre carte.",
fraudulent:
"Le paiement a été refusé car Stripe le soupçonne d'être frauduleux.",
generic_decline: 'La carte a été refusée pour une raison inconnue.',
incorrect_number:
'Le numéro de carte est incorrect. Vérifiez le numéro de la carte ou utilisez une autre carte.',
incorrect_cvc:
'Le code de sécurité de la carte est incorrect. Vérifiez le code de sécurité de la carte ou utilisez une autre carte.',
incorrect_zip:
'Le code postal de la carte est incorrect. Vérifiez le code postal de la carte ou utilisez une autre carte.',
insufficient_funds:
"La carte ne dispose pas de fonds suffisants pour finaliser l'achat.",
invalid_account:
"La carte ou le compte auquel la carte est connectée n'est pas valide.",
invalid_amount:
"Le montant du paiement n'est pas valide ou dépasse le montant autorisé.",
invalid_cvc:
'Le code de sécurité de la carte n’est pas valide. Vérifiez le code de sécurité de la carte ou utilisez une autre carte.',
invalid_expiry_month:
"Le mois d'expiration de la carte est incorrect. Vérifiez la date d'expiration ou utilisez une autre carte.",
invalid_expiry_year:
"L’année d’expiration de la carte est incorrecte. Vérifiez la date d'expiration ou utilisez une autre carte.",
invalid_number:
"Le numéro de carte n'est pas valide. Vérifiez les détails de la carte ou utilisez une autre carte.",
issuer_not_available:
"L'émetteur de la carte n'a pas pu être joint, le paiement n'a donc pas pu être autorisé.",
lost_card: 'Le paiement a été refusé car la carte est déclarée perdue.',
merchant_blacklist:
'Le paiement a été refusé, car la carte est bloquée par Stripe.',
new_account_information_available:
"La carte ou le compte auquel la carte est connectée n'est pas valide.",
no_action_taken:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
not_permitted: "Le paiement n'est pas autorisé.",
pickup_card:
"La carte ne peut pas être utilisée pour effectuer ce paiement (il est possible qu'elle ait été déclarée perdue ou volée).",
processing_error:
"Une erreur s'est produite lors du traitement de la carte. Vérifiez que les détails de la carte sont corrects ou utilisez une autre carte.",
reenter_transaction:
"Le paiement n'a pas pu être traité par l'émetteur pour une raison inconnue.",
restricted_card:
"La carte ne peut pas être utilisée pour effectuer ce paiement (il est possible qu'elle ait été déclarée perdue ou volée).",
revocation_of_all_authorizations:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
revocation_of_authorization:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
security_violation:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
service_not_allowed:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
stolen_card: 'Le paiement a été refusé car la carte est déclarée volée.',
stop_payment_order:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
testmode_decline: 'Un numéro de carte de test Stripe a été utilisé.',
transaction_not_allowed:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
try_again_later:
"La carte a été refusée pour une raison inconnue. Contactez votre banque pour plus d'information.",
withdrawal_count_limit_exceeded:
'Le solde ou la limite de crédit disponible sur la carte a été dépassé.'
}
Adaptation of errors messages for PHP.
Full here with French translation https://gist.github.com/Ladinstar/4655e57bd25099c553956280270b3c83
<?php
// English errors
$errors = [
"account_already_exists" => "The email address provided for the creation of a deferred account already has an account associated with it. Use the OAuth flow to connect the existing account to your platform.",
"account_country_invalid_address" => "The country of the business address provided does not match the country of the account. Businesses must be located in the same country as the account.",
"account_invalid" => "The account ID provided as a value for the Stripe-Account header is invalid. Check that your requests are specifying a valid account ID.",
"account_number_invalid" => "The bank account number provided is invalid (e.g., missing digits). Bank account information varies from country to country. We recommend creating validations in your entry forms based on the bank account formats we provide.",
"alipay_upgrade_required" => "This method for creating Alipay payments is not supported anymore. Please upgrade your integration to use Sources instead.",
"amount_too_large" => "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again.",
"amount_too_small" => "The specified amount is less than the minimum amount allowed. Use a higher amount and try again.",
"api_key_expired" => "The API key provided has expired. Obtain your current API keys from the Dashboard and update your integration to use them.",
"balance_insufficient" => "The transfer or payout could not be completed because the associated account does not have a sufficient balance available. Create a new transfer or payout using an amount less than or equal to the account’s available balance.",
"bank_account_exists" => "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again.",
"bank_account_unusable" => "The bank account provided cannot be used for payouts. A different bank account must be used.",
"bank_account_unverified" => "Your Connect platform is attempting to share an unverified bank account with a connected account.",
"bitcoin_upgrade_required" => "This method for creating Bitcoin payments is not supported anymore. Please upgrade your integration to use Sources instead.",
"card_declined" => "The card has been declined. When a card is declined, the error returned also includes the decline_code attribute with the reason why the card was declined. Refer to our decline codes documentation to learn more.",
"charge_already_captured" => "The charge you’re attempting to capture has already been captured. Update the request with an uncaptured charge ID.",
"charge_already_refunded" => "The charge you’re attempting to refund has already been refunded. Update the request to use the ID of a charge that has not been refunded.",
"charge_disputed" => "The charge you’re attempting to refund has been charged back. Check the disputes documentation to learn how to respond to the dispute.",
"charge_exceeds_source_limit" => "This charge would cause you to exceed your rolling-window processing limit for this source type. Please retry the charge later, or contact us to request a higher processing limit.",
"charge_expired_for_capture" => "The charge cannot be captured as the authorization has expired. Auth and capture charges must be captured within seven days.",
"country_unsupported" => "Your platform attempted to create a custom account in a country that is not yet supported. Make sure that users can only sign up in countries supported by custom accounts.",
"coupon_expired" => "The coupon provided for a subscription or order has expired. Either create a new coupon, or use an existing one that is valid.",
"customer_max_subscriptions" => "The maximum number of subscriptions for a customer has been reached. Contact us if you are receiving this error.",
"email_invalid" => "The email address is invalid (e.g., not properly formatted). Check that the email address is properly formatted and only includes allowed characters.",
"expired_card" => "The card has expired. Check the expiration date or use a different card.",
"idempotency_key_in_use" => "The idempotency key provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously.",
"incorrect_address" => "The card’s address is incorrect. Check the card’s address or use a different card.",
"incorrect_cvc" => "The card’s security code is incorrect. Check the card’s security code or use a different card.",
"incorrect_number" => "The card number is incorrect. Check the card’s number or use a different card.",
"incorrect_zip" => "The card’s postal code is incorrect. Check the card’s postal code or use a different card.",
"instant_payouts_unsupported" => "The debit card provided as an external account does not support instant payouts. Provide another debit card or use a bank account instead.",
"invalid_card_type" => "The card provided as an external account is not a debit card. Provide a debit card or use a bank account instead.",
"invalid_charge_amount" => "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount.",
"invalid_cvc" => "The card’s security code is invalid. Check the card’s security code or use a different card.",
"invalid_expiry_month" => "The card’s expiration month is incorrect. Check the expiration date or use a different card.",
"invalid_expiry_year" => "The card’s expiration year is incorrect. Check the expiration date or use a different card.",
"invalid_number" => "The card number is invalid. Check the card details or use a different card.",
"invalid_source_usage" => "The source cannot be used because it is not in the correct state (e.g., a charge request is trying to use a source with a pending, failed, or consumed source). Check the status of the source you are attempting to use.",
"invoice_no_customer_line_items" => "An invoice cannot be generated for the specified customer as there are no pending invoice items. Check that the correct customer is being specified or create any necessary invoice items first.",
"invoice_no_subscription_line_items" => "An invoice cannot be generated for the specified subscription as there are no pending invoice items. Check that the correct subscription is being specified or create any necessary invoice items first.",
"invoice_not_editable" => "The specified invoice can no longer be edited. Instead, consider creating additional invoice items that will be applied to the next invoice. You can either manually generate the next invoice or wait for it to be automatically generated at the end of the billing cycle.",
"invoice_upcoming_none" => "There is no upcoming invoice on the specified customer to preview. Only customers with active subscriptions or pending invoice items have invoices that can be previewed.",
"livemode_mismatch" => "Test and live mode API keys, requests, and objects are only available within the mode they are in.",
"missing" => "Both a customer and source ID have been provided, but the source has not been saved to the customer. To create a charge for a customer with a specified source, you must first save the card details.",
"not_allowed_on_standard_account" => "Transfers and payouts on behalf of a Standard connected account are not allowed.",
"order_creation_failed" => "The order could not be created. Check the order details and then try again.",
"order_required_settings" => "The order could not be processed as it is missing required information. Check the information provided and try again.",
"order_status_invalid" => "The order cannot be updated because the status provided is either invalid or does not follow the order lifecycle (e.g., an order cannot transition from created to fulfilled without first transitioning to paid).",
"order_upstream_timeout" => "The request timed out. Try again later.",
"out_of_inventory" => "The SKU is out of stock. If more stock is available, update the SKU’s inventory quantity and try again.",
"parameter_invalid_empty" => "One or more required values were not provided. Make sure requests include all required parameters.",
"parameter_invalid_integer" => "One or more of the parameters requires an integer, but the values provided were a different type. Make sure that only supported values are provided for each attribute. Refer to our API documentation to look up the type of data each attribute supports.",
"parameter_invalid_string_blank" => "One or more values provided only included whitespace. Check the values in your request and update any that contain only whitespace.",
"parameter_invalid_string_empty" => "One or more required string values is empty. Make sure that string values contain at least one character.",
"parameter_missing" => "One or more required values are missing. Check our API documentation to see which values are required to create or modify the specified resource.",
"parameter_unknown" => "The request contains one or more unexpected parameters. Remove these and try again.",
"parameters_exclusive" => "Two or more mutually exclusive parameters were provided. Check our API documentation or the returned error message to see which values are permitted when creating or modifying the specified resource.",
"payment_intent_authentication_failure" => "The provided source has failed authentication. Provide source_data or a new source to attempt to fulfill this PaymentIntent again.",
"payment_intent_incompatible_payment_method" => "The PaymentIntent expected a payment method with different properties than what was provided.",
"payment_intent_invalid_parameter" => "One or more provided parameters was not allowed for the given operation on the PaymentIntent. Check our API reference or the returned error message to see which values were not correct for that PaymentIntent.",
"payment_intent_payment_attempt_failed" => "The latest payment attempt for the PaymentIntent has failed. Check the last_payment_error property on the PaymentIntent for more details, and provide source_data or a new source to attempt to fulfill this PaymentIntent again.",
"payment_intent_unexpected_state" => "The PaymentIntent’s state was incompatible with the operation you were trying to perform.",
"payment_method_unactivated" => "The charge cannot be created as the payment method used has not been activated. Activate the payment method in the Dashboard, then try again.",
"payment_method_unexpected_state" => "The provided payment method’s state was incompatible with the operation you were trying to perform. Confirm that the payment method is in an allowed state for the given operation before attempting to perform it.",
"payouts_not_allowed" => "Payouts have been disabled on the connected account. Check the connected account’s status to see if any additional information needs to be provided, or if payouts have been disabled for another reason.",
"platform_api_key_expired" => "The API key provided by your Connect platform has expired. This occurs if your platform has either generated a new key or the connected account has been disconnected from the platform. Obtain your current API keys from the Dashboard and update your integration, or reach out to the user and reconnect the account.",
"postal_code_invalid" => "The postal code provided was incorrect.",
"processing_error" => "An error occurred while processing the card. Check the card details are correct or use a different card.",
"product_inactive" => "The product this SKU belongs to is no longer available for purchase.",
"rate_limit" => "Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.",
"resource_already_exists" => "A resource with a user-specified ID (e.g., plan or coupon) already exists. Use a different, unique value for id and try again.",
"resource_missing" => "The ID provided is not valid. Either the resource does not exist, or an ID for a different resource has been provided.",
"routing_number_invalid" => "The bank routing number provided is invalid.",
"secret_key_required" => "The API key provided is a publishable key, but a secret key is required. Obtain your current API keys from the Dashboard and update your integration to use them.",
"sepa_unsupported_account" => "Your account does not support SEPA payments.",
"shipping_calculation_failed" => "Shipping calculation failed as the information provided was either incorrect or could not be verified.",
"sku_inactive" => "The SKU is inactive and no longer available for purchase. Use a different SKU, or make the current SKU active again.",
"state_unsupported" => "Occurs when providing the legal_entity information for a U.S. custom account, if the provided state is not supported. (This is mostly associated states and territories.)",
"tax_id_invalid" => "The tax ID number provided is invalid (e.g., missing digits). Tax ID information varies from country to country, but must be at least nine digits.",
"taxes_calculation_failed" => "Tax calculation for the order failed.",
"testmode_charges_only" => "Your account has not been activated and can only make test charges. Activate your account in the Dashboard to begin processing live charges.",
"tls_version_unsupported" => "Your integration is using an older version of TLS that is unsupported. You must be using TLS 1.2 or above.",
"token_already_used" => "The token provided has already been used. You must create a new token before you can retry this request.",
"token_in_use" => "The token provided is currently being used in another request. This occurs if your integration is making duplicate requests simultaneously.",
"transfers_not_allowed" => "The requested transfer cannot be created. Contact us if you are receiving this error.",
"upstream_order_creation_failed" => "The order could not be created. Check the order details and then try again.",
"url_invalid" => "The URL provided is invalid.",
];
Stripe error codes in javascript in English and Spanish:
module.exports = {
en: {
authentication_required: 'The card was declined as the transaction requires authentication.',
approve_with_id: 'The payment cannot be authorized.',
call_issuer: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
card_not_supported: 'The card does not support this type of purchase. Please contact your card issuer for more information.',
card_velocity_exceeded: 'The customer has exceeded the balance or credit limit available on their card. Please contact your card issuer for more information.',
currency_not_supported: 'The card does not support the specified currency.',
do_not_honor: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
do_not_try_again: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
duplicate_transaction: 'A transaction with identical amount and credit card information was submitted very recently.',
expired_card: 'The card has expired.',
fraudulent: 'The payment has been declined as Stripe suspects it is fraudulent.',
generic_decline: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
incorrect_number: 'The card number is incorrect.',
incorrect_cvc: 'The CVC number is incorrect.',
incorrect_pin: 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',
incorrect_zip: 'The ZIP/postal code is incorrect.',
insufficient_funds: 'The card has insufficient funds to complete the purchase.',
invalid_account: 'The card, or account the card is connected to, is invalid.',
invalid_amount: 'The payment amount is invalid, or exceeds the amount that is allowed.',
invalid_cvc: 'The CVC number is incorrect.',
invalid_expiry_month: 'The expiration month is invalid.',
invalid_expiry_year: 'The expiration year is invalid.',
invalid_number: 'The card number is incorrect.',
invalid_pin: 'The PIN entered is incorrect. This decline code only applies to payments made with a card reader.',
issuer_not_available: 'The card issuer could not be reached, so the payment could not be authorized.',
lost_card: 'The payment has been declined because the card is reported lost.',
merchant_blacklist: 'The payment has been declined because it matches a value on the Stripe user’s block list.',
new_account_information_available: 'The card, or account the card is connected to, is invalid. Please contact your card issuer for more information.',
no_action_taken: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
not_permitted: 'The payment is not permitted. Please contact your card issuer for more information.',
offline_pin_required: 'The card has been declined as it requires a PIN.',
online_or_offline_pin_required: 'The card has been declined as it requires a PIN.',
pickup_card: 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen). Please contact your card issuer for more information.',
pin_try_exceeded: 'The allowable number of PIN tries has been exceeded.',
processing_error: 'An error occurred while processing the card.',
reenter_transaction: 'The payment could not be processed by the issuer for an unknown reason.',
restricted_card: 'The card cannot be used to make this payment (it is possible it has been reported lost or stolen). Please contact your card issuer for more information.',
revocation_of_all_authorizations: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
revocation_of_authorization: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
security_violation: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
service_not_allowed: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
stolen_card: 'The payment has been declined because the card is reported stolen.',
stop_payment_order: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
testmode_decline: 'A Stripe test card number was used.',
transaction_not_allowed: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
try_again_later: 'The card has been declined for an unknown reason. Please contact your card issuer for more information.',
withdrawal_count_limit_exceeded: 'The customer has exceeded the balance or credit limit available on their card.',
},
es: {
authentication_required: 'La tarjeta ha sido rechazada porque la transacción requiere autentificación.',
approve_with_id: 'El pago no se puede autorizar.',
call_issuer: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
card_not_supported: 'La tarjeta no soporta este tipo de compra.',
card_velocity_exceeded: 'El comprador ha excedido el balance o límite de crédito disponible en su tarjeta. Contacte con el emisor de la tarjeta para más información.',
currency_not_supported: 'La tarjeta no soporta la divisa especificada.',
do_not_honor: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
do_not_try_again: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
duplicate_transaction: 'Una transacción con importe y tarjeta idénticas fue procesada muy recientemente.',
expired_card: 'La tarjeta ha expirado.',
fraudulent: 'El pago ha sido rechazado ya que Stripe sospecha que es fraudulento.',
generic_decline: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
incorrect_number: 'El número de la tarjeta es incorrecto.',
incorrect_cvc: 'El numero CVC es incorrecto.',
incorrect_pin: 'El PIN introducido es incorrecto.',
incorrect_zip: 'El código postal es incorrecto.',
insufficient_funds: 'La tarjeta no tiene fondos suficientes para completar la compra.',
invalid_account: 'La tarjeta, o la cuenta a la que está asociada, es inválida.',
invalid_amount: 'El importe es inválido, o excede el permitido.',
invalid_cvc: 'El número CVC es incorrecto.',
invalid_expiry_month: 'El mes de caducidad es inválido.',
invalid_expiry_year: 'El año de caducidad es inválido.',
invalid_number: 'El número de tarjeta es incorrecto.',
invalid_pin: 'El PIN introducido es incorrecto.',
issuer_not_available: 'El emisor de la tarjeta no pudo ser contactado, por lo que el pago no ha podido ser autorizado.',
lost_card: 'El pago ha sido rechazado porque la tarjeta ha sido denunciada como perdida.',
merchant_blacklist: 'El pago ha sido rechazado porque coincide con un valor de la lista de bloqueo de Stripe.',
new_account_information_available: 'La tarjeta, o cuenta la que está asociada, es inválida. Contacte con el emisor de la tarjeta para más información.',
no_action_taken: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
not_permitted: 'El pago no está permitido. Contacte con el emisor de la tarjeta para más información.',
offline_pin_required: 'La tarjeta ha sido rechazada ya que requiere un PIN.',
online_or_offline_pin_required: 'La tarjeta ha sido rechazada ya que requiere un PIN.',
pickup_card: 'La tarjeta no se puede usar para realizar este pago (posiblemente haya sido denunciada como robada). Contacte con el emisor de la tarjeta para más información.',
pin_try_exceeded: 'Se ha excedido el número máximo de intentos de introducción del PIN.',
processing_error: 'Ocurrió un error al procesar la tarjeta.',
reenter_transaction: 'El pago no pudo ser procesado por el emisor por una razón desconocida.',
restricted_card: 'La tarjeta no se puede usar para realizar este pago (posiblemente haya sido denunciada como perdida o robada). Contacte con el emisor de la tarjeta para más información.',
revocation_of_all_authorizations: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
revocation_of_authorization: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
security_violation: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
service_not_allowed: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
stolen_card: 'El pago ha sido rechazado porque la tarjeta ha sido denunciada como robada.',
stop_payment_order: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
testmode_decline: 'Se ha usado una tarjeta de prueba de Stripe.',
transaction_not_allowed: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
try_again_later: 'La tarjeta ha sido rechazada por una razón desconocida. Contacte con el emisor de la tarjeta para más información.',
withdrawal_count_limit_exceeded: 'El comprador ha excedido el balance o límite de crédito disponible en su tarjeta.',
},
};
Currently, when initializing Stripe you can pass the locale parameter
I could give more details, but it would be too much, the documentation says it all:
A locale used to globally configure localization in Stripe. Setting the locale here will localize error strings for all Stripe.js methods. It will also configure the locale for Elements and Checkout. Default is auto (Stripe detects the locale of the browser). Note that Checkout supports a slightly different set of locales than Stripe.js.
https://stripe.com/docs/js/initializing#init_stripe_js-options-locale

Cucumber steps definitions in spanish: Ambiguous match of "..."

I'm trying to translate the steps definitions of cucumber to spanish but I'm getting this error:
Ambiguous match of "que estoy en la página "inicio de sesión""
features/step_definitions/web_steps.rb:3:in `/^que estoy en la página "([^"]*)"$/'
features/step_definitions/web_steps.rb:7:in `/^visito la pa|ágina "([^"]*)"$/'
Here's my web_steps.rb
# encoding: utf-8
Dado /^que estoy en la página "([^"]*)"$/ do |page|
visit(path_to page)
end
Cuando /^visito la página "([^"]*)"$/ do |page|
visit(path_to page)
end
How can that be ambiguos if I got the ^ and the $ in the regexp?
It looks like it's seeing a | in the latter step definition. Look closely at the second line of the error:
features/step_definitions/web_steps.rb:3:in `/^que estoy en la página "([^"]*)"$/'
features/step_definitions/web_steps.rb:7:in `/^visito la pa|ágina "([^"]*)"$/'
It's seeing /^visito la pa|ágina "([^"]*)"$/, which it interprets as an OR, i.e. /^visito la pa OR ágina "([^"]*)"$/. With that interpretation, the match does indeed become ambiguous.
Now why it is reading it that way is a mystery to me, perhaps some UTF-8 garbling?

Resources