conekta 2.0.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +133 -0
- data/Gemfile +4 -0
- data/README.md +71 -17
- data/conekta.gemspec +5 -5
- data/lib/conekta.rb +3 -1
- data/lib/conekta/card.rb +3 -12
- data/lib/conekta/charge.rb +4 -2
- data/lib/conekta/checkout.rb +35 -0
- data/lib/conekta/conekta_object.rb +2 -1
- data/lib/conekta/customer.rb +4 -0
- data/lib/conekta/destination.rb +3 -15
- data/lib/conekta/discount_line.rb +1 -14
- data/lib/conekta/error.rb +49 -17
- data/lib/conekta/error_details.rb +14 -0
- data/lib/conekta/line_item.rb +1 -14
- data/lib/conekta/order.rb +18 -18
- data/lib/conekta/payee.rb +40 -4
- data/lib/conekta/payment_source.rb +2 -15
- data/lib/conekta/payout_method.rb +4 -12
- data/lib/conekta/requestor.rb +3 -8
- data/lib/conekta/resource.rb +24 -12
- data/lib/conekta/return.rb +1 -14
- data/lib/conekta/shipping_contact.rb +1 -14
- data/lib/conekta/shipping_line.rb +1 -14
- data/lib/conekta/subscription.rb +2 -12
- data/lib/conekta/tax_line.rb +1 -12
- data/lib/conekta/transfer.rb +7 -0
- data/lib/conekta/util.rb +2 -0
- data/lib/conekta/version.rb +1 -1
- data/lib/ssl_data/ca_bundle.crt +3891 -2
- data/readme_files/banner.png +0 -0
- data/readme_files/conekta-badge.png +0 -0
- data/readme_files/ruby-badge.png +0 -0
- data/spec/conekta/1.0.0/charge_spec.rb +17 -0
- data/spec/conekta/2.0.0/checkout_spec.rb +224 -0
- data/spec/conekta/2.0.0/customer_spec.rb +30 -2
- data/spec/conekta/2.0.0/discount_line_spec.rb +1 -1
- data/spec/conekta/2.0.0/error_spec.rb +61 -0
- data/spec/conekta/2.0.0/line_item_spec.rb +1 -1
- data/spec/conekta/2.0.0/order_spec.rb +132 -44
- data/spec/conekta/2.0.0/payee_spec.rb +9 -10
- data/spec/conekta/2.0.0/shipping_contact_spec.rb +1 -1
- data/spec/conekta/2.0.0/shipping_line_spec.rb +1 -1
- data/spec/conekta/2.0.0/source_spec.rb +1 -1
- data/spec/conekta/2.0.0/tax_line_spec.rb +1 -1
- data/spec/conekta/2.0.0/transfer_spec.rb +59 -0
- data/spec/spec_helper.rb +2 -12
- data/spec/support/fixtures/orders.json +1082 -2024
- metadata +23 -17
- data/CHANGELOG +0 -98
- data/lib/conekta/error_list.rb +0 -33
- data/lib/conekta/fiscal_entity.rb +0 -37
- data/readme_files/cover.png +0 -0
- data/spec/conekta/2.0.0/error_list_spec.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3092b915bd4a4f22b5f6f25a3a429a9c5e7336c8fc059df11fe682cfd4400444
|
4
|
+
data.tar.gz: 223d90156fe51093ba049abc9c476811c4d2c6017db3625ad30b05f0d55cda02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44a9c41e5590e9ff92a77bbe17c3349d72e0d17669edfda2875e6ff1588cdababa9aa86b4a7cca634ff0acf8f0e185de47451d0be9fa43b3706c43dade91ca87
|
7
|
+
data.tar.gz: '08ea5f89a3edd5120631d744d45dbc168d0c7641975ed935df09db69cbdd1122fda8db31b542ae170f05eed3ee2d33499a3f358f372f30ac8dbdac73775b3729'
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
## [2.5.0](https://github.com/conekta/conekta-ruby/releases/tag/2.5.0) - 2020-11-22
|
2
|
+
### Payment link
|
3
|
+
- Add models to support payment link (aka checkout).
|
4
|
+
|
5
|
+
## [2.4.2](https://github.com/conekta/conekta-ruby/releases/tag/2.4.2) - 2020-01-22
|
6
|
+
### Ruby 2.7 Cleanup
|
7
|
+
- Corrects warnings related to translate in Ruby 2.7
|
8
|
+
- Corrects a spec which had a hard coded `expires_at` field
|
9
|
+
|
10
|
+
## [2.4.0](https://github.com/conekta/conekta-ruby/releases/tag/2.4.0) - 2017-10-05
|
11
|
+
### Added oxxo recurrent support
|
12
|
+
- Added new method create_offline_recurrent_reference.
|
13
|
+
|
14
|
+
## [2.3.0](https://github.com/conekta/conekta-ruby/releases/tag/2.3.0) - 2017-10-05
|
15
|
+
### Fix
|
16
|
+
- Capture allow pass amount in api v1
|
17
|
+
|
18
|
+
## [2.2.0](https://github.com/conekta/conekta-ruby/releases/tag/2.2.0) - 2017-10-05
|
19
|
+
### Fix
|
20
|
+
- Payee module implementation for api 2
|
21
|
+
|
22
|
+
## [2.1.0](https://github.com/conekta/conekta-ruby/releases/tag/2.1.0) - 2017-10-05
|
23
|
+
### Change
|
24
|
+
- Error list refactor and byebug implementation
|
25
|
+
|
26
|
+
## [2.0.1](https://github.com/conekta/conekta-ruby/releases/tag/2.0.1) - 2017-02-15
|
27
|
+
### Feature
|
28
|
+
- Order model, submodels and methods as well as enhanced Errors and lists
|
29
|
+
|
30
|
+
## [2.0.0](https://github.com/conekta/conekta-ruby/releases/tag/2.0.0) - 2017-02-13
|
31
|
+
### Update
|
32
|
+
- Update vertical info to antifraud info
|
33
|
+
|
34
|
+
## [1.1.3]() - 2017-02-08
|
35
|
+
### Change
|
36
|
+
- Change vertical_info to antifraud_info
|
37
|
+
|
38
|
+
## [1.1.2]() - 2017-02-08
|
39
|
+
### Change
|
40
|
+
- Avoid class name conflicts
|
41
|
+
|
42
|
+
## [1.1.1](https://github.com/conekta/conekta-ruby/releases/tag/1.1.1) - 2017-02-01
|
43
|
+
### Fix
|
44
|
+
- Fix submodels updates
|
45
|
+
|
46
|
+
## [1.1.0]() - 2017-01-24
|
47
|
+
### Update
|
48
|
+
- Version bump
|
49
|
+
|
50
|
+
## [1.0.0]() - 2017-01-24
|
51
|
+
###
|
52
|
+
- Add support for API 2.0.0
|
53
|
+
|
54
|
+
## [0.5.8]() - 2016-07-19
|
55
|
+
### Feature
|
56
|
+
- Add new models for parsing
|
57
|
+
|
58
|
+
## [0.5.7]() - 2016-07-19
|
59
|
+
### Fix
|
60
|
+
- Fix parameter handling for get requests
|
61
|
+
|
62
|
+
## [0.5.6]() - 2015-12-29
|
63
|
+
### Change
|
64
|
+
- Change parameter serialization using request body instead of connection params
|
65
|
+
|
66
|
+
## [0.5.5]() - 2015-12-01
|
67
|
+
### Feature
|
68
|
+
- Add find method to Event class
|
69
|
+
|
70
|
+
## [0.5.4]() - 2015-09-08
|
71
|
+
### Feature
|
72
|
+
- Update ConektaObject with the attribute 'values'
|
73
|
+
|
74
|
+
## [0.5.3]() - 2015-08-13
|
75
|
+
### Change
|
76
|
+
- Refactorization
|
77
|
+
|
78
|
+
## [0.5.2](https://github.com/conekta/conekta-ruby/releases/tag/v0.5.2) - 2015-02-13
|
79
|
+
### Change
|
80
|
+
- Change rspec dependency to development
|
81
|
+
|
82
|
+
## [0.5.0]() - 2015-01-20
|
83
|
+
### Feature
|
84
|
+
- Add Webhook module
|
85
|
+
|
86
|
+
## [0.4.9]() - 2014-07-08
|
87
|
+
### Change
|
88
|
+
- Update API version to 1.0.0
|
89
|
+
|
90
|
+
## [0.4.6](https://github.com/conekta/conekta-ruby/releases/tag/v0.4.6) - 2014-07-08
|
91
|
+
### Feature
|
92
|
+
- Add message_to_purchaser internal errors
|
93
|
+
|
94
|
+
## [0.4.5](https://github.com/conekta/conekta-ruby/releases/tag/v0.4.5) - 2014-07-08
|
95
|
+
### Feature
|
96
|
+
- Sprinkling small Ruby style conventions here and there (antillas21)
|
97
|
+
|
98
|
+
## [0.4.4](https://github.com/conekta/conekta-ruby/releases/tag/v0.4.4) - 2014-06-04
|
99
|
+
### Fix
|
100
|
+
- Fix requestor and where method
|
101
|
+
|
102
|
+
## [0.4.3](https://github.com/conekta/conekta-ruby/releases/tag/v0.4.3) - 2014-05-25
|
103
|
+
### Feature
|
104
|
+
- Add locale and message_to_purchaser
|
105
|
+
|
106
|
+
## [0.4.2]() - 2014-04-28
|
107
|
+
### Fix
|
108
|
+
- Fix Payout specs
|
109
|
+
|
110
|
+
## [0.4.1](https://github.com/conekta/conekta-ruby/releases/tag/v0.4.1) - 2014-04-16
|
111
|
+
### Remove
|
112
|
+
- Remove active support and add custom methods in util file
|
113
|
+
|
114
|
+
## [0.4.0](https://github.com/conekta/conekta-ruby/releases/tag/v0.4.0) - 2014-04-16
|
115
|
+
### Feature
|
116
|
+
- Add payout and payee models with specs
|
117
|
+
- Add webhook logs for events
|
118
|
+
- Ameliorate convert_to_conekta_object logic
|
119
|
+
|
120
|
+
## [0.3.7](https://github.com/conekta/conekta-ruby/releases/tag/v0.3.7) - 2013-01-27
|
121
|
+
### Feature
|
122
|
+
- Added api_version setter
|
123
|
+
|
124
|
+
## [0.3.6](https://github.com/conekta/conekta-ruby/releases/tag/v0.3.6) - 2013-01-17
|
125
|
+
### Fix
|
126
|
+
- Fix cert path
|
127
|
+
|
128
|
+
## [0.3.5]() - 2013-01-13
|
129
|
+
### Deprecate
|
130
|
+
- Deprecate retrieve and all methods and replaced them with find and where respectively
|
131
|
+
### Feature
|
132
|
+
- Add payment method model
|
133
|
+
- Objects' properties are now accessible via methods of the same of name
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,19 @@
|
|
1
|
-
|
1
|
+
<div align="center">
|
2
2
|
|
3
|
-
|
3
|
+
![banner](readme_files/banner.png)
|
4
4
|
|
5
|
-
|
5
|
+
# Conekta Ruby
|
6
|
+
|
7
|
+
![ruby badge](readme_files/ruby-badge.png)
|
8
|
+
![conekta badge](readme_files/conekta-badge.png)
|
9
|
+
|
10
|
+
</div>
|
11
|
+
|
12
|
+
This is a [Ruby](https://www.ruby-lang.org/) library that allows interaction with [Conekta's API](https://api.conekta.io).
|
13
|
+
|
14
|
+
## Requeriments
|
15
|
+
|
16
|
+
Add them!
|
6
17
|
|
7
18
|
## Installation
|
8
19
|
|
@@ -12,17 +23,17 @@ Add this line to your application's Gemfile:
|
|
12
23
|
|
13
24
|
And then execute:
|
14
25
|
|
15
|
-
|
26
|
+
bundle
|
16
27
|
|
17
28
|
Or install it yourself as:
|
18
29
|
|
19
|
-
|
30
|
+
gem install conekta
|
20
31
|
|
21
32
|
## Usage
|
22
33
|
```ruby
|
23
34
|
# Set your configuration variables
|
24
35
|
|
25
|
-
# This
|
36
|
+
# This changes the Accept-Language Header to the locale specified
|
26
37
|
Conekta.locale = :es
|
27
38
|
|
28
39
|
Conekta.api_key = '1tv5yJp3xnVZ7eK67m4h'
|
@@ -37,8 +48,8 @@ end
|
|
37
48
|
begin
|
38
49
|
order = Conekta::Order.create(order_data_with_charges.
|
39
50
|
merge(customer_info: customer_info))
|
40
|
-
rescue Conekta::
|
41
|
-
for error_detail in
|
51
|
+
rescue Conekta::Error => error
|
52
|
+
for error_detail in error.details do
|
42
53
|
puts error_detail.message
|
43
54
|
end
|
44
55
|
end
|
@@ -101,19 +112,20 @@ end
|
|
101
112
|
}
|
102
113
|
```
|
103
114
|
|
104
|
-
|
105
|
-
|
106
|
-
|
115
|
+
## Documentation
|
116
|
+
|
117
|
+
Please visit the [official API reference](https://developers.conekta.com/api) for an up-to-date documentation.
|
107
118
|
|
108
119
|
Development and Testing
|
109
120
|
-----------------------
|
110
|
-
Feel free to play with our library and make pull requests if you find any bugs.
|
121
|
+
Feel free to play with our library and make pull requests if you find any bugs.
|
122
|
+
You can run the test suite with [rspec](https://github.com/rspec/rspec-rails) from the library's root directory:
|
111
123
|
|
112
124
|
```shell
|
113
125
|
bundle exec rspec
|
114
126
|
```
|
115
127
|
|
116
|
-
To facilitate the development and testing process you can use one our
|
128
|
+
To facilitate the development and testing process you can use one of our Docker containers that come with [RVM](https://github.com/rvm/rvm) and [Ruby](https://www.ruby-lang.org/) versions 1.9.3, 2.1.9, 2.2.4 and 2.3.0:
|
117
129
|
|
118
130
|
```shell
|
119
131
|
docker pull conekta/conekta-ruby
|
@@ -121,8 +133,50 @@ docker pull conekta/conekta-ruby
|
|
121
133
|
docker run -ti conekta/conekta-ruby /bin/bash --login
|
122
134
|
```
|
123
135
|
|
124
|
-
|
125
|
-
|
136
|
+
***
|
137
|
+
|
138
|
+
## How to contribute to the project
|
139
|
+
|
140
|
+
1. Fork the repository
|
141
|
+
|
142
|
+
2. Clone the repository
|
143
|
+
```
|
144
|
+
git clone git@github.com:yourUserName/conekta-ruby.git
|
145
|
+
```
|
146
|
+
3. Create a branch
|
147
|
+
```
|
148
|
+
git checkout develop
|
149
|
+
git pull origin develop
|
150
|
+
# You should choose the name of your branch
|
151
|
+
git checkout -b <feature/my_branch>
|
152
|
+
```
|
153
|
+
4. Make necessary changes and commit those changes
|
154
|
+
```
|
155
|
+
git add .
|
156
|
+
git commit -m "my changes"
|
157
|
+
```
|
158
|
+
5. Push changes to GitHub
|
159
|
+
```
|
160
|
+
git push origin <feature/my_branch>
|
161
|
+
```
|
162
|
+
6. Submit your changes for review, create a pull request
|
163
|
+
|
164
|
+
To create a pull request, you need to have made your code changes on a separate branch. This branch should be named like this: **feature/my_feature** or **fix/my_fix**.
|
165
|
+
|
166
|
+
Make sure that, if you add new features to our library, be sure that corresponding **unit tests** are added.
|
167
|
+
|
168
|
+
If you go to your repository on GitHub, you’ll see a Compare & pull request button. Click on that button.
|
169
|
+
|
170
|
+
***
|
171
|
+
|
172
|
+
## We are always hiring!
|
173
|
+
|
174
|
+
If you are a comfortable working with a range of backend languages (Java, Python, Ruby, PHP, etc) and frameworks, you have solid foundation in data structures, algorithms and software design with strong analytical and debugging skills, check our open positions: https://www.conekta.com/careers
|
175
|
+
|
176
|
+
### License
|
177
|
+
|
178
|
+
<div align="center">
|
179
|
+
|
180
|
+
Developed in :mexico: Mexico by [Conekta](https://www.conekta.com). Available with [MIT License](LICENSE).
|
126
181
|
|
127
|
-
|
128
|
-
Send your CV, github to quieroser@conekta.io
|
182
|
+
</div>
|
data/conekta.gemspec
CHANGED
@@ -6,11 +6,11 @@ require 'conekta/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "conekta"
|
8
8
|
spec.version = Conekta::VERSION
|
9
|
-
spec.authors = ["
|
10
|
-
spec.email = ["soporte@conekta.
|
9
|
+
spec.authors = ["Conekta"]
|
10
|
+
spec.email = ["soporte@conekta.com"]
|
11
11
|
spec.description = %q{Ruby library for https://api.conekta.io}
|
12
12
|
spec.summary = %q{This library provides https://api.conekta.io operations}
|
13
|
-
spec.homepage = "https://www.conekta.
|
13
|
+
spec.homepage = "https://www.conekta.com"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "bundler", "
|
21
|
+
spec.add_dependency "bundler", ">= 1.3"
|
22
22
|
spec.add_dependency "rake"
|
23
23
|
spec.add_dependency "faraday"
|
24
24
|
spec.add_dependency "json"
|
25
25
|
spec.add_dependency "sys-uname"
|
26
26
|
|
27
|
-
spec.add_development_dependency "rspec", "
|
27
|
+
spec.add_development_dependency "rspec", ">= 3.0"
|
28
28
|
spec.add_development_dependency "pry"
|
29
29
|
end
|
data/lib/conekta.rb
CHANGED
@@ -17,12 +17,13 @@ require "conekta/resource"
|
|
17
17
|
require "conekta/requestor"
|
18
18
|
require "conekta/util"
|
19
19
|
require "conekta/error"
|
20
|
-
require "conekta/
|
20
|
+
require "conekta/error_details"
|
21
21
|
|
22
22
|
require "conekta/customer_info"
|
23
23
|
require "conekta/details"
|
24
24
|
require "conekta/event"
|
25
25
|
require "conekta/charge"
|
26
|
+
require "conekta/checkout"
|
26
27
|
require "conekta/customer"
|
27
28
|
require "conekta/card"
|
28
29
|
require "conekta/discount_line"
|
@@ -41,6 +42,7 @@ require "conekta/payment_source"
|
|
41
42
|
require "conekta/subscription"
|
42
43
|
require "conekta/tax_line"
|
43
44
|
require "conekta/token"
|
45
|
+
require "conekta/transfer"
|
44
46
|
require "conekta/webhook"
|
45
47
|
require "conekta/webhook_log"
|
46
48
|
require "conekta/refund"
|
data/lib/conekta/card.rb
CHANGED
@@ -9,20 +9,11 @@ module Conekta
|
|
9
9
|
:parent_id, :default
|
10
10
|
|
11
11
|
def _url
|
12
|
-
|
13
|
-
|
14
|
-
"message" => I18n.t('error.resource.id', { resource: self.class.class_name, locale: :en }),
|
15
|
-
"message_to_purchaser" => I18n.t('error.resource.id_purchaser', { locale: Conekta.locale.to_sym })
|
16
|
-
})
|
17
|
-
if Conekta.api_version == "2.0.0"
|
18
|
-
error_list = Conekta::ErrorList.new
|
19
|
-
error_list.details << exception
|
20
|
-
exception = error_list
|
21
|
-
end
|
22
|
-
raise exception
|
23
|
-
end
|
12
|
+
ensure_id
|
13
|
+
|
24
14
|
self.customer._url + self.class._url + "/" + id
|
25
15
|
end
|
16
|
+
|
26
17
|
def delete
|
27
18
|
self.delete_member('customer','cards')
|
28
19
|
end
|
data/lib/conekta/charge.rb
CHANGED
@@ -11,8 +11,10 @@ module Conekta
|
|
11
11
|
:exchange_rate, :foreign_currency, :amount_in_foreign_currency,
|
12
12
|
:checkout_id, :checkout_order_count
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# Usage: charge_reference.capture(2000)
|
15
|
+
def capture(capture_amount=nil)
|
16
|
+
params = { 'amount' => (capture_amount || self.amount) }
|
17
|
+
custom_action(:post, 'capture', params)
|
16
18
|
end
|
17
19
|
|
18
20
|
def refund(params=nil)
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Conekta
|
2
|
+
class Checkout < Resource
|
3
|
+
include Conekta::Operations::Create
|
4
|
+
include Conekta::Operations::Where
|
5
|
+
include Conekta::Operations::Find
|
6
|
+
include Conekta::Operations::CustomAction
|
7
|
+
|
8
|
+
attr_accessor :_id, :livemode, :company_id, :entity_id, :emails_sent,
|
9
|
+
:sms_sent, :name, :slug, :status, :url,
|
10
|
+
:type, :recurrent, :is_redirect_on_failure,
|
11
|
+
:payments_limit_count, :paid_payments_count,
|
12
|
+
:expires_at, :allowed_payment_methods,
|
13
|
+
:needs_shipping_contact, :monthly_installments_options,
|
14
|
+
:monthly_installments_enabled,
|
15
|
+
:returns_control_on, :on_demand_enabled
|
16
|
+
|
17
|
+
def _url
|
18
|
+
ensure_id
|
19
|
+
|
20
|
+
"/checkouts/#{id}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def send_sms(params = {})
|
24
|
+
custom_action(:post, "sms", params)
|
25
|
+
end
|
26
|
+
|
27
|
+
def send_email(params = {})
|
28
|
+
custom_action(:post, "email", params)
|
29
|
+
end
|
30
|
+
|
31
|
+
def cancel(params = {})
|
32
|
+
custom_action(:put, "cancel", params)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/conekta/customer.rb
CHANGED
@@ -57,6 +57,10 @@ module Conekta
|
|
57
57
|
self.create_member_with_relation('payment_sources', params, self)
|
58
58
|
end
|
59
59
|
|
60
|
+
def create_offline_recurrent_reference(params)
|
61
|
+
self.create_member_with_relation('payment_sources', params, self)
|
62
|
+
end
|
63
|
+
|
60
64
|
def create_subscription(params)
|
61
65
|
self.create_member('subscription', params)
|
62
66
|
end
|