Class: PuntoPagos::Request
- Inherits:
-
Object
- Object
- PuntoPagos::Request
- Defined in:
- lib/puntopagos/request.rb
Instance Method Summary collapse
- #create(trx_id, amount, payment_type = nil) ⇒ Object
-
#initialize(env = nil) ⇒ Request
constructor
A new instance of Request.
- #validate ⇒ Object
Constructor Details
#initialize(env = nil) ⇒ Request
Returns a new instance of Request.
13 14 15 16 17 18 |
# File 'lib/puntopagos/request.rb', line 13 def initialize env = nil @env = env @@config ||= PuntoPagos::Config.new(@env) @@puntopagos_base_url ||= @@config.puntopagos_base_url @@function = "transaccion/crear" end |
Instance Method Details
#create(trx_id, amount, payment_type = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/puntopagos/request.rb', line 24 def create trx_id, amount, payment_type = nil raise NoDataError unless trx_id and amount data = create_data trx_id, amount, payment_type = = (data['trx_id'], data['monto'], ) = PuntoPagos::Authorization.new(@env) signature = .sign() executioner = PuntoPagos::Executioner.new(@env) response_data = executioner.call_api(data, @@function, :post, signature, ) PuntoPagos::Response.new(response_data, @env) end |
#validate ⇒ Object
20 21 22 |
# File 'lib/puntopagos/request.rb', line 20 def validate #TODO validate JSON must have monto and trx_id end |