Class: PseCo

Inherits:
OpenPayResource show all
Defined in:
lib/openpay/colombia/pse_co.rb

Instance Attribute Summary

Attributes inherited from OpenPayResource

#api_hook

Instance Method Summary collapse

Methods inherited from OpenPayResource

#delete, #delete_all, #each, #env, #errors?, #get, #get_with_custom_url, #hash2json, #initialize, #json2hash, #list, #post, #put

Constructor Details

This class inherits a constructor from OpenPayResource

Instance Method Details

#create(charge, customer_id = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/openpay/colombia/pse_co.rb', line 3

def create(charge, customer_id = nil)
  amount = charge[:amount].to_s.split('.')
  if amount.length > 0
    LOG.warn "The amount have decimals. Revoming.."
  end
  charge[:amount] = amount[0]
  if customer_id
    customers = @api_hook.create(:customers)
    customers.create_charge(customer_id, charge)
  else
    super charge
  end
end