epayco-sdk-ruby 1.0.0 → 1.0.4
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 +4 -4
- data/bin/epayco +1 -1
- data/lib/epayco/operations.rb +184 -172
- data/lib/epayco/resources.rb +58 -54
- data/lib/epayco-sdk-ruby.rb +2 -2
- data/lib/epayco.rb +238 -222
- data/lib/keylang.json +36 -26
- data/tests/test_helper.rb +123 -123
- data/tests/testing.rb +209 -209
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5fdea20dfc03d7d2f77eb62c941eac12addc85419781bd7ae5858f4c7801fb5
|
4
|
+
data.tar.gz: d9c8224aa718b3dee2d13f895b2eb1494a50ec8e64bedb63ee47aa3eb491a649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36630ff1b469337c61697659809cebb7959fb3c4bf3342dde65b48b507f93306ce4e2538d4a451355e6d483f8dccf177306cf7d80723e55492917641942f8e58
|
7
|
+
data.tar.gz: 7513632302083abdd219d1dd04f7f0bbf243e51fb7cd97cde9de387d80a534c3342021ff9f7ee403f60d3b65b8f86bf380f57ab69c3592cd9a2b09ac627728ff
|
data/bin/epayco
CHANGED
@@ -1 +1 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
1
|
+
#!/usr/bin/env ruby
|
data/lib/epayco/operations.rb
CHANGED
@@ -1,172 +1,184 @@
|
|
1
|
-
module Epayco
|
2
|
-
module Operations
|
3
|
-
module ClassMethods
|
4
|
-
|
5
|
-
private
|
6
|
-
|
7
|
-
# Action create
|
8
|
-
def create params={}, extra=nil
|
9
|
-
dt=false
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
url = "/
|
14
|
-
elsif self.url == "
|
15
|
-
url = "/
|
16
|
-
elsif self.url == "
|
17
|
-
url = "/recurring/v1/
|
18
|
-
elsif self.url == "
|
19
|
-
url = "/
|
20
|
-
elsif self.url == "
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
elsif extra == "gana"
|
32
|
-
url = "/restpagos/v2/efectivo/gana"
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
url = "/
|
60
|
-
elsif self.url == "
|
61
|
-
url = "/
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
params["
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
dt=false
|
159
|
-
if self.url == "subscriptions"
|
160
|
-
url = "/payment/v1/charge/subscription/create"
|
161
|
-
end
|
162
|
-
Epayco.request :post, url, extra, params, self.switch, cashdata,
|
163
|
-
end
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
1
|
+
module Epayco
|
2
|
+
module Operations
|
3
|
+
module ClassMethods
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
# Action create
|
8
|
+
def create params={}, extra=nil
|
9
|
+
dt=false
|
10
|
+
apify = false
|
11
|
+
cashdata = false
|
12
|
+
if self.url == "token"
|
13
|
+
url = "/v1/tokens"
|
14
|
+
elsif self.url == "customers"
|
15
|
+
url = "/payment/v1/customer/create"
|
16
|
+
elsif self.url == "plan"
|
17
|
+
url = "/recurring/v1/plan/create"
|
18
|
+
elsif self.url == "subscriptions"
|
19
|
+
url = "/recurring/v1/subscription/create"
|
20
|
+
elsif self.url == "bank"
|
21
|
+
url = "/restpagos/pagos/debitos.json"
|
22
|
+
elsif self.url == "safetypay"
|
23
|
+
apify = true
|
24
|
+
url = "/payment/process/safetypay"
|
25
|
+
elsif self.url == "cash"
|
26
|
+
cashdata = true
|
27
|
+
if extra == "efecty"
|
28
|
+
url = "/restpagos/v2/efectivo/efecty"
|
29
|
+
elsif extra == "baloto"
|
30
|
+
url = "/restpagos/v2/efectivo/baloto"
|
31
|
+
elsif extra == "gana"
|
32
|
+
url = "/restpagos/v2/efectivo/gana"
|
33
|
+
elsif extra == "redservi"
|
34
|
+
url = "/restpagos/v2/efectivo/redservi"
|
35
|
+
elsif extra == "puntored"
|
36
|
+
url = "/restpagos/v2/efectivo/puntored"
|
37
|
+
else
|
38
|
+
raise Error.new('109', Epayco.lang)
|
39
|
+
end
|
40
|
+
elsif self.url == "charge"
|
41
|
+
url = "/payment/v1/charge/create"
|
42
|
+
elsif self.url == "daviplata"
|
43
|
+
url = "/payment/process/daviplata"
|
44
|
+
apify = true
|
45
|
+
end
|
46
|
+
Epayco.request :post, url, extra, params, self.switch, cashdata, dt, apify
|
47
|
+
end
|
48
|
+
|
49
|
+
# Action retrieve from id
|
50
|
+
def get uid, params={}, extra=nil
|
51
|
+
switch = self.switch;
|
52
|
+
cashdata=false
|
53
|
+
dt=false
|
54
|
+
if self.url == "customers"
|
55
|
+
url = "/payment/v1/customer/" + Epayco.apiKey + "/" + uid + "/"
|
56
|
+
elsif self.url == "plan"
|
57
|
+
url = "/recurring/v1/plan/" + Epayco.apiKey + "/" + uid + "/"
|
58
|
+
elsif self.url == "subscriptions"
|
59
|
+
url = "/recurring/v1/subscription/" + uid + "/" + Epayco.apiKey + "/"
|
60
|
+
elsif self.url == "bank"
|
61
|
+
url = "/restpagos/pse/transactioninfomation.json?transactionID=" + uid + "&public_key=" + Epayco.apiKey
|
62
|
+
switch = true
|
63
|
+
elsif self.url == "cash" || self.url == "charge"
|
64
|
+
url = "/restpagos/transaction/response.json?ref_payco=" + uid + "&public_key=" + Epayco.apiKey
|
65
|
+
switch = true
|
66
|
+
end
|
67
|
+
Epayco.request :get, url, extra, params, switch, cashdata, dt, apify = false
|
68
|
+
end
|
69
|
+
|
70
|
+
# Action update
|
71
|
+
def update uid, params={}, extra=nil
|
72
|
+
cashdata=false
|
73
|
+
dt=false
|
74
|
+
if self.url == "customers"
|
75
|
+
url = "/payment/v1/customer/edit/" + Epayco.apiKey + "/" + uid + "/"
|
76
|
+
end
|
77
|
+
Epayco.request :post, url, extra, params, self.switch, cashdata, dt, apify = false
|
78
|
+
end
|
79
|
+
|
80
|
+
# Action update token
|
81
|
+
def updatetoken params={}, extra=nil
|
82
|
+
if self.url == "customers"
|
83
|
+
url = "/payment/v1/customer/reasign/card/default"
|
84
|
+
cashdata = false
|
85
|
+
dt = true
|
86
|
+
end
|
87
|
+
Epayco.request :post, url, extra, params, self.switch, cashdata, dt, apify = false
|
88
|
+
end
|
89
|
+
|
90
|
+
def delatetetoken params={}, extra=nil
|
91
|
+
if self.url == "customers"
|
92
|
+
url = "/v1/remove/token"
|
93
|
+
cashdata = false
|
94
|
+
dt = true
|
95
|
+
end
|
96
|
+
Epayco.request :post, url, extra, params, self.switch, cashdata, dt, apify = false
|
97
|
+
end
|
98
|
+
|
99
|
+
def addtoken params={}, extra=nil
|
100
|
+
if self.url == "customers"
|
101
|
+
url = "/v1/customer/add/token"
|
102
|
+
cashdata = false
|
103
|
+
dt = true
|
104
|
+
end
|
105
|
+
Epayco.request :post, url, extra, params, self.switch, cashdata, dt, apify = false
|
106
|
+
end
|
107
|
+
|
108
|
+
def getCustomer type, uid, extra=nil
|
109
|
+
if self.url == "customers"
|
110
|
+
url = "/payment/v1/customer/find?" + type + "=" + uid
|
111
|
+
puts url
|
112
|
+
cashdata = false
|
113
|
+
dt = true
|
114
|
+
end
|
115
|
+
Epayco.request :get, url, extra, {}, switch, cashdata, dt, apify = false
|
116
|
+
end
|
117
|
+
|
118
|
+
# Action retrieve all documents from user
|
119
|
+
def list params={}, extra=nil
|
120
|
+
cashdata=false
|
121
|
+
dt=false
|
122
|
+
if self.url == "customers"
|
123
|
+
url = "/payment/v1/customers/" + Epayco.apiKey + "/"
|
124
|
+
elsif self.url == "plan"
|
125
|
+
url = "/recurring/v1/plans/" + Epayco.apiKey + "/"
|
126
|
+
elsif self.url == "subscriptions"
|
127
|
+
url = "/recurring/v1/subscriptions/" + Epayco.apiKey
|
128
|
+
elsif self.url == "bank"
|
129
|
+
url = "/restpagos/pse/bancos.json?public_key=" + Epayco.apiKey
|
130
|
+
end
|
131
|
+
Epayco.request :get, url, extra, params, self.switch, cashdata, dt, apify = false
|
132
|
+
end
|
133
|
+
|
134
|
+
# Remove data from api
|
135
|
+
def delete uid, params={}, extra=nil
|
136
|
+
cashdata=false
|
137
|
+
dt=false
|
138
|
+
if self.url == "plan"
|
139
|
+
url = "/recurring/v1/plan/remove/" + Epayco.apiKey + "/" + uid
|
140
|
+
end
|
141
|
+
Epayco.request :post, url, extra, params, self.switch, cashdata, dt, apify = false
|
142
|
+
end
|
143
|
+
|
144
|
+
# Cance subscription
|
145
|
+
def cancel uid, params={}, extra=nil
|
146
|
+
cashdata=false
|
147
|
+
dt=false
|
148
|
+
params["id"] = uid
|
149
|
+
params["public_key"] = Epayco.apiKey
|
150
|
+
if self.url == "subscriptions"
|
151
|
+
url = "/recurring/v1/subscription/cancel"
|
152
|
+
end
|
153
|
+
Epayco.request :post, url, extra, params, self.switch, cashdata, dt, apify = false
|
154
|
+
end
|
155
|
+
|
156
|
+
def charge params={}, extra=nil
|
157
|
+
cashdata=false
|
158
|
+
dt=false
|
159
|
+
if self.url == "subscriptions"
|
160
|
+
url = "/payment/v1/charge/subscription/create"
|
161
|
+
end
|
162
|
+
Epayco.request :post, url, extra, params, self.switch, cashdata, dt, apify = false
|
163
|
+
end
|
164
|
+
|
165
|
+
def confirm params={}
|
166
|
+
cashdata=false
|
167
|
+
dt=false
|
168
|
+
apify=true
|
169
|
+
if self.url == "daviplata"
|
170
|
+
url = "/payment/confirm/daviplata"
|
171
|
+
end
|
172
|
+
Epayco.request :post, url, nil, params, self.switch, cashdata, dt, apify
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
# Export methods
|
180
|
+
def self.included(base)
|
181
|
+
base.extend(ClassMethods)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
data/lib/epayco/resources.rb
CHANGED
@@ -1,54 +1,58 @@
|
|
1
|
-
require_relative 'operations'
|
2
|
-
|
3
|
-
module Epayco
|
4
|
-
class Resource
|
5
|
-
include Operations
|
6
|
-
|
7
|
-
# Def url endpoint
|
8
|
-
def self.url id=nil
|
9
|
-
self.name.split('::').last.downcase
|
10
|
-
end
|
11
|
-
|
12
|
-
# Case switch secure or api
|
13
|
-
def self.switch
|
14
|
-
self.url == "bank" || self.url == "cash" ? true : false
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
# Resources and CRUD
|
21
|
-
|
22
|
-
class Token < Resource
|
23
|
-
public_class_method :create
|
24
|
-
end
|
25
|
-
|
26
|
-
class Customers < Resource
|
27
|
-
public_class_method :create, :get, :list, :update, :updatetoken, :delatetetoken, :addtoken
|
28
|
-
end
|
29
|
-
|
30
|
-
class Plan < Resource
|
31
|
-
public_class_method :create, :get, :list, :delete
|
32
|
-
end
|
33
|
-
|
34
|
-
class Subscriptions < Resource
|
35
|
-
public_class_method :create, :get, :list, :cancel, :charge
|
36
|
-
end
|
37
|
-
|
38
|
-
class Bank < Resource
|
39
|
-
public_class_method :create, :get
|
40
|
-
end
|
41
|
-
|
42
|
-
class Cash < Resource
|
43
|
-
public_class_method :create, :get
|
44
|
-
end
|
45
|
-
|
46
|
-
class Charge < Resource
|
47
|
-
public_class_method :create, :get
|
48
|
-
end
|
49
|
-
|
50
|
-
class Safetypay < Resource
|
51
|
-
public_class_method :create
|
52
|
-
end
|
53
|
-
|
54
|
-
|
1
|
+
require_relative 'operations'
|
2
|
+
|
3
|
+
module Epayco
|
4
|
+
class Resource
|
5
|
+
include Operations
|
6
|
+
|
7
|
+
# Def url endpoint
|
8
|
+
def self.url id=nil
|
9
|
+
self.name.split('::').last.downcase
|
10
|
+
end
|
11
|
+
|
12
|
+
# Case switch secure or api
|
13
|
+
def self.switch
|
14
|
+
self.url == "bank" || self.url == "cash" ? true : false
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
# Resources and CRUD
|
21
|
+
|
22
|
+
class Token < Resource
|
23
|
+
public_class_method :create
|
24
|
+
end
|
25
|
+
|
26
|
+
class Customers < Resource
|
27
|
+
public_class_method :create, :get, :list, :update, :updatetoken, :delatetetoken, :addtoken, :getCustomer
|
28
|
+
end
|
29
|
+
|
30
|
+
class Plan < Resource
|
31
|
+
public_class_method :create, :get, :list, :delete
|
32
|
+
end
|
33
|
+
|
34
|
+
class Subscriptions < Resource
|
35
|
+
public_class_method :create, :get, :list, :cancel, :charge
|
36
|
+
end
|
37
|
+
|
38
|
+
class Bank < Resource
|
39
|
+
public_class_method :create, :get, :list
|
40
|
+
end
|
41
|
+
|
42
|
+
class Cash < Resource
|
43
|
+
public_class_method :create, :get
|
44
|
+
end
|
45
|
+
|
46
|
+
class Charge < Resource
|
47
|
+
public_class_method :create, :get
|
48
|
+
end
|
49
|
+
|
50
|
+
class Safetypay < Resource
|
51
|
+
public_class_method :create
|
52
|
+
end
|
53
|
+
|
54
|
+
class Daviplata < Resource
|
55
|
+
public_class_method :create, :confirm
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
data/lib/epayco-sdk-ruby.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
# Describe global library
|
2
|
-
require File.dirname(__FILE__) + '/epayco'
|
1
|
+
# Describe global library
|
2
|
+
require File.dirname(__FILE__) + '/epayco'
|