openpay 2.0.0b → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -6
- data/README.md +23 -23
- data/lib/version.rb +1 -1
- data/test/spec/payouts_spec.rb +1 -1
- data/test/spec_helper.rb +3 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a22ce596621980aa6b15088827a8e6a9a7be7cdb
|
4
|
+
data.tar.gz: 1e27c6b1bae5142a251dd7ef0cb26b9b27b0c71d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d38b9cf2b04fbb0bc71cf2b179eb3ef52493c9fbf1eb7e2262807f5dc719498073ccdbadca882442b4c807ca4dd10eb3f54ceb8e07cac84e51078558e9c5c55
|
7
|
+
data.tar.gz: 30ff4773a4e83401ef47a2f94eb96ea7de52bf3f97b8426206f07448bcc3e6d88a29b3428dcbd0339a174849b5a2926ed4c1646c6c9995cb1566785f300ff217
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/openpay.svg)](http://badge.fury.io/rb/openpay)
|
6
6
|
|
7
|
-
##Description
|
7
|
+
## Description
|
8
8
|
|
9
|
-
ruby client for *Openpay api* services (version
|
9
|
+
ruby client for *Openpay api* services (version 2.0)
|
10
10
|
|
11
11
|
This is a ruby client implementing the payment services for *Openpay* at openpay.mx
|
12
12
|
|
@@ -31,9 +31,9 @@ Or install it from the command line:
|
|
31
31
|
|
32
32
|
$ gem install openpay
|
33
33
|
|
34
|
-
###Requirements
|
34
|
+
### Requirements
|
35
35
|
|
36
|
-
* ruby
|
36
|
+
* ruby 2.4 or higher
|
37
37
|
|
38
38
|
## Usage
|
39
39
|
|
@@ -135,15 +135,15 @@ Methods without inputs will return a ruby hash.
|
|
135
135
|
```ruby
|
136
136
|
it 'creates a fee using a json message' do
|
137
137
|
#create new customer
|
138
|
-
customer_hash=
|
138
|
+
customer_hash= FactoryBot.build(:customer)
|
139
139
|
customer=@customers.create(customer_hash)
|
140
140
|
|
141
141
|
#create customer card , using factory girl to build the hash for us
|
142
|
-
card_hash=
|
142
|
+
card_hash=FactoryBot.build(:valid_card)
|
143
143
|
card=@cards.create(card_hash, customer['id'])
|
144
144
|
|
145
145
|
#create charge
|
146
|
-
charge_hash=
|
146
|
+
charge_hash=FactoryBot.build(:card_charge, source_id: card['id'], order_id: card['id'], amount: 4000)
|
147
147
|
charge=@charges.create(charge_hash, customer['id'])
|
148
148
|
|
149
149
|
#create customer fee , using json as input, we get json as ouput
|
@@ -175,14 +175,14 @@ pp card_hash =>
|
|
175
175
|
:city=>"Queretaro"}}
|
176
176
|
```
|
177
177
|
|
178
|
-
Next, how we construct the preceding hash using **
|
179
|
-
**
|
178
|
+
Next, how we construct the preceding hash using **FactoryBot**.
|
179
|
+
**FactoryBot** was used in our test suite to facilitate hash construction.
|
180
180
|
It may help you as well at your final implementation if you decide to use hashes.
|
181
181
|
(more examples at *test/Factories.rb*)
|
182
182
|
|
183
183
|
```ruby
|
184
184
|
|
185
|
-
|
185
|
+
FactoryBot.define do
|
186
186
|
factory :valid_card, class:Hash do
|
187
187
|
bank_name 'visa'
|
188
188
|
holder_name 'Vicente Olmos'
|
@@ -204,7 +204,7 @@ FactoryGirl.define do
|
|
204
204
|
end
|
205
205
|
```
|
206
206
|
|
207
|
-
###Methods design
|
207
|
+
### Methods design
|
208
208
|
|
209
209
|
This ruby API standardize the method names across all different resources using the **create**,**get**,**update** and **delete** verbs.
|
210
210
|
|
@@ -213,14 +213,14 @@ For full method documentation take a look at:
|
|
213
213
|
|
214
214
|
The test suite at *test/spec* is a good source of reference.
|
215
215
|
|
216
|
-
#####create
|
216
|
+
##### create
|
217
217
|
|
218
218
|
Creates the given resource
|
219
219
|
```ruby
|
220
220
|
open_pay_resource.create(representation,customer_id=nil)
|
221
221
|
```
|
222
222
|
|
223
|
-
#####get
|
223
|
+
##### get
|
224
224
|
|
225
225
|
Gets an instance of a given resource
|
226
226
|
|
@@ -228,7 +228,7 @@ The test suite at *test/spec* is a good source of reference.
|
|
228
228
|
open_pay_resource.get(object_id,customer_id=nil)
|
229
229
|
```
|
230
230
|
|
231
|
-
#####update
|
231
|
+
##### update
|
232
232
|
|
233
233
|
Updates an instance of a given resource
|
234
234
|
|
@@ -236,7 +236,7 @@ open_pay_resource.get(object_id,customer_id=nil)
|
|
236
236
|
open_pay_resource.update(representation,customer_id=nil)
|
237
237
|
```
|
238
238
|
|
239
|
-
#####delete
|
239
|
+
##### delete
|
240
240
|
|
241
241
|
Deletes an instance of the given resource
|
242
242
|
|
@@ -250,13 +250,13 @@ open_pay_resource.delete(object_id,customer_id=nil)
|
|
250
250
|
open_pay_resource.all(customer_id=nil)
|
251
251
|
```
|
252
252
|
|
253
|
-
#####each
|
253
|
+
##### each
|
254
254
|
Returns a block for each instance resource
|
255
255
|
```ruby
|
256
256
|
open_pay_resource.each(customer_id=nil)
|
257
257
|
```
|
258
258
|
|
259
|
-
#####delete_all(available only under the development environment)
|
259
|
+
##### delete_all(available only under the development environment)
|
260
260
|
|
261
261
|
Deletes all instances of the given resource
|
262
262
|
|
@@ -266,7 +266,7 @@ open_pay_resource.delete_all(customer_id=nil)
|
|
266
266
|
```
|
267
267
|
|
268
268
|
|
269
|
-
###API Methods
|
269
|
+
### API Methods
|
270
270
|
|
271
271
|
|
272
272
|
#### bank_accounts
|
@@ -722,7 +722,7 @@ This API generates 3 different Exception classes.
|
|
722
722
|
|
723
723
|
```ruby
|
724
724
|
email='foo'
|
725
|
-
customer_hash =
|
725
|
+
customer_hash = FactoryBot.build(:customer, email: email)
|
726
726
|
begin
|
727
727
|
customers.create(customer_hash)
|
728
728
|
rescue OpenpayTransactionException => e
|
@@ -745,7 +745,7 @@ rescue OpenpayApiTransactionError => e
|
|
745
745
|
end
|
746
746
|
```
|
747
747
|
|
748
|
-
###These exceptions have the following attributes:
|
748
|
+
### These exceptions have the following attributes:
|
749
749
|
|
750
750
|
- *category*
|
751
751
|
- *description*
|
@@ -758,17 +758,17 @@ For more information about categories, descriptions and codes take a look at:
|
|
758
758
|
- http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
759
759
|
|
760
760
|
|
761
|
-
##Debug
|
761
|
+
## Debug
|
762
762
|
|
763
763
|
In the Openpay dashboard you are able to see every request and its corresponding request/response.
|
764
764
|
- https://sandbox-dashboard.openpay.mx
|
765
765
|
|
766
|
-
##Developer Notes
|
766
|
+
## Developer Notes
|
767
767
|
|
768
768
|
- bank accounts for merchant cannot be created using the api. It should be done through the dashboard.
|
769
769
|
- Is recommended to reset your account using the dashboard when running serious testing (assure clean state)
|
770
770
|
- check openpay_api.rb for Logger configuration
|
771
|
-
- travis https://travis-ci.org/open-pay/openpay-ruby , if a test fails it will leave
|
771
|
+
- travis https://travis-ci.org/open-pay/openpay-ruby , if a test fails it will leave some records, it may affect posterior tests.
|
772
772
|
it is recommended to reset the console/account to assure a clean state after a failure occurs.
|
773
773
|
|
774
774
|
## More information
|
data/lib/version.rb
CHANGED
data/test/spec/payouts_spec.rb
CHANGED
data/test/spec_helper.rb
CHANGED
@@ -4,7 +4,8 @@ $: << 'lib/openpay'
|
|
4
4
|
|
5
5
|
require 'openpay'
|
6
6
|
require 'factory_bot'
|
7
|
-
#
|
7
|
+
#uncomment below to test on travis-ci
|
8
|
+
FactoryBot.find_definitions
|
8
9
|
require 'test/Factories'
|
9
10
|
require 'rspec'
|
10
11
|
require 'json_spec'
|
@@ -12,6 +13,7 @@ require 'json_spec'
|
|
12
13
|
RSpec.configure do |config|
|
13
14
|
config.include FactoryBot::Syntax::Methods
|
14
15
|
|
16
|
+
#uncomment below to test on local
|
15
17
|
#config.before(:suite) {FactoryBot.reload}
|
16
18
|
|
17
19
|
config.expect_with :rspec do |c|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Openpay
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-12-
|
12
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -171,9 +171,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
171
|
version: '0'
|
172
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
|
-
- - "
|
174
|
+
- - ">="
|
175
175
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
176
|
+
version: '0'
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project:
|
179
179
|
rubygems_version: 2.6.14
|