Sha256: e829ba2cdc4f47581c178a967f22e8a99760459bd173dcd0f1aa250a14a186ef
Contents?: true
Size: 1.38 KB
Versions: 1
Compression:
Stored size: 1.38 KB
Contents
module Mundipagg class CreditCard < ActiveMerchant::Billing::CreditCard attr_accessor :installment_count def brand_name return "" if !brand.present? if brand == "master" "Mastercard" else brand.capitalize end end def payload(amount) content = { amount_in_cents: amount, credit_card_brand_enum: brand_name, credit_card_number: number, credit_card_operation_enum: "AuthAndCapture", exp_month: month, exp_year: year, holder_name: name, installment_count: installment_count || 1, security_code: verification_value, } if ::ActiveMerchant::Billing::Base.test? content.merge!(payment_method_code: 1) end { amount_in_cents: amount, currency_iso_enum: "BRL", credit_card_transaction_collection: { credit_card_transaction: content } } end class Response < Mundipagg::Response def payload body[:create_order_response][:create_order_result] end def error_item { description: payload[:credit_card_transaction_result_collection][:credit_card_transaction_result][:acquirer_message].split("|").last, error_code: payload[:credit_card_transaction_result_collection][:credit_card_transaction_result][:acquirer_return_code] } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
better-mundipagg-0.1.3 | lib/mundipagg/credit_card.rb |