class Customers
Public Instance Methods
all_bank_accounts(customer)
click to toggle source
# File lib/openpay/customers.rb, line 14 def all_bank_accounts(customer) get("#{customer}/bankaccounts/") end
all_cards(customer)
click to toggle source
# File lib/openpay/customers.rb, line 196 def all_cards(customer) get("#{customer}/cards") end
all_charges(customer_id)
click to toggle source
return all charges for the given customer_id
# File lib/openpay/customers.rb, line 57 def all_charges(customer_id) get("#{customer_id}/charges/") end
all_payouts(customer_id)
click to toggle source
# File lib/openpay/customers.rb, line 82 def all_payouts(customer_id) get("#{customer_id}/payouts") end
all_subscriptions(customer_id)
click to toggle source
# File lib/openpay/customers.rb, line 137 def all_subscriptions(customer_id) get("#{customer_id}/subscriptions/") end
all_transfers(customer_id)
click to toggle source
# File lib/openpay/customers.rb, line 105 def all_transfers(customer_id) get("#{customer_id}/transfers/") end
cancel_charge(customer_id, charge_id)
click to toggle source
# File lib/openpay/customers.rb, line 61 def cancel_charge(customer_id, charge_id) post(charge_id, "#{customer_id}/charges/#{charge_id}/cancel") end
capture_charge(customer_id, charge_id)
click to toggle source
# File lib/openpay/customers.rb, line 69 def capture_charge(customer_id, charge_id) post('', "#{customer_id}/charges/#{charge_id}/capture") end
confirm_customer_capture(customer_id, charge_id, amount)
click to toggle source
# File lib/openpay/customers.rb, line 73 def confirm_customer_capture(customer_id, charge_id, amount) post(amount, "#{customer_id}/charges/#{charge_id}/capture") end
create_bank_account(customer, bank_account)
click to toggle source
Bankaccount
# File lib/openpay/customers.rb, line 6 def create_bank_account(customer, bank_account) create(bank_account, "#{customer}/bankaccounts") end
create_card(customer, card)
click to toggle source
Card
# File lib/openpay/customers.rb, line 165 def create_card(customer, card) create(card, "#{customer}/cards") end
create_charge(customer_id, charge)
click to toggle source
customers.create_charge(customer_id,charge)
# File lib/openpay/customers.rb, line 43 def create_charge(customer_id, charge) create(charge, "#{customer_id}/charges") end
create_payout(customer_id, payout)
click to toggle source
# File lib/openpay/customers.rb, line 78 def create_payout(customer_id, payout) post(payout, "#{customer_id}/payouts") end
create_subscription(subscription, customer_id)
click to toggle source
# File lib/openpay/customers.rb, line 124 def create_subscription(subscription, customer_id) #revisar la url post(subscription, "#{customer_id}/subscriptions") end
create_transfer(customer_id, transfer)
click to toggle source
# File lib/openpay/customers.rb, line 101 def create_transfer(customer_id, transfer) post(transfer, "#{customer_id}/transfers") end
delete_all_bank_accounts(customer)
click to toggle source
# File lib/openpay/customers.rb, line 32 def delete_all_bank_accounts(customer) if env == :production raise OpenpayException.new('This method is not supported on PRODUCTION', false) end each_bank_account(customer) do |account| delete("#{customer}/bankaccounts/#{account['id']}") end end
delete_all_cards(customer_id)
click to toggle source
# File lib/openpay/customers.rb, line 177 def delete_all_cards(customer_id) if env == :production raise OpenpayException.new('This method is not supported on PRODUCTION', false) end each_card(customer_id) do |card| delete_card(customer_id, card['id']) end end
delete_all_subscriptions(customer_id)
click to toggle source
# File lib/openpay/customers.rb, line 155 def delete_all_subscriptions(customer_id) if env == :production raise OpenpayException.new('This method is not supported on PRODUCTION', false) end all_subscriptions(customer_id).each do |sub| delete_subscription(customer_id, sub['id']) end end
delete_bank_account(customer, bank_id)
click to toggle source
# File lib/openpay/customers.rb, line 28 def delete_bank_account(customer, bank_id) delete("#{customer}/bankaccounts/#{bank_id}") end
delete_card(customer, card_id)
click to toggle source
# File lib/openpay/customers.rb, line 173 def delete_card(customer, card_id) delete("#{customer}/cards/#{card_id}") end
delete_subscription(customer_id, subscription_id)
click to toggle source
# File lib/openpay/customers.rb, line 129 def delete_subscription(customer_id, subscription_id) delete("#{customer_id}/subscriptions/#{subscription_id}") end
each_bank_account(customer) { |account| ... }
click to toggle source
# File lib/openpay/customers.rb, line 22 def each_bank_account(customer) get("#{customer}/bankaccounts/").each do |account| yield account end end
each_card(customer) { |card| ... }
click to toggle source
# File lib/openpay/customers.rb, line 186 def each_card(customer) get("#{customer}/cards").each do |card| yield card end end
each_payout(customer_id) { |pay| ... }
click to toggle source
# File lib/openpay/customers.rb, line 90 def each_payout(customer_id) all_payouts(customer_id).each do |pay| yield pay end end
each_subscription(customer_id) { |cust| ... }
click to toggle source
# File lib/openpay/customers.rb, line 145 def each_subscription(customer_id) all_subscriptions(customer_id).each do |cust| yield cust end end
each_transfer(customer_id) { |trans| ... }
click to toggle source
# File lib/openpay/customers.rb, line 117 def each_transfer(customer_id) all_transfers(customer_id).each do |trans| yield trans end end
get_bank_account(customer, bank_id)
click to toggle source
# File lib/openpay/customers.rb, line 10 def get_bank_account(customer, bank_id) get("#{customer}/bankaccounts/#{bank_id}") end
get_card(customer, card_id)
click to toggle source
# File lib/openpay/customers.rb, line 169 def get_card(customer, card_id) get("#{customer}/cards/#{card_id}") end
get_charge(customer_id, charge_id)
click to toggle source
gets a charge_id for a given customer_id
# File lib/openpay/customers.rb, line 48 def get_charge(customer_id, charge_id) get("#{customer_id}/charges/#{charge_id}") end
get_payout(customer_id, payout_id)
click to toggle source
# File lib/openpay/customers.rb, line 86 def get_payout(customer_id, payout_id) get("#{customer_id}/payouts/#{payout_id}") end
get_subscription(customer_id, subscription_id)
click to toggle source
# File lib/openpay/customers.rb, line 133 def get_subscription(customer_id, subscription_id) get("#{customer_id}/subscriptions/#{subscription_id}") end
get_transfer(customer_id, transfer_id)
click to toggle source
# File lib/openpay/customers.rb, line 113 def get_transfer(customer_id, transfer_id) get("#{customer_id}/transfers/#{transfer_id}") end
list_bankaccounts(customer, search_params)
click to toggle source
# File lib/openpay/customers.rb, line 18 def list_bankaccounts(customer, search_params) get("#{customer}/bankaccounts#{search_params.to_s}") end
list_cards(customer, search_params)
click to toggle source
# File lib/openpay/customers.rb, line 192 def list_cards(customer, search_params) get("#{customer}/cards#{search_params.to_s}") end
list_charges(customer, search_params)
click to toggle source
# File lib/openpay/customers.rb, line 52 def list_charges(customer, search_params) get("#{customer}/charges#{search_params.to_s}") end
list_payouts(customer, search_params)
click to toggle source
# File lib/openpay/customers.rb, line 96 def list_payouts(customer, search_params) get("#{customer}/payouts#{search_params.to_s}") end
list_subscriptions(customer, search_params)
click to toggle source
# File lib/openpay/customers.rb, line 141 def list_subscriptions(customer, search_params) get("#{customer}/subscriptions#{search_params.to_s}") end
list_transfers(customer, search_params)
click to toggle source
# File lib/openpay/customers.rb, line 109 def list_transfers(customer, search_params) get("#{customer}/transfers#{search_params.to_s}") end
refund_charge(customer_id, charge_id, description)
click to toggle source
# File lib/openpay/customers.rb, line 65 def refund_charge(customer_id, charge_id, description) post(description, "#{customer_id}/charges/#{charge_id}/refund") end
update_subscription(subscription, customer, params)
click to toggle source
# File lib/openpay/customers.rb, line 151 def update_subscription(subscription, customer, params) put(params, "#{customer}/subscriptions/#{subscription}") end