epayco-sdk-ruby 1.0.0 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/tests/test_helper.rb CHANGED
@@ -1,123 +1,123 @@
1
-
2
- module Epayco
3
- @mock_rest_client = nil
4
-
5
- def self.mock_rest_client=(mock_client)
6
- @mock_rest_client = mock_client
7
- end
8
- end
9
-
10
- def credit_info
11
- {
12
- "card[number]" => "4575623182290326",
13
- "card[exp_year]" => "2017",
14
- "card[exp_month]" => "07",
15
- "card[cvc]" => "123"
16
- }
17
- end
18
-
19
- def customer_info
20
- {
21
- token_card: "eXj5Wdqgj7xzvC7AR",
22
- name: "Joe Doe",
23
- email: "joe@payco.co",
24
- phone: "3005234321",
25
- default: true
26
- }
27
- end
28
-
29
- def update_customer_info
30
- {
31
- name: "Juan"
32
- }
33
- end
34
-
35
- def plan_info
36
- {
37
- id_plan: "coursereact",
38
- name: "Course react js",
39
- description: "Course react and redux",
40
- amount: 30000,
41
- currency: "cop",
42
- interval: "month",
43
- interval_count: 1,
44
- trial_days: 30
45
- }
46
- end
47
-
48
- def subscription_info
49
- {
50
- id_plan: "coursereact",
51
- customer: "A6ZGiJ6rgxK5RB2WT",
52
- token_card: "eXj5Wdqgj7xzvC7AR",
53
- doc_type: "CC",
54
- doc_number: "5234567"
55
- }
56
- end
57
-
58
- def pse_info
59
- {
60
- bank: "1007",
61
- invoice: "1472050778",
62
- description: "Pago pruebas",
63
- value: "10000",
64
- tax: "0",
65
- tax_base: "0",
66
- currency: "COP",
67
- type_person: "0",
68
- doc_type: "CC",
69
- doc_number: "10358519",
70
- name: "PRUEBAS",
71
- last_name: "PAYCO",
72
- email: "no-responder@payco.co",
73
- country: "CO",
74
- cell_phone: "3010000001",
75
- ip: "186.116.10.133",
76
- url_response: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
77
- url_confirmation: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
78
- method_confirmation: "GET",
79
- }
80
- end
81
-
82
- def cash_info
83
- {
84
- invoice: "1472050778",
85
- description: "Pago pruebas",
86
- value: "20000",
87
- tax: "0",
88
- tax_base: "0",
89
- currency: "COP",
90
- type_person: "0",
91
- doc_type: "CC",
92
- doc_number: "10358519",
93
- name: "PRUEBAS",
94
- last_name: "PAYCO",
95
- email: "test@mailinator.com",
96
- cell_phone: "3010000001",
97
- end_date: "2017-12-05",
98
- ip: "186.116.10.133",
99
- url_response: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
100
- url_confirmation: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
101
- method_confirmation: "GET",
102
- }
103
- end
104
-
105
- def payment_info
106
- {
107
- token_card: "eXj5Wdqgj7xzvC7AR",
108
- customer_id: "A6ZGiJ6rgxK5RB2WT",
109
- doc_type: "CC",
110
- doc_number: "1035851980",
111
- name: "John",
112
- last_name: "Doe",
113
- email: "example@email.com",
114
- ip: "192.198.2.114",
115
- bill: "OR-1234",
116
- description: "Test Payment",
117
- value: "116000",
118
- tax: "16000",
119
- tax_base: "100000",
120
- currency: "COP",
121
- dues: "12"
122
- }
123
- end
1
+
2
+ module Epayco
3
+ @mock_rest_client = nil
4
+
5
+ def self.mock_rest_client=(mock_client)
6
+ @mock_rest_client = mock_client
7
+ end
8
+ end
9
+
10
+ def credit_info
11
+ {
12
+ "card[number]" => "4575623182290326",
13
+ "card[exp_year]" => "2017",
14
+ "card[exp_month]" => "07",
15
+ "card[cvc]" => "123"
16
+ }
17
+ end
18
+
19
+ def customer_info
20
+ {
21
+ token_card: "eXj5Wdqgj7xzvC7AR",
22
+ name: "Joe Doe",
23
+ email: "joe@payco.co",
24
+ phone: "3005234321",
25
+ default: true
26
+ }
27
+ end
28
+
29
+ def update_customer_info
30
+ {
31
+ name: "Juan"
32
+ }
33
+ end
34
+
35
+ def plan_info
36
+ {
37
+ id_plan: "coursereact",
38
+ name: "Course react js",
39
+ description: "Course react and redux",
40
+ amount: 30000,
41
+ currency: "cop",
42
+ interval: "month",
43
+ interval_count: 1,
44
+ trial_days: 30
45
+ }
46
+ end
47
+
48
+ def subscription_info
49
+ {
50
+ id_plan: "coursereact",
51
+ customer: "A6ZGiJ6rgxK5RB2WT",
52
+ token_card: "eXj5Wdqgj7xzvC7AR",
53
+ doc_type: "CC",
54
+ doc_number: "5234567"
55
+ }
56
+ end
57
+
58
+ def pse_info
59
+ {
60
+ bank: "1007",
61
+ invoice: "1472050778",
62
+ description: "Pago pruebas",
63
+ value: "10000",
64
+ tax: "0",
65
+ tax_base: "0",
66
+ currency: "COP",
67
+ type_person: "0",
68
+ doc_type: "CC",
69
+ doc_number: "10358519",
70
+ name: "PRUEBAS",
71
+ last_name: "PAYCO",
72
+ email: "no-responder@payco.co",
73
+ country: "CO",
74
+ cell_phone: "3010000001",
75
+ ip: "186.116.10.133",
76
+ url_response: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
77
+ url_confirmation: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
78
+ method_confirmation: "GET",
79
+ }
80
+ end
81
+
82
+ def cash_info
83
+ {
84
+ invoice: "1472050778",
85
+ description: "Pago pruebas",
86
+ value: "20000",
87
+ tax: "0",
88
+ tax_base: "0",
89
+ currency: "COP",
90
+ type_person: "0",
91
+ doc_type: "CC",
92
+ doc_number: "10358519",
93
+ name: "PRUEBAS",
94
+ last_name: "PAYCO",
95
+ email: "test@mailinator.com",
96
+ cell_phone: "3010000001",
97
+ end_date: "2017-12-05",
98
+ ip: "186.116.10.133",
99
+ url_response: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
100
+ url_confirmation: "https:/secure.payco.co/restpagos/testRest/endpagopse.php",
101
+ method_confirmation: "GET",
102
+ }
103
+ end
104
+
105
+ def payment_info
106
+ {
107
+ token_card: "eXj5Wdqgj7xzvC7AR",
108
+ customer_id: "A6ZGiJ6rgxK5RB2WT",
109
+ doc_type: "CC",
110
+ doc_number: "1035851980",
111
+ name: "John",
112
+ last_name: "Doe",
113
+ email: "example@email.com",
114
+ ip: "192.198.2.114",
115
+ bill: "OR-1234",
116
+ description: "Test Payment",
117
+ value: "116000",
118
+ tax: "16000",
119
+ tax_base: "100000",
120
+ currency: "COP",
121
+ dues: "12"
122
+ }
123
+ end
data/tests/testing.rb CHANGED
@@ -1,209 +1,209 @@
1
- require File.expand_path("../lib/epayco", File.dirname(__FILE__))
2
- require File.expand_path("test_helper", File.dirname(__FILE__))
3
-
4
- require "cutest"
5
- require "mocha/api"
6
- include Mocha::API
7
-
8
- prepare do
9
- Epayco.apiKey = '491d6a0b6e992cf924edd8d3d088aff1'
10
- Epayco.privateKey = '268c8e0162990cf2ce97fa7ade2eff5a'
11
- Epayco.lang = 'ES'
12
- Epayco.test = true
13
- end
14
-
15
- setup do
16
- Epayco.mock_rest_client = mock
17
- end
18
-
19
- test "create token" do |mock|
20
- begin
21
- token = Epayco::Token.create credit_info
22
- assert(token)
23
- rescue Epayco::Error => e
24
- puts e
25
- end
26
- end
27
-
28
- # Customers
29
-
30
- test "create customer" do |mock|
31
- begin
32
- customer = Epayco::Customers.create customer_info
33
- assert(customer)
34
- rescue Epayco::Error => e
35
- puts e
36
- end
37
- end
38
-
39
- test "retrieve customer" do |mock|
40
- begin
41
- customer = Epayco::Customers.get "123"
42
- assert(customer)
43
- rescue Epayco::Error => e
44
- puts e
45
- end
46
- end
47
-
48
- test "list customers" do |mock|
49
- begin
50
- customer = Epayco::Customers.list
51
- assert(customer)
52
- rescue Epayco::Error => e
53
- puts e
54
- end
55
- end
56
-
57
- test "update customer" do |mock|
58
- begin
59
- customer = Epayco::Customers.update "123", update_customer_info
60
- assert(customer)
61
- rescue Epayco::Error => e
62
- puts e
63
- end
64
- end
65
-
66
- # Plan
67
-
68
- test "create plan" do |mock|
69
- begin
70
- plan = Epayco::Plan.create plan_info
71
- assert(plan)
72
- rescue Epayco::Error => e
73
- puts e
74
- end
75
- end
76
-
77
- test "retrieve plan" do |mock|
78
- begin
79
- plan = Epayco::Plan.get "coursereact"
80
- assert(plan)
81
- rescue Epayco::Error => e
82
- puts e
83
- end
84
- end
85
-
86
- test "list plan" do |mock|
87
- begin
88
- plan = Epayco::Plan.list
89
- assert(plan)
90
- rescue Epayco::Error => e
91
- puts e
92
- end
93
- end
94
-
95
- test "remove plan" do |mock|
96
- begin
97
- plan = Epayco::Plan.delete "coursereact"
98
- assert(plan)
99
- rescue Epayco::Error => e
100
- puts e
101
- end
102
- end
103
-
104
- # Subscriptions
105
-
106
- test "create subscription" do |mock|
107
- begin
108
- sub = Epayco::Subscriptions.create subscription_info
109
- assert(sub)
110
- rescue Epayco::Error => e
111
- puts e
112
- end
113
- end
114
-
115
- test "charge subscription" do |mock|
116
- begin
117
- sub = Epayco::Subscriptions.charge subscription_info
118
- assert(sub)
119
- rescue Epayco::Error => e
120
- puts e
121
- end
122
- end
123
-
124
- test "retrieve subscriptions" do |mock|
125
- begin
126
- sub = Epayco::Subscriptions.get "123"
127
- assert(sub)
128
- rescue Epayco::Error => e
129
- puts e
130
- end
131
- end
132
-
133
- test "list subscriptions" do |mock|
134
- begin
135
- sub = Epayco::Subscriptions.list
136
- assert(sub)
137
- rescue Epayco::Error => e
138
- puts e
139
- end
140
- end
141
-
142
- test "cancel subscriptions" do |mock|
143
- begin
144
- sub = Epayco::Subscriptions.cancel "123"
145
- assert(sub)
146
- rescue Epayco::Error => e
147
- puts e
148
- end
149
- end
150
-
151
- # PSE
152
-
153
- test "create pse" do |mock|
154
- begin
155
- pse = Epayco::Bank.create pse_info
156
- assert(pse)
157
- rescue Epayco::Error => e
158
- puts e
159
- end
160
- end
161
-
162
- test "retrieve pse" do |mock|
163
- begin
164
- pse = Epayco::Bank.get "123"
165
- assert(pse)
166
- rescue Epayco::Error => e
167
- puts e
168
- end
169
- end
170
-
171
- # Cash
172
-
173
- test "create cash" do |mock|
174
- begin
175
- cash = Epayco::Cash.create cash_info, "efecty"
176
- assert(cash)
177
- rescue Epayco::Error => e
178
- puts e
179
- end
180
- end
181
-
182
- test "retrieve cash" do |mock|
183
- begin
184
- cash = Epayco::Cash.get "123"
185
- assert(cash)
186
- rescue Epayco::Error => e
187
- puts e
188
- end
189
- end
190
-
191
- # Payment
192
-
193
- test "create payment" do |mock|
194
- begin
195
- pay = Epayco::Charge.create payment_info
196
- assert(pay)
197
- rescue Epayco::Error => e
198
- puts e
199
- end
200
- end
201
-
202
- test "retrieve payment" do |mock|
203
- begin
204
- pay = Epayco::Charge.get "123"
205
- assert(pay)
206
- rescue Epayco::Error => e
207
- puts e
208
- end
209
- end
1
+ require File.expand_path("../lib/epayco", File.dirname(__FILE__))
2
+ require File.expand_path("test_helper", File.dirname(__FILE__))
3
+
4
+ require "cutest"
5
+ require "mocha/api"
6
+ include Mocha::API
7
+
8
+ prepare do
9
+ Epayco.apiKey = '491d6a0b6e992cf924edd8d3d088aff1'
10
+ Epayco.privateKey = '268c8e0162990cf2ce97fa7ade2eff5a'
11
+ Epayco.lang = 'ES'
12
+ Epayco.test = true
13
+ end
14
+
15
+ setup do
16
+ Epayco.mock_rest_client = mock
17
+ end
18
+
19
+ test "create token" do |mock|
20
+ begin
21
+ token = Epayco::Token.create credit_info
22
+ assert(token)
23
+ rescue Epayco::Error => e
24
+ puts e
25
+ end
26
+ end
27
+
28
+ # Customers
29
+
30
+ test "create customer" do |mock|
31
+ begin
32
+ customer = Epayco::Customers.create customer_info
33
+ assert(customer)
34
+ rescue Epayco::Error => e
35
+ puts e
36
+ end
37
+ end
38
+
39
+ test "retrieve customer" do |mock|
40
+ begin
41
+ customer = Epayco::Customers.get "123"
42
+ assert(customer)
43
+ rescue Epayco::Error => e
44
+ puts e
45
+ end
46
+ end
47
+
48
+ test "list customers" do |mock|
49
+ begin
50
+ customer = Epayco::Customers.list
51
+ assert(customer)
52
+ rescue Epayco::Error => e
53
+ puts e
54
+ end
55
+ end
56
+
57
+ test "update customer" do |mock|
58
+ begin
59
+ customer = Epayco::Customers.update "123", update_customer_info
60
+ assert(customer)
61
+ rescue Epayco::Error => e
62
+ puts e
63
+ end
64
+ end
65
+
66
+ # Plan
67
+
68
+ test "create plan" do |mock|
69
+ begin
70
+ plan = Epayco::Plan.create plan_info
71
+ assert(plan)
72
+ rescue Epayco::Error => e
73
+ puts e
74
+ end
75
+ end
76
+
77
+ test "retrieve plan" do |mock|
78
+ begin
79
+ plan = Epayco::Plan.get "coursereact"
80
+ assert(plan)
81
+ rescue Epayco::Error => e
82
+ puts e
83
+ end
84
+ end
85
+
86
+ test "list plan" do |mock|
87
+ begin
88
+ plan = Epayco::Plan.list
89
+ assert(plan)
90
+ rescue Epayco::Error => e
91
+ puts e
92
+ end
93
+ end
94
+
95
+ test "remove plan" do |mock|
96
+ begin
97
+ plan = Epayco::Plan.delete "coursereact"
98
+ assert(plan)
99
+ rescue Epayco::Error => e
100
+ puts e
101
+ end
102
+ end
103
+
104
+ # Subscriptions
105
+
106
+ test "create subscription" do |mock|
107
+ begin
108
+ sub = Epayco::Subscriptions.create subscription_info
109
+ assert(sub)
110
+ rescue Epayco::Error => e
111
+ puts e
112
+ end
113
+ end
114
+
115
+ test "charge subscription" do |mock|
116
+ begin
117
+ sub = Epayco::Subscriptions.charge subscription_info
118
+ assert(sub)
119
+ rescue Epayco::Error => e
120
+ puts e
121
+ end
122
+ end
123
+
124
+ test "retrieve subscriptions" do |mock|
125
+ begin
126
+ sub = Epayco::Subscriptions.get "123"
127
+ assert(sub)
128
+ rescue Epayco::Error => e
129
+ puts e
130
+ end
131
+ end
132
+
133
+ test "list subscriptions" do |mock|
134
+ begin
135
+ sub = Epayco::Subscriptions.list
136
+ assert(sub)
137
+ rescue Epayco::Error => e
138
+ puts e
139
+ end
140
+ end
141
+
142
+ test "cancel subscriptions" do |mock|
143
+ begin
144
+ sub = Epayco::Subscriptions.cancel "123"
145
+ assert(sub)
146
+ rescue Epayco::Error => e
147
+ puts e
148
+ end
149
+ end
150
+
151
+ # PSE
152
+
153
+ test "create pse" do |mock|
154
+ begin
155
+ pse = Epayco::Bank.create pse_info
156
+ assert(pse)
157
+ rescue Epayco::Error => e
158
+ puts e
159
+ end
160
+ end
161
+
162
+ test "retrieve pse" do |mock|
163
+ begin
164
+ pse = Epayco::Bank.get "123"
165
+ assert(pse)
166
+ rescue Epayco::Error => e
167
+ puts e
168
+ end
169
+ end
170
+
171
+ # Cash
172
+
173
+ test "create cash" do |mock|
174
+ begin
175
+ cash = Epayco::Cash.create cash_info, "efecty"
176
+ assert(cash)
177
+ rescue Epayco::Error => e
178
+ puts e
179
+ end
180
+ end
181
+
182
+ test "retrieve cash" do |mock|
183
+ begin
184
+ cash = Epayco::Cash.get "123"
185
+ assert(cash)
186
+ rescue Epayco::Error => e
187
+ puts e
188
+ end
189
+ end
190
+
191
+ # Payment
192
+
193
+ test "create payment" do |mock|
194
+ begin
195
+ pay = Epayco::Charge.create payment_info
196
+ assert(pay)
197
+ rescue Epayco::Error => e
198
+ puts e
199
+ end
200
+ end
201
+
202
+ test "retrieve payment" do |mock|
203
+ begin
204
+ pay = Epayco::Charge.get "123"
205
+ assert(pay)
206
+ rescue Epayco::Error => e
207
+ puts e
208
+ end
209
+ end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epayco-sdk-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Epayco development team
8
8
  - Ricardo Saldarriaga
9
+ - Gerson Vasquez
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2020-09-29 00:00:00.000000000 Z
13
+ date: 2023-03-22 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rest-client
@@ -72,6 +73,7 @@ description: |-
72
73
  https://epayco.co
73
74
  email:
74
75
  - ricardo.saldarriaga@payco.co
76
+ - gerson.vasquez@epayco.com
75
77
  executables:
76
78
  - epayco
77
79
  extensions: []
@@ -104,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
106
  - !ruby/object:Gem::Version
105
107
  version: '0'
106
108
  requirements: []
107
- rubygems_version: 3.0.3
109
+ rubygems_version: 3.2.3
108
110
  signing_key:
109
111
  specification_version: 4
110
112
  summary: Ruby wrapper for Epayco API