Module: ActiveMerchant::Billing::Integrations::Sermepa

Defined in:
lib/active_merchant/billing/integrations/sermepa.rb,
lib/active_merchant/billing/integrations/sermepa/helper.rb,
lib/active_merchant/billing/integrations/sermepa/notification.rb

Overview

See the BbvaTpv::Helper class for more generic information on usage of this integrated payment method.

Defined Under Namespace

Classes: Helper, Notification

Class Method Summary collapse

Class Method Details

.currency_code(name) ⇒ Object



54
55
56
57
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 54

def self.currency_code( name )
  row = supported_currencies.assoc(name)
  row.nil? ? supported_currencies.first[1] : row[1]
end

.currency_from_code(code) ⇒ Object



59
60
61
62
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 59

def self.currency_from_code( code )
  row = supported_currencies.rassoc(code)
  row.nil? ? supported_currencies.first[0] : row[0]
end

.language_code(name) ⇒ Object



64
65
66
67
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 64

def self.language_code(name)
  row = supported_languages.assoc(name.to_s.downcase.to_sym)
  row.nil? ? supported_languages.first[1] : row[1]
end

.language_from_code(code) ⇒ Object



69
70
71
72
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 69

def self.language_from_code( code )
  row = supported_languages.rassoc(code)
  row.nil? ? supported_languages.first[0] : row[0]
end

.notification(post) ⇒ Object



49
50
51
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 49

def self.notification(post)
  Notification.new(post)
end

.operations_urlObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 36

def self.operations_url
  mode = ActiveMerchant::Billing::Base.integration_mode
  case mode
  when :production
    self.operations_production_url
  when :test
    self.operations_test_url
  else
    raise StandardError, "Integration mode set to an invalid value: #{mode}"
  end

end

.response_code_message(code) ⇒ Object



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 118

def self.response_code_message(code)
  case code.to_i
  when 0..99
    nil
  when 900
   "Transacción autorizada para devoluciones y confirmaciones"
  when 101
    "Tarjeta caducada"
  when 102
    "Tarjeta en excepción transitoria o bajo sospecha de fraude"
  when 104
    "Operación no permitida para esa tarjeta o terminal"
  when 116
    "Disponible insuficiente"
  when 118
    "Tarjeta no registrada o Método de pago no disponible para su tarjeta"
  when 129
    "Código de seguridad (CVV2/CVC2) incorrecto"
  when 180
    "Tarjeta no válida o Tarjeta ajena al servicio o Error en la llamada al MPI sin controlar."
  when 184
    "Error en la autenticación del titular"
  when 190
    "Denegación sin especificar Motivo"
  when 191
    "Fecha de caducidad errónea"
  when 202
    "Tarjeta en excepción transitoria o bajo sospecha de fraude con retirada de tarjeta"
  when 912,9912
    "Emisor no disponible"
  when 913
    "Pedido repetido"
  else
    "Transacción denegada"
  end
end

.service_urlObject



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 24

def self.service_url 
  mode = ActiveMerchant::Billing::Base.integration_mode
  case mode
  when :production
    self.service_production_url
  when :test
    self.service_test_url
  else
    raise StandardError, "Integration mode set to an invalid value: #{mode}"
  end
end

.supported_currenciesObject



83
84
85
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 83

def self.supported_currencies
  [ ['EUR', '978'] ]
end

.supported_languagesObject



87
88
89
90
91
92
93
94
95
96
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 87

def self.supported_languages
  [
    [:es, '001'],
    [:en, '002'],
    [:ca, '003'],
    [:fr, '004'],
    [:de, '005'],
    [:pt, '009']
  ]
end

.supported_transactionsObject



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 98

def self.supported_transactions
  [
    [:authorization,              '0'],
    [:preauthorization,           '1'],
    [:confirmation,               '2'],
    [:automatic_return,           '3'],
    [:reference_payment,          '4'],
    [:recurring_transaction,      '5'],
    [:successive_transaction,     '6'],
    [:authentication,             '7'],
    [:confirm_authentication,     '8'],
    [:cancel_preauthorization,    '9'],
    [:deferred_authorization,             'O'],
    [:confirm_deferred_authorization,     'P'],
    [:cancel_deferred_authorization,      'Q'],
    [:inicial_recurring_authorization,    'R'],
    [:successive_recurring_authorization, 'S']
  ]
end

.transaction_code(name) ⇒ Object



74
75
76
77
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 74

def self.transaction_code(name)
  row = supported_transactions.assoc(name.to_sym)
  row.nil? ? supported_transactions.first[1] : row[1]
end

.transaction_from_code(code) ⇒ Object



78
79
80
81
# File 'lib/active_merchant/billing/integrations/sermepa.rb', line 78

def self.transaction_from_code(code)
  row = supported_transactions.rassoc(code.to_s)
  row.nil? ? supported_languages.first[0] : row[0]
end