Class: ActiveMerchant::Billing::CecabankJsonGateway
- Includes:
- CecabankCommon
- Defined in:
- lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb
Constant Summary collapse
- CECA_ACTIONS_DICTIONARY =
{ purchase: :REST_AUTORIZACION, authorize: :REST_PREAUTORIZACION, capture: :REST_COBRO_PREAUTORIZACION, refund: :REST_DEVOLUCION, void: :REST_ANULACION }.freeze
- CECA_REASON_TYPES =
{ installment: :I, recurring: :R, unscheduled: :C }.freeze
- CECA_INITIATOR =
{ merchant: :N, cardholder: :S }.freeze
- CECA_SCA_TYPES =
{ low_value_exemption: :LOW, transaction_risk_analysis_exemption: :TRA }.freeze
- WALLET_PAYMENT_METHODS =
{ apple_pay: 'A', google_pay: 'G' }
Constants included from CecabankCommon
CecabankCommon::CECA_CURRENCIES_DICTIONARY, CecabankCommon::CECA_ENCRIPTION
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(money, creditcard, options = {}) ⇒ Object
- #capture(money, identification, options = {}) ⇒ Object
- #purchase(money, creditcard, options = {}) ⇒ Object
- #refund(money, identification, options = {}) ⇒ Object
- #scrub(transcript) ⇒ Object
- #void(identification, options = {}) ⇒ Object
Methods included from CecabankCommon
included, #initialize, #supports_scrubbing?
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #initialize, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
#expdate, #format, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
40 41 42 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb', line 40 def (money, creditcard, = {}) handle_purchase(:authorize, money, creditcard, ) end |
#capture(money, identification, options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb', line 44 def capture(money, identification, = {}) , operation_number, _money = identification.split('#') post = {} [:operation_number] = operation_number add_auth_invoice_data(:capture, post, money, , ) commit('compra', post) end |
#purchase(money, creditcard, options = {}) ⇒ Object
54 55 56 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb', line 54 def purchase(money, creditcard, = {}) handle_purchase(:purchase, money, creditcard, ) end |
#refund(money, identification, options = {}) ⇒ Object
64 65 66 67 68 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb', line 64 def refund(money, identification, = {}) , operation_number, _money = identification.split('#') [:operation_number] = operation_number handle_cancellation(:refund, money, , ) end |
#scrub(transcript) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb', line 70 def scrub(transcript) return '' if transcript.blank? = transcript.gsub(%r(\\\")i, "'").scan(/{[^>]*}/).first.gsub("'", '"') request_data = JSON.parse() if @options[:encryption_key] params = parse(request_data['parametros']) sensitive_fields = decrypt_sensitive_fields(params['encryptedData']) filtered_params = filter_params(sensitive_fields) params['encryptedData'] = encrypt_sensitive_fields(filtered_params) else params = filter_params(decode_params(request_data['parametros'])) end request_data['parametros'] = encode_params(params) = .gsub(%r(\")i, '\\\"') = request_data.to_json.gsub(%r(\")i, '\\\"') transcript.sub(, ) end |
#void(identification, options = {}) ⇒ Object
58 59 60 61 62 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_json.rb', line 58 def void(identification, = {}) , operation_number, money = identification.split('#') [:operation_number] = operation_number handle_cancellation(:void, money.to_i, , ) end |