openpay_copemx 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.travis.yml +6 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +13 -0
- data/README.md +1984 -0
- data/Rakefile +16 -0
- data/lib/openpay/bankaccounts.rb +58 -0
- data/lib/openpay/cards.rb +73 -0
- data/lib/openpay/charges.rb +101 -0
- data/lib/openpay/colombia/cards_co.rb +73 -0
- data/lib/openpay/colombia/charges_co.rb +76 -0
- data/lib/openpay/colombia/customers_co.rb +166 -0
- data/lib/openpay/colombia/plans_co.rb +17 -0
- data/lib/openpay/colombia/pse_co.rb +17 -0
- data/lib/openpay/colombia/subscriptions_co.rb +50 -0
- data/lib/openpay/colombia/tokens_co.rb +5 -0
- data/lib/openpay/colombia/webhooks_co.rb +5 -0
- data/lib/openpay/customers.rb +200 -0
- data/lib/openpay/errors/openpay_connection_exception.rb +3 -0
- data/lib/openpay/errors/openpay_exception.rb +29 -0
- data/lib/openpay/errors/openpay_exception_factory.rb +56 -0
- data/lib/openpay/errors/openpay_transaction_exception.rb +5 -0
- data/lib/openpay/fees.rb +5 -0
- data/lib/openpay/open_pay_resource.rb +295 -0
- data/lib/openpay/open_pay_resource_factory.rb +17 -0
- data/lib/openpay/openpay_api.rb +72 -0
- data/lib/openpay/payouts.rb +55 -0
- data/lib/openpay/peru/cards_pe.rb +73 -0
- data/lib/openpay/peru/charges_pe.rb +76 -0
- data/lib/openpay/peru/checkouts_pe.rb +51 -0
- data/lib/openpay/peru/customers_pe.rb +79 -0
- data/lib/openpay/peru/tokens_pe.rb +5 -0
- data/lib/openpay/peru/webhooks_pe.rb +5 -0
- data/lib/openpay/plans.rb +17 -0
- data/lib/openpay/points.rb +10 -0
- data/lib/openpay/subscriptions.rb +50 -0
- data/lib/openpay/tokens.rb +7 -0
- data/lib/openpay/transfers.rb +39 -0
- data/lib/openpay/utils/country.rb +3 -0
- data/lib/openpay/utils/search_params.rb +24 -0
- data/lib/openpay/webhooks.rb +9 -0
- data/lib/openpay.rb +55 -0
- data/lib/version.rb +3 -0
- data/openpay.gemspec +30 -0
- data/test/Factories.rb +524 -0
- data/test/spec/bankaccounts_spec.rb +52 -0
- data/test/spec/cards_spec.rb +437 -0
- data/test/spec/charges_spec.rb +382 -0
- data/test/spec/colombia/cards_col_spec.rb +364 -0
- data/test/spec/colombia/charges_col_spec.rb +258 -0
- data/test/spec/colombia/customers_co_spec.rb +151 -0
- data/test/spec/colombia/plans_col_spec.rb +133 -0
- data/test/spec/colombia/pse_col_spec.rb +49 -0
- data/test/spec/colombia/subscriptions_col_spec.rb +230 -0
- data/test/spec/colombia/tokens_col_spec.rb +38 -0
- data/test/spec/customers_spec.rb +172 -0
- data/test/spec/exceptions_spec.rb +105 -0
- data/test/spec/fees_spec.rb +166 -0
- data/test/spec/openpayresource_spec.rb +54 -0
- data/test/spec/payouts_spec.rb +231 -0
- data/test/spec/peru/cards_pe_spec.rb +363 -0
- data/test/spec/peru/charges_pe_spec.rb +218 -0
- data/test/spec/peru/checkouts_pe_spec.rb +71 -0
- data/test/spec/peru/customers_pe_spec.rb +151 -0
- data/test/spec/peru/tokens_pe_spec.rb +38 -0
- data/test/spec/peru/webhook_pe_spec.rb +50 -0
- data/test/spec/plans_spec.rb +158 -0
- data/test/spec/points_spec.rb +26 -0
- data/test/spec/requesttimeout_spec.rb +22 -0
- data/test/spec/subscriptions_spec.rb +294 -0
- data/test/spec/transfers_spec.rb +219 -0
- data/test/spec/utils/search_params_spec.rb +36 -0
- data/test/spec_helper.rb +24 -0
- metadata +219 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'open_pay_resource'
|
|
2
|
+
|
|
3
|
+
class Payouts < OpenPayResource
|
|
4
|
+
|
|
5
|
+
def all(customer_id=nil)
|
|
6
|
+
if customer_id
|
|
7
|
+
customers=@api_hook.create(:customers)
|
|
8
|
+
customers.all_payouts(customer_id)
|
|
9
|
+
else
|
|
10
|
+
super ''
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def get(payout='', customer_id=nil)
|
|
15
|
+
if customer_id
|
|
16
|
+
customers=@api_hook.create(:customers)
|
|
17
|
+
customers.get_payout(customer_id, payout)
|
|
18
|
+
else
|
|
19
|
+
super payout
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def each(customer_id=nil)
|
|
24
|
+
if customer_id
|
|
25
|
+
customers=@api_hook.create(:customers)
|
|
26
|
+
customers.each_payout(customer_id) do |cust|
|
|
27
|
+
yield cust
|
|
28
|
+
end
|
|
29
|
+
else
|
|
30
|
+
all.each do |cust|
|
|
31
|
+
yield cust
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def create(payout, customer_id=nil)
|
|
37
|
+
if customer_id
|
|
38
|
+
customers=@api_hook.create(:customers)
|
|
39
|
+
customers.create_payout(customer_id, payout)
|
|
40
|
+
else
|
|
41
|
+
super payout
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def list(search_params, customer_id=nil)
|
|
46
|
+
if customer_id
|
|
47
|
+
customers=@api_hook.create(:customers)
|
|
48
|
+
customers.list_payouts(customer_id, search_params)
|
|
49
|
+
else
|
|
50
|
+
super search_params
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
require 'open_pay_resource'
|
|
2
|
+
|
|
3
|
+
class CardsPe < OpenPayResource
|
|
4
|
+
|
|
5
|
+
def get(card='',customer_id=nil)
|
|
6
|
+
if customer_id
|
|
7
|
+
customers=@api_hook.create(:customers)
|
|
8
|
+
customers.get_card(customer_id,card)
|
|
9
|
+
else
|
|
10
|
+
super card
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create(card,customer_id=nil)
|
|
15
|
+
if customer_id
|
|
16
|
+
customers=@api_hook.create(:customers)
|
|
17
|
+
customers.create_card(customer_id,card)
|
|
18
|
+
else
|
|
19
|
+
super card
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def delete(card_id,customer_id=nil)
|
|
24
|
+
if customer_id
|
|
25
|
+
customers=@api_hook.create(:customers)
|
|
26
|
+
customers.delete_card(customer_id,card_id)
|
|
27
|
+
else
|
|
28
|
+
super card_id
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def delete_all(customer_id=nil)
|
|
33
|
+
if customer_id
|
|
34
|
+
customers=@api_hook.create(:customers)
|
|
35
|
+
customers.delete_all_cards(customer_id)
|
|
36
|
+
else
|
|
37
|
+
each do |card|
|
|
38
|
+
delete(card['id'])
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def each(customer_id=nil)
|
|
44
|
+
if customer_id
|
|
45
|
+
all(customer_id).each do |card|
|
|
46
|
+
yield card
|
|
47
|
+
end
|
|
48
|
+
else
|
|
49
|
+
all.each do |card|
|
|
50
|
+
yield card
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def all(customer_id=nil)
|
|
56
|
+
if customer_id
|
|
57
|
+
customers=@api_hook.create(:customers)
|
|
58
|
+
customers.all_cards(customer_id)
|
|
59
|
+
else
|
|
60
|
+
super ''
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def list(search_params,customer_id=nil)
|
|
65
|
+
if customer_id
|
|
66
|
+
customers=@api_hook.create(:customers)
|
|
67
|
+
customers.list_cards(customer_id,search_params)
|
|
68
|
+
else
|
|
69
|
+
super search_params
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require 'open_pay_resource'
|
|
2
|
+
|
|
3
|
+
class ChargesPe < OpenPayResource
|
|
4
|
+
|
|
5
|
+
def create(charge, customer_id = nil)
|
|
6
|
+
amount = charge[:amount].to_s.split('.')
|
|
7
|
+
if amount.length > 0
|
|
8
|
+
LOG.warn "The amount have decimals. Revoming.."
|
|
9
|
+
end
|
|
10
|
+
charge[:amount] = amount[0]
|
|
11
|
+
if customer_id
|
|
12
|
+
customers = @api_hook.create(:customers)
|
|
13
|
+
customers.create_charge(customer_id, charge)
|
|
14
|
+
else
|
|
15
|
+
super charge
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def all(customer_id = nil)
|
|
20
|
+
if customer_id
|
|
21
|
+
customers = @api_hook.create(:customers)
|
|
22
|
+
customers.all_charges(customer_id)
|
|
23
|
+
else
|
|
24
|
+
super ''
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# def cancel(transaction_id, customer_id = nil)
|
|
29
|
+
# if customer_id
|
|
30
|
+
# customers = @api_hook.create(:customers)
|
|
31
|
+
# customers.cancel_charge(customer_id, transaction_id)
|
|
32
|
+
# else
|
|
33
|
+
# post('', transaction_id + '/cancel')
|
|
34
|
+
# end
|
|
35
|
+
# end
|
|
36
|
+
#
|
|
37
|
+
# def refund(transaction_id, description, customer_id = nil)
|
|
38
|
+
# if customer_id
|
|
39
|
+
# customers = @api_hook.create(:customers)
|
|
40
|
+
# customers.refund_charge(customer_id, transaction_id, description)
|
|
41
|
+
# else
|
|
42
|
+
# post(description, transaction_id + '/refund')
|
|
43
|
+
# end
|
|
44
|
+
# end
|
|
45
|
+
|
|
46
|
+
def each(customer_id = nil)
|
|
47
|
+
if customer_id
|
|
48
|
+
all(customer_id).each do |card|
|
|
49
|
+
yield card
|
|
50
|
+
end
|
|
51
|
+
else
|
|
52
|
+
all.each do |card|
|
|
53
|
+
yield card
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def get(charge = '', customer_id = nil)
|
|
59
|
+
if customer_id
|
|
60
|
+
customers = @api_hook.create(:customers)
|
|
61
|
+
customers.get_charge(customer_id, charge)
|
|
62
|
+
else
|
|
63
|
+
super charge
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def list(search_params, customer_id = nil)
|
|
68
|
+
if customer_id
|
|
69
|
+
customers = @api_hook.create(:customers)
|
|
70
|
+
customers.list_charges(customer_id, search_params)
|
|
71
|
+
else
|
|
72
|
+
super search_params
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'open_pay_resource'
|
|
2
|
+
|
|
3
|
+
class CheckoutsPe < OpenPayResource
|
|
4
|
+
|
|
5
|
+
def create(checkout, customer_id = nil)
|
|
6
|
+
amount = checkout[:amount].to_s.split('.')
|
|
7
|
+
if amount.length > 0
|
|
8
|
+
LOG.warn "The amount have decimals. Revoming.."
|
|
9
|
+
end
|
|
10
|
+
checkout[:amount] = amount[0]
|
|
11
|
+
if customer_id
|
|
12
|
+
customers = @api_hook.create(:customers)
|
|
13
|
+
customers.create_checkout(customer_id, checkout)
|
|
14
|
+
else
|
|
15
|
+
super checkout
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def get(checkout_id = '', customer_id = nil)
|
|
20
|
+
if customer_id
|
|
21
|
+
customers = @api_hook.create(:customers)
|
|
22
|
+
customers.get_checkout(customer_id, checkout_id)
|
|
23
|
+
else
|
|
24
|
+
super checkout_id
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def all(customer_id = nil)
|
|
29
|
+
if customer_id
|
|
30
|
+
customers = @api_hook.create(:customers)
|
|
31
|
+
customers.all_checkouts(customer_id)
|
|
32
|
+
else
|
|
33
|
+
super ''
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def list(search_params, customer_id = nil)
|
|
38
|
+
if customer_id
|
|
39
|
+
customers = @api_hook.create(:customers)
|
|
40
|
+
customers.list_checkouts(customer_id, search_params)
|
|
41
|
+
else
|
|
42
|
+
super search_params
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def get_by_order_id(order_id)
|
|
47
|
+
url = @base_url + "#{@merchant_id}/orderId/#{order_id}/checkouts"
|
|
48
|
+
get_with_custom_url(url)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require 'openpay/open_pay_resource'
|
|
2
|
+
|
|
3
|
+
class CustomersPe < OpenPayResource
|
|
4
|
+
|
|
5
|
+
#Charges
|
|
6
|
+
# customers.create_charge(customer_id,charge)
|
|
7
|
+
def create_charge(customer_id, charge)
|
|
8
|
+
create(charge, "#{customer_id}/charges")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
#gets a charge_id for a given customer_id
|
|
12
|
+
def get_charge(customer_id, charge_id)
|
|
13
|
+
get("#{customer_id}/charges/#{charge_id}")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def list_charges(customer, search_params)
|
|
17
|
+
get("#{customer}/charges#{search_params.to_s}")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
#return all charges for the given customer_id
|
|
22
|
+
def all_charges(customer_id)
|
|
23
|
+
get("#{customer_id}/charges")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
#Card
|
|
27
|
+
def create_card(customer, card)
|
|
28
|
+
create(card, "#{customer}/cards")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def get_card(customer, card_id)
|
|
32
|
+
get("#{customer}/cards/#{card_id}")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def delete_card(customer, card_id)
|
|
36
|
+
delete("#{customer}/cards/#{card_id}")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def delete_all_cards(customer_id)
|
|
40
|
+
if env == :production
|
|
41
|
+
raise OpenpayException.new('This method is not supported on PRODUCTION', false)
|
|
42
|
+
end
|
|
43
|
+
each_card(customer_id) do |card|
|
|
44
|
+
delete_card(customer_id, card['id'])
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def each_card(customer)
|
|
49
|
+
get("#{customer}/cards").each do |card|
|
|
50
|
+
yield card
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def list_cards(customer, search_params)
|
|
55
|
+
get("#{customer}/cards#{search_params.to_s}")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def all_cards(customer)
|
|
59
|
+
get("#{customer}/cards")
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Checkouts
|
|
63
|
+
def create_checkout(customer, checkout)
|
|
64
|
+
create(checkout, "#{customer}/checkouts")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def get_checkout(customer_id, checkout_id)
|
|
68
|
+
get("#{customer_id}/checkouts/#{checkout_id}")
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def all_checkouts(customer_id)
|
|
72
|
+
get("#{customer_id}/checkouts")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def list_checkouts(customer_id, search_params)
|
|
76
|
+
get("#{customer_id}/checkouts#{search_params.to_s}")
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'open_pay_resource'
|
|
2
|
+
|
|
3
|
+
class Plans < OpenPayResource
|
|
4
|
+
|
|
5
|
+
def update(plan,plan_id)
|
|
6
|
+
put(plan, "#{plan_id}")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def each_subscription(plan_id)
|
|
10
|
+
get("#{plan_id}/subscriptions")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def all_subscriptions(plan_id)
|
|
14
|
+
get("#{plan_id}/subscriptions")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'open_pay_resource'
|
|
2
|
+
|
|
3
|
+
class Subscriptions < OpenPayResource
|
|
4
|
+
|
|
5
|
+
def create(subscription, customer_id)
|
|
6
|
+
customers=@api_hook.create(:customers)
|
|
7
|
+
customers.create_subscription(subscription, customer_id)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def delete(subscription_id, customer_id)
|
|
11
|
+
customers=@api_hook.create(:customers)
|
|
12
|
+
customers.delete_subscription(customer_id, subscription_id)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def get(subscription_id, customer_id)
|
|
16
|
+
customers=@api_hook.create(:customers)
|
|
17
|
+
customers.get_subscription(customer_id, subscription_id)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def all(customer_id)
|
|
21
|
+
customers=@api_hook.create(:customers)
|
|
22
|
+
customers.all_subscriptions(customer_id)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def each(customer_id)
|
|
26
|
+
customers=@api_hook.create(:customers)
|
|
27
|
+
customers.each_subscription(customer_id) do |c|
|
|
28
|
+
yield c
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def list(search_params,customer_id=nil)
|
|
33
|
+
if customer_id
|
|
34
|
+
customers=@api_hook.create(:customers)
|
|
35
|
+
customers.list_subscriptions(customer_id,search_params)
|
|
36
|
+
else
|
|
37
|
+
super search_params
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def update(subscription_id,customer_id,params)
|
|
42
|
+
customers=@api_hook.create(:customers)
|
|
43
|
+
customers.update_subscription(subscription_id,customer_id,params)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def delete_all(customer_id)
|
|
47
|
+
customers=@api_hook.create(:customers)
|
|
48
|
+
customers.delete_all_subscriptions(customer_id)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'open_pay_resource'
|
|
2
|
+
|
|
3
|
+
class Transfers < OpenPayResource
|
|
4
|
+
|
|
5
|
+
def create(transfer, customer_id)
|
|
6
|
+
customers=@api_hook.create(:customers)
|
|
7
|
+
customers.create_transfer(customer_id, transfer)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def all(customer_id)
|
|
11
|
+
customers=@api_hook.create(:customers)
|
|
12
|
+
customers.all_transfers(customer_id)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def get(transfer, customer_id)
|
|
16
|
+
customers=@api_hook.create(:customers)
|
|
17
|
+
customers.get_transfer(customer_id, transfer)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def each(customer_id)
|
|
21
|
+
customers=@api_hook.create(:customers)
|
|
22
|
+
customers.each_transfer(customer_id) do |tran|
|
|
23
|
+
yield tran
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def list(search_params, customer_id=nil)
|
|
28
|
+
if customer_id
|
|
29
|
+
customers=@api_hook.create(:customers)
|
|
30
|
+
customers.list_transfers(customer_id, search_params)
|
|
31
|
+
else
|
|
32
|
+
super search_params
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'ostruct'
|
|
2
|
+
require 'cgi'
|
|
3
|
+
module OpenpayUtils
|
|
4
|
+
|
|
5
|
+
class SearchParams < OpenStruct
|
|
6
|
+
|
|
7
|
+
#"?creation[gte]=2013-11-01&limit=2&amount[lte]=100"
|
|
8
|
+
def to_str
|
|
9
|
+
filter = '?'
|
|
10
|
+
self.marshal_dump.each do |attribute, value|
|
|
11
|
+
if attribute =~ /(\w+)_(gte|lte)/
|
|
12
|
+
square_bracket_open_encode = CGI.escape('[')
|
|
13
|
+
square_bracket_close_encode = CGI.escape(']')
|
|
14
|
+
attribute = "#{$1}#{square_bracket_open_encode}#{$2}#{square_bracket_close_encode}"
|
|
15
|
+
end
|
|
16
|
+
filter << "#{attribute}=#{value}&"
|
|
17
|
+
end
|
|
18
|
+
filter.sub(/\&$/, '')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
alias :to_s :to_str
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/openpay.rb
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#openpay version
|
|
2
|
+
require 'version'
|
|
3
|
+
|
|
4
|
+
#external dependencies
|
|
5
|
+
require 'rest-client'
|
|
6
|
+
require 'json'
|
|
7
|
+
|
|
8
|
+
module Openpay
|
|
9
|
+
|
|
10
|
+
#api setup / constants
|
|
11
|
+
require 'openpay/openpay_api'
|
|
12
|
+
|
|
13
|
+
#base class
|
|
14
|
+
require 'openpay/open_pay_resource'
|
|
15
|
+
|
|
16
|
+
#resource classes
|
|
17
|
+
require 'openpay/points'
|
|
18
|
+
require 'openpay/tokens'
|
|
19
|
+
require 'openpay/bankaccounts'
|
|
20
|
+
require 'openpay/cards'
|
|
21
|
+
require 'openpay/charges'
|
|
22
|
+
require 'openpay/customers'
|
|
23
|
+
require 'openpay/fees'
|
|
24
|
+
require 'openpay/payouts'
|
|
25
|
+
require 'openpay/plans'
|
|
26
|
+
require 'openpay/subscriptions'
|
|
27
|
+
require 'openpay/transfers'
|
|
28
|
+
require 'openpay/webhooks'
|
|
29
|
+
require 'openpay/colombia/customers_co'
|
|
30
|
+
require 'openpay/colombia/charges_co'
|
|
31
|
+
require 'openpay/colombia/cards_co'
|
|
32
|
+
require 'openpay/colombia/plans_co'
|
|
33
|
+
require 'openpay/colombia/subscriptions_co'
|
|
34
|
+
require 'openpay/colombia/tokens_co'
|
|
35
|
+
require 'openpay/colombia/webhooks_co'
|
|
36
|
+
require 'openpay/colombia/pse_co'
|
|
37
|
+
|
|
38
|
+
require 'openpay/peru/customers_pe'
|
|
39
|
+
require 'openpay/peru/charges_pe'
|
|
40
|
+
require 'openpay/peru/cards_pe'
|
|
41
|
+
require 'openpay/peru/tokens_pe'
|
|
42
|
+
require 'openpay/peru/checkouts_pe'
|
|
43
|
+
require 'openpay/peru/webhooks_pe'
|
|
44
|
+
|
|
45
|
+
#misc
|
|
46
|
+
require 'openpay/utils/search_params'
|
|
47
|
+
|
|
48
|
+
#exceptions
|
|
49
|
+
require 'errors/openpay_exception_factory'
|
|
50
|
+
require 'errors/openpay_exception'
|
|
51
|
+
require 'errors/openpay_transaction_exception'
|
|
52
|
+
require 'errors/openpay_connection_exception'
|
|
53
|
+
|
|
54
|
+
include OpenpayUtils
|
|
55
|
+
end
|
data/lib/version.rb
ADDED
data/openpay.gemspec
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
|
|
5
|
+
require 'version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = "openpay_copemx"
|
|
9
|
+
spec.version = Openpay::VERSION
|
|
10
|
+
spec.authors = ["Openpay","ronnie_bermejo"]
|
|
11
|
+
spec.email = ["hola@openpay.mx"]
|
|
12
|
+
spec.description = %q{ruby client for Openpay API services (version 2.0.1)}
|
|
13
|
+
spec.summary = %q{ruby api for openpay resources}
|
|
14
|
+
spec.homepage = "http://openpay.mx/"
|
|
15
|
+
spec.license = "Apache-2.0"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files`.split($/)
|
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec)/})
|
|
20
|
+
spec.require_paths = ['lib','lib/openpay','openpay','.']
|
|
21
|
+
|
|
22
|
+
spec.add_runtime_dependency 'rest-client' , '~>2.0'
|
|
23
|
+
spec.add_runtime_dependency 'json', '>= 1.8'
|
|
24
|
+
|
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
|
26
|
+
spec.add_development_dependency 'rake'
|
|
27
|
+
spec.add_development_dependency 'json_spec'
|
|
28
|
+
spec.post_install_message = 'Thanks for installing openpay. Enjoy !'
|
|
29
|
+
|
|
30
|
+
end
|