Class: ActiveMerchant::Billing::CecabankXmlGateway
- Includes:
- CecabankCommon
- Defined in:
- lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb
Constant Summary collapse
- CECA_NOTIFICATIONS_URL =
CECA’s MAGIC NUMBERS
'NONE'
- CECA_DECIMALS =
'2'
- CECA_MODE =
'SSL'
- CECA_UI_LESS_LANGUAGE =
'XML'
- CECA_UI_LESS_LANGUAGE_REFUND =
'1'
- CECA_UI_LESS_REFUND_PAGE =
'anulacion_xml'
- CECA_ACTION_REFUND =
use partial refund’s URL to avoid time frame limitations and decision logic on client side
'anulaciones/anularParcial'
- CECA_ACTION_PURCHASE =
'tpv/compra'
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
-
#purchase(money, creditcard, options = {}) ⇒ Object
Perform a purchase, which is essentially an authorization and capture in a single operation.
-
#refund(money, identification, options = {}) ⇒ Object
Refund a transaction.
- #scrub(transcript) ⇒ 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
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Instance Method Details
#purchase(money, creditcard, options = {}) ⇒ Object
Perform a purchase, which is essentially an authorization and capture in a single operation.
Parameters
-
money
– The amount to be purchased as an Integer value in cents. -
creditcard
– The CreditCard details for the transaction. -
options
– A hash of optional parameters.
Options
-
:order_id
– order_id passed used purchase. (REQUIRED) -
:currency
– currency. Supported: EUR, USD, GBP. -
:description
– description to be pased to the gateway.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb', line 34 def purchase(money, creditcard, = {}) requires!(, :order_id) post = { 'Descripcion' => [:description], 'Num_operacion' => [:order_id], 'Idioma' => CECA_UI_LESS_LANGUAGE, 'Pago_soportado' => CECA_MODE, 'URL_OK' => CECA_NOTIFICATIONS_URL, 'URL_NOK' => CECA_NOTIFICATIONS_URL, 'Importe' => amount(money), 'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[[:currency] || currency(money)] } add_creditcard(post, creditcard) commit(CECA_ACTION_PURCHASE, post) end |
#refund(money, identification, options = {}) ⇒ Object
Refund a transaction.
This transaction indicates to the gateway that money should flow from the merchant to the customer.
Parameters
-
money
– The amount to be credited to the customer as an Integer value in cents. -
identification
– The reference given from the gateway on purchase (reference, not operation). -
options
– A hash of parameters.
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb', line 61 def refund(money, identification, = {}) reference, order_id = (identification) post = { 'Referencia' => reference, 'Num_operacion' => order_id, 'Idioma' => CECA_UI_LESS_LANGUAGE_REFUND, 'Pagina' => CECA_UI_LESS_REFUND_PAGE, 'Importe' => amount(money), 'TipoMoneda' => CECA_CURRENCIES_DICTIONARY[[:currency] || currency(money)] } commit(CECA_ACTION_REFUND, post) end |
#scrub(transcript) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/active_merchant/billing/gateways/cecabank/cecabank_xml.rb', line 74 def scrub(transcript) transcript. gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]'). gsub(%r((&?pan=)[^&]*)i, '\1[FILTERED]'). gsub(%r((&?cvv2=)[^&]*)i, '\1[FILTERED]') end |