Class: Akatus::Services::Transaction
- Inherits:
-
Akatus::Service
- Object
- Akatus::Service
- Akatus::Services::Transaction
- Defined in:
- lib/akatus/services/transaction.rb
Constant Summary collapse
- PATH =
'carrinho'
- METHOD =
:post
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Akatus::Service
Class Method Details
.create(*args) ⇒ Object
14 15 16 |
# File 'lib/akatus/services/transaction.rb', line 14 def self.create(*args) self.new.create(*args) end |
Instance Method Details
#create(payment) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/akatus/services/transaction.rb', line 18 def create(payment) @payment = payment data = send_request @payment.id = data['carrinho'] # TODO: improve; use constants? @payment.status = data['status'] @payment.transaction_id = data['transacao'] if data['url_retorno'] @payment.url = data['url_retorno'].sub("https://www.akatus.com/", Akatus.config.base_url) end @payment end |
#status ⇒ Object
38 39 40 |
# File 'lib/akatus/services/transaction.rb', line 38 def status # TODO: implement. end |
#to_payload ⇒ Object
42 43 44 |
# File 'lib/akatus/services/transaction.rb', line 42 def to_payload @payment.to_payload end |