Я выполнил http://activemerchant.org/ и https://www.rubydoc.info/github/activemerchant/active_merchant/ .. Но я получаю эту
ошибку: Поле было длиннее или короче, чем позволяет сервер .
Не могли бы вы, пожалуйста, помогите
params
{"first_name"=>"yadu",
"last_name"=>"dev",
"card_type"=>"visa",
"card_number"=>"4263982640269299",
"card_verification"=>"837",
"card_expires_on(1i)"=>"2023",
"card_expires_on(2i)"=>"5",
"card_expires_on(3i)"=>"1"}```
Метод контроллера
def credit_card
credit_card ||= ActiveMerchant::Billing::CreditCard.new(
first_name: activemerchants_params[:first_name],
last_name: activemerchants_params[:last_name],
month: activemerchants_params['card_expires_on(2i)'],
year: activemerchants_params['card_expires_on(1i)'],
# brand: activemerchants_params[:card_type],
number: activemerchants_params[:card_number],
verification_value: activemerchants_params[:card_verification]
)
amount = cart_order.total_amount
if credit_card.valid?
# Create a gateway object to the TrustCommerce service
gateway = ActiveMerchant::Billing::TrustCommerceGateway.new(
:login => 'login',
:password => 'password'
)
# Authorize for $10 dollars (1000 cents)
response = gateway.authorize(amount, credit_card)
p response
if response.success?
# Capture the money
gateway.capture(1000, response.authorization)
else
raise StandardError, response.message
end
end
render :new_credit_card
end