README.md in openpay-1.0.3 vs README.md in openpay-1.0.4
- old
+ new
@@ -1,10 +1,12 @@
-# Openpay-Ruby
+<img src="http://www.openpay.mx/img/logo.png">
+# Openpay-Ruby [![Build Status](https://travis-ci.org/open-pay/openpay-ruby.png?branch=master)](https://travis-ci.org/open-pay/openpay-ruby)
+
##Description
-ruby client for *Openpay api* services (version 1.0.3)
+ruby client for *Openpay api* services (version 1.0.4)
This is a ruby client implementing the payment services for *Openpay* at openpay.mx
For more information about Openpay visit:
- http://openpay.mx/
@@ -273,17 +275,25 @@
bank_accounts.each(customer_id) do |bank_account|
bank_account['alias']
end
+- list merchant / customer bank accounts
+
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+
+ merchant_filtered_list = bank_accounts.list(search_params)
+ customer_filtered_list = bank_accounts.list(search_params, customer_id)
+
- all bank accounts for a given customer
- accounts=bank_accounts.all(customer_id)
+ accounts=bank_accounts.all(customer_id)
- deletes a given customer bank account
- bank_accounts.delete(customer_id,bank_id)
+ bank_accounts.delete(customer_id,bank_id)
- deletes all customer bank accounts (sandbox mode only)
bank_accounts.delete_all(customer['id'])
@@ -307,10 +317,18 @@
- each merchant card
cards.each {|merchant_card| p card}
+- list merchant / customer cards
+
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+
+ merchant_filtered_list = cards.list(search_params)
+ customer_filtered_list = cards.list(search_params, customer_id)
+
- each customer card
cards.each(customer_id) {|customer_card | p customer_card }
- all merchant cards
@@ -327,17 +345,17 @@
- delete customer card
cards.delete(card_id,customer_id)
- - delete all merchant cards
+- delete all merchant cards
cards.delete_all
- - delete all customer cards
+- delete all customer cards
- cards.delete_all(customer_id)
+ cards.delete_all(customer_id)
#### charges
@@ -353,47 +371,66 @@
merchant_charge=charges.get(charge_id)
- gets customer charge
- customer_charge=charges.get(charge_id,customer_id)
+ customer_charge=charges.get(charge_id,customer_id)
- each merchant charge
- charges.each {|charge| p charge}
+ charges.each {|charge| p charge}
+- list merchant / customer charges
+
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+
+ merchant_filtered_list = charges.list(search_params)
+ customer_filtered_list = charges.list(search_params, customer_id)
+
- each customer charge
- charges.each(customer_id) {|charge| p charge}
+ charges.each(customer_id) {|charge| p charge}
- all merchant charge
- charges.all
+ charges.all
- all customer charge
- charges.all(customer_id)
+ charges.all(customer_id)
- capture merchant card
charges.capture(charge_id)
- capture customer card
charges.capture(charge['id'],customer['id'])
+- confirm capture merchant
+
+ #pass a hash with the following options, no customer_id needed
+ confirm_capture_options = { transaction_id: transaction['id'], amount: 100 }
+ charges.confirm_capture(confirm_capture_options)
+
+- confirm capture customer
+
+ #pass a hash with the following options, pass the customer_id
+ confirm_capture_options = { customer_id: customer['id'], transaction_id: charge['id'], amount: 100 }
+ charges.confirm_capture(confirm_capture_options)
+
- refund merchant charge
charges.refund(charge_id, refund_description_hash)
- refund merchant charge
- charges.refund(charge_id, refund_description_hash)
+ charges.refund(charge_id, refund_description_hash)
-
#### customers
- creates customer
customers.create(customer_json)
@@ -412,42 +449,53 @@
- each customer
customers.each do {|customer| p customer }
-- list all customer
+- list customers
- all_customers=customers.all
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+ customers_filtered_list = customers.list(search_params)
+
+- all customer
+
+ all_customers=customers.all
+
- delete all customers (sand box mode only)
all_customers=customers.all
-
#### fees
-
- creates fee
#In order to create a fee a charge should exists
fee.create(fee_hash)
- gets all fees
all_fees=fees.all
+- list customer fees
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+
+ merchant_filtered_list = fees.list(search_params)
+
#### payouts
- creates a merchant payout
payouts.create(payout_json)
- creates a customer payout
- payouts.create(payout_hash,customer_id)
+ payouts.create(payout_hash,customer_id)
- gets a merchant payout
payouts.get(payout_id)
- gets a customer payout
@@ -468,54 +516,69 @@
- each customer payout
payouts.each(customer_id) { |payout| p payout }
+- list merchant/customer payouts
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+ merchant_filtered_list = payouts.list(search_params)
+ customer_filtered_list = payouts.list(search_params, customer_id)
+
#### plans
- create merchant plan
plans.create(plan_hash)
-- create customer plan
+- create customer plan
plans.create(plan_hash,customer_id)
- get a merchant plan
merchant_plan=plans.get(plan_id)
-- get a customer plan
+- get a customer plan
customer_plan=plans.get(plan_id,customer_id)
-- updates a merchant plan
+- updates a merchant plan
plans.update(plan_hash,customer_id)
-- updates a customer plan
+- updates a customer plan
plans.update(plan_hash,customer_id)
-- each merchant plan
+- each merchant plan
plans.each do {|plan| p plan }
-- each customer plans
+- each customer plans
plans.each(customer_id) do {|plan| p plan }
-- all merchant plans
+- list merchant /customer plan
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+
+ merchant_filtered_list = plans.list(search_params)
+ customer_filtered_list = plans.list(search_params, customer_id)
+
+
+- all merchant plans
+
plans.all
-- all customer plans
+- all customer plans
plans.all(customer_id)
#### subscriptions
@@ -526,19 +589,32 @@
- get customer subscription
subscriptions.get(subscriptions_hash,customer_id)
+- update customer subscription
+
+ subscription_update_hash={ trial_end_date: "2016-01-12" }
+ subscriptions.update(subscription_id,customer_id, subscription_update_hash )
+
- all customer subscription
subscriptions.all(customer_id)
- each customer subscription
subscriptions.each(customer_id) {|subscription| p subscription }
+
+- list customer subscriptions
+
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+
+ customer_filtered_list = subscriptions.list(search_params, customer_id)
+
- deletes customer subscription
subscriptions.delete(customer_id)
- deletes all customer subscriptions ( sandbox mode only)
@@ -564,18 +640,24 @@
- each customer transfer
transfers.each(customer_id) {|transfer| p transfer }
+- list customer transfers
+ search_params = OpenpayUtils::SearchParams.new
+ search_params.limit = 1
+ customer_filtered_list = transfers.list(search_params, customer_id)
+
+
#### Exceptions
This API generates 3 different Exception classes.
-- **OpenpayException**: Generic base api exception class, for generic api exceptions.
+- **OpenpayException**: Generic base API exception class, Generic API exceptions.
- - Internal server error (500 Internal Server Error)
+ - Internal server error (500 Internal Server Error).
- OpenpayApi factory method, invalid resource name.
Examples:
```ruby