paylike.rb 0.1.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/.github/main.workflow +14 -0
- data/.gitignore +11 -0
- data/.rubocop.yml +56 -0
- data/.yardstick.yml +30 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +101 -0
- data/LICENSE.txt +21 -0
- data/README.md +91 -0
- data/Rakefile +23 -0
- data/lib/paylike.rb +108 -0
- data/lib/paylike/gateway.rb +37 -0
- data/lib/paylike/resource.rb +58 -0
- data/lib/paylike/version.rb +3 -0
- data/paylike.rb.gemspec +34 -0
- data/vcr_cassettes/paylike-paylike-transaction-all.yml +56 -0
- data/vcr_cassettes/paylike-paylike-transaction-create-creates-and-voids.yml +146 -0
- data/vcr_cassettes/paylike-paylike-transaction-create-creates-captures-and-refunds.yml +197 -0
- metadata +215 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: dc76fe40068b72848e6afbdc43753ba6cba4192441e90e9deb93ae740ae13ae8
|
|
4
|
+
data.tar.gz: ee1c3e91ea9772dd952a2ffa2382089cf12325e04985df39d0243122b6718ea1
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 170f48da6b122d47e9e46d66cebd100918205f518ba9d5aa13e552dd714a28efdd7d983d3f5860848336e9a972fad3c6b91e2f35964b7b7fd648f016bb2b3993
|
|
7
|
+
data.tar.gz: 7e9934750a94c44593e9b66ee6ed85233dca41664151ef5db71419b57d0606c6066b37752406554f28ace513b3c769706ab32380975e597971f714b7ccdcea18
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require:
|
|
2
|
+
- rubocop-performance
|
|
3
|
+
- rubocop-rspec
|
|
4
|
+
|
|
5
|
+
RSpec:
|
|
6
|
+
Enabled: true
|
|
7
|
+
|
|
8
|
+
Performance:
|
|
9
|
+
Enabled: true
|
|
10
|
+
|
|
11
|
+
Bundler:
|
|
12
|
+
Enabled: true
|
|
13
|
+
|
|
14
|
+
Gemspec:
|
|
15
|
+
Enabled: true
|
|
16
|
+
|
|
17
|
+
Style/StringLiterals:
|
|
18
|
+
Enabled: true
|
|
19
|
+
EnforcedStyle: single_quotes
|
|
20
|
+
|
|
21
|
+
Style/FrozenStringLiteralComment:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
Metrics/LineLength:
|
|
25
|
+
Max: 80
|
|
26
|
+
|
|
27
|
+
Metrics/MethodLength:
|
|
28
|
+
Max: 12
|
|
29
|
+
|
|
30
|
+
Metrics/BlockLength:
|
|
31
|
+
Exclude:
|
|
32
|
+
- 'spec/**/*_spec.rb'
|
|
33
|
+
- '**/*.gemspec'
|
|
34
|
+
|
|
35
|
+
Layout/IndentationConsistency:
|
|
36
|
+
EnforcedStyle: normal
|
|
37
|
+
|
|
38
|
+
Style/BlockDelimiters:
|
|
39
|
+
Enabled: true
|
|
40
|
+
|
|
41
|
+
# RSpec/FilePath:
|
|
42
|
+
# Exclude:
|
|
43
|
+
# - 'spec/**/*_spec.rb'
|
|
44
|
+
|
|
45
|
+
# RSpec/DescribedClass:
|
|
46
|
+
# Exclude:
|
|
47
|
+
# - 'spec/integration/*_spec.rb'
|
|
48
|
+
|
|
49
|
+
RSpec/ExampleLength:
|
|
50
|
+
Enabled: false
|
|
51
|
+
|
|
52
|
+
RSpec/MultipleExpectations:
|
|
53
|
+
Enabled: false
|
|
54
|
+
|
|
55
|
+
RSpec/ContextWording:
|
|
56
|
+
Enabled: false
|
data/.yardstick.yml
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
path: ['lib/**/*.rb']
|
|
3
|
+
threshold: 100
|
|
4
|
+
rules:
|
|
5
|
+
ApiTag::Presence:
|
|
6
|
+
enabled: false
|
|
7
|
+
ApiTag::Inclusion:
|
|
8
|
+
enabled: false
|
|
9
|
+
ApiTag::ProtectedMethod:
|
|
10
|
+
enabled: false
|
|
11
|
+
ApiTag::PrivateMethod:
|
|
12
|
+
enabled: false
|
|
13
|
+
ExampleTag:
|
|
14
|
+
enabled: false
|
|
15
|
+
ReturnTag:
|
|
16
|
+
enabled: true
|
|
17
|
+
exclude: []
|
|
18
|
+
Summary::Presence:
|
|
19
|
+
enabled: true
|
|
20
|
+
exclude: []
|
|
21
|
+
Summary::Length:
|
|
22
|
+
enabled: true
|
|
23
|
+
exclude: []
|
|
24
|
+
Summary::Delimiter:
|
|
25
|
+
enabled: true
|
|
26
|
+
exclude: []
|
|
27
|
+
Summary::SingleLine:
|
|
28
|
+
enabled: true
|
|
29
|
+
exclude: []
|
|
30
|
+
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at stas@nerd.ro. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
paylike.rb (0.1.0)
|
|
5
|
+
http-rest_client
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
addressable (2.6.0)
|
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
|
12
|
+
ast (2.4.0)
|
|
13
|
+
crack (0.4.3)
|
|
14
|
+
safe_yaml (~> 1.0.0)
|
|
15
|
+
diff-lcs (1.3)
|
|
16
|
+
docile (1.3.2)
|
|
17
|
+
domain_name (0.5.20180417)
|
|
18
|
+
unf (>= 0.0.5, < 1.0.0)
|
|
19
|
+
ffaker (2.11.0)
|
|
20
|
+
hashdiff (0.4.0)
|
|
21
|
+
http (4.1.1)
|
|
22
|
+
addressable (~> 2.3)
|
|
23
|
+
http-cookie (~> 1.0)
|
|
24
|
+
http-form_data (~> 2.0)
|
|
25
|
+
http_parser.rb (~> 0.6.0)
|
|
26
|
+
http-cookie (1.0.3)
|
|
27
|
+
domain_name (~> 0.5)
|
|
28
|
+
http-form_data (2.1.1)
|
|
29
|
+
http-rest_client (0.1.1)
|
|
30
|
+
http
|
|
31
|
+
http_parser.rb (0.6.0)
|
|
32
|
+
jaro_winkler (1.5.3)
|
|
33
|
+
json (2.2.0)
|
|
34
|
+
parallel (1.17.0)
|
|
35
|
+
parser (2.6.3.0)
|
|
36
|
+
ast (~> 2.4.0)
|
|
37
|
+
public_suffix (3.1.1)
|
|
38
|
+
rainbow (3.0.0)
|
|
39
|
+
rake (12.3.2)
|
|
40
|
+
rspec (3.8.0)
|
|
41
|
+
rspec-core (~> 3.8.0)
|
|
42
|
+
rspec-expectations (~> 3.8.0)
|
|
43
|
+
rspec-mocks (~> 3.8.0)
|
|
44
|
+
rspec-core (3.8.2)
|
|
45
|
+
rspec-support (~> 3.8.0)
|
|
46
|
+
rspec-expectations (3.8.4)
|
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
48
|
+
rspec-support (~> 3.8.0)
|
|
49
|
+
rspec-mocks (3.8.1)
|
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
51
|
+
rspec-support (~> 3.8.0)
|
|
52
|
+
rspec-support (3.8.2)
|
|
53
|
+
rubocop (0.72.0)
|
|
54
|
+
jaro_winkler (~> 1.5.1)
|
|
55
|
+
parallel (~> 1.10)
|
|
56
|
+
parser (>= 2.6)
|
|
57
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
58
|
+
ruby-progressbar (~> 1.7)
|
|
59
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
|
60
|
+
rubocop-performance (1.4.0)
|
|
61
|
+
rubocop (>= 0.71.0)
|
|
62
|
+
rubocop-rspec (1.33.0)
|
|
63
|
+
rubocop (>= 0.60.0)
|
|
64
|
+
ruby-progressbar (1.10.1)
|
|
65
|
+
safe_yaml (1.0.5)
|
|
66
|
+
simplecov (0.16.1)
|
|
67
|
+
docile (~> 1.1)
|
|
68
|
+
json (>= 1.8, < 3)
|
|
69
|
+
simplecov-html (~> 0.10.0)
|
|
70
|
+
simplecov-html (0.10.2)
|
|
71
|
+
unf (0.1.4)
|
|
72
|
+
unf_ext
|
|
73
|
+
unf_ext (0.0.7.6)
|
|
74
|
+
unicode-display_width (1.6.0)
|
|
75
|
+
vcr (5.0.0)
|
|
76
|
+
webmock (3.6.0)
|
|
77
|
+
addressable (>= 2.3.6)
|
|
78
|
+
crack (>= 0.3.2)
|
|
79
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
80
|
+
yard (0.9.20)
|
|
81
|
+
yardstick (0.9.9)
|
|
82
|
+
yard (~> 0.8, >= 0.8.7.2)
|
|
83
|
+
|
|
84
|
+
PLATFORMS
|
|
85
|
+
ruby
|
|
86
|
+
|
|
87
|
+
DEPENDENCIES
|
|
88
|
+
bundler
|
|
89
|
+
ffaker
|
|
90
|
+
paylike.rb!
|
|
91
|
+
rake
|
|
92
|
+
rspec
|
|
93
|
+
rubocop-performance
|
|
94
|
+
rubocop-rspec
|
|
95
|
+
simplecov
|
|
96
|
+
vcr
|
|
97
|
+
webmock
|
|
98
|
+
yardstick
|
|
99
|
+
|
|
100
|
+
BUNDLED WITH
|
|
101
|
+
1.17.2
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Stas SUȘCOV
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Paylike 💱
|
|
2
|
+
|
|
3
|
+
Ruby SDK for working with [Paylike](https://github.com/paylike/api-docs)
|
|
4
|
+
Payments services.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'paylike.rb'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
|
|
16
|
+
$ bundle
|
|
17
|
+
|
|
18
|
+
Or install it yourself as:
|
|
19
|
+
|
|
20
|
+
$ gem install paylike.rb
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
A subset of the Paylike resources are provided with this SDK:
|
|
25
|
+
|
|
26
|
+
* `Paylike::App`
|
|
27
|
+
* `Paylike::Card`
|
|
28
|
+
* `Paylike::Line`
|
|
29
|
+
* `Paylike::User`
|
|
30
|
+
* `Paylike::Transaction`
|
|
31
|
+
|
|
32
|
+
These resources have implemented the _CRUD_ methods to allow API operations:
|
|
33
|
+
* `all`
|
|
34
|
+
* `find`
|
|
35
|
+
* `create`
|
|
36
|
+
* `update`
|
|
37
|
+
* `delete`
|
|
38
|
+
|
|
39
|
+
Here's an example on how to create a transaction, capture it, and refund it:
|
|
40
|
+
```ruby
|
|
41
|
+
require 'paylike'
|
|
42
|
+
|
|
43
|
+
trans = Paylike::Transaction.create(
|
|
44
|
+
currency: 'EUR',
|
|
45
|
+
amount: 1000,
|
|
46
|
+
card: {
|
|
47
|
+
number: '4100000000000000',
|
|
48
|
+
code: '123',
|
|
49
|
+
expiry: {
|
|
50
|
+
month: '08',
|
|
51
|
+
year: '2020'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
trans.capture(amount: 1000)
|
|
56
|
+
trans.refund(amount: 500)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Configuration
|
|
60
|
+
|
|
61
|
+
The API keys will be loaded from your environment variables:
|
|
62
|
+
|
|
63
|
+
* `PAYLIKE_KEY`
|
|
64
|
+
* `PAYLIKE_MERCHANT_ID`
|
|
65
|
+
* `PAYLIKE_PUBLIC_KEY`
|
|
66
|
+
|
|
67
|
+
## Development
|
|
68
|
+
|
|
69
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
70
|
+
release a new version, update the version number in `version.rb`, and then run
|
|
71
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
|
72
|
+
git commits and tags, and push the `.gem` file to
|
|
73
|
+
[rubygems.org](https://rubygems.org).
|
|
74
|
+
|
|
75
|
+
## Contributing
|
|
76
|
+
|
|
77
|
+
Bug reports and pull requests are welcome on GitHub at
|
|
78
|
+
https://github.com/luneteyewear/paylike. This project is intended to be a safe,
|
|
79
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
|
80
|
+
the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
The gem is available as open source under the terms of the [MIT
|
|
85
|
+
License](https://opensource.org/licenses/MIT).
|
|
86
|
+
|
|
87
|
+
## Code of Conduct
|
|
88
|
+
|
|
89
|
+
Everyone interacting in the Paylike project’s codebases, issue trackers, chat
|
|
90
|
+
rooms and mailing lists is expected to follow the [code of
|
|
91
|
+
conduct](https://github.com/luneteyewear/paylike/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
2
|
+
require 'rspec/core/rake_task'
|
|
3
|
+
require 'rubocop/rake_task'
|
|
4
|
+
require 'yaml'
|
|
5
|
+
require 'yardstick/rake/verify'
|
|
6
|
+
|
|
7
|
+
desc('Documentation stats and measurements')
|
|
8
|
+
task('qa:docs') do
|
|
9
|
+
yaml = YAML.load_file('.yardstick.yml')
|
|
10
|
+
config = Yardstick::Config.coerce(yaml)
|
|
11
|
+
measure = Yardstick.measure(config)
|
|
12
|
+
measure.puts
|
|
13
|
+
coverage = Yardstick.round_percentage(measure.coverage * 100)
|
|
14
|
+
exit(1) if coverage < config.threshold
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
RuboCop::RakeTask.new('qa:code')
|
|
18
|
+
|
|
19
|
+
desc('Run QA tasks')
|
|
20
|
+
task(qa: ['qa:docs', 'qa:code'])
|
|
21
|
+
|
|
22
|
+
RSpec::Core::RakeTask.new(spec: :qa)
|
|
23
|
+
task(default: :spec)
|
data/lib/paylike.rb
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'paylike/resource'
|
|
3
|
+
require 'paylike/gateway'
|
|
4
|
+
require 'paylike/version'
|
|
5
|
+
|
|
6
|
+
# Paylike HTTP API Client
|
|
7
|
+
module Paylike
|
|
8
|
+
# The 3D Secure error code
|
|
9
|
+
THREE_D_SECURE_ERROR_CODE = 30
|
|
10
|
+
# The 3D Secure callback URI
|
|
11
|
+
THREE_D_SECURE_CALLBACK_URI = 'https://gateway.paylike.io/acs-response'.freeze
|
|
12
|
+
|
|
13
|
+
# Validates and extracts 3D Secure related data from an error response
|
|
14
|
+
#
|
|
15
|
+
# @param error [ApiClient::ResponseError] the response error to extract from
|
|
16
|
+
# @param uid [String] the unique identifier to use as the 3D Secure `MD` value
|
|
17
|
+
#
|
|
18
|
+
# @return [Hash] on valid 3D Secure response errors
|
|
19
|
+
def self.extract_threedsecure_data(error, uid)
|
|
20
|
+
resp_data = error.response_data
|
|
21
|
+
|
|
22
|
+
if resp_data.nil? || resp_data['code'].to_i != THREE_D_SECURE_ERROR_CODE
|
|
23
|
+
return
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
threedsecure_url: resp_data['tds']['url'],
|
|
28
|
+
threedsecure_data: {
|
|
29
|
+
MD: uid,
|
|
30
|
+
TermUrl: THREE_D_SECURE_CALLBACK_URI,
|
|
31
|
+
PaReq: resp_data['tds']['pareq']
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Base endpoint resources class
|
|
37
|
+
class Base < Resource
|
|
38
|
+
endpoint 'https://api.paylike.io'
|
|
39
|
+
basic_auth user: '', pass: ENV['PAYLIKE_KEY']
|
|
40
|
+
content_type 'application/json'
|
|
41
|
+
accept 'application/json'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Transactions endpoint resource
|
|
45
|
+
class Transaction < Base
|
|
46
|
+
path "/merchants/#{ENV['PAYLIKE_MERCHANT_ID']}/transactions"
|
|
47
|
+
|
|
48
|
+
# Delegate the resource creation to the gateway, but maintain the rest
|
|
49
|
+
#
|
|
50
|
+
# @return [Paylike::Transaction] instance
|
|
51
|
+
def self.create(*args)
|
|
52
|
+
gw_tran = Gateway::Transaction.create(*args)
|
|
53
|
+
find(gw_tran.id)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Refunds helper
|
|
57
|
+
#
|
|
58
|
+
# @return [NilClass]
|
|
59
|
+
def void
|
|
60
|
+
voids_uri = self.class.uri_sans_merchant_id(id, :voids)
|
|
61
|
+
data = self.class.request(:post, voids_uri, json: { amount: amount })
|
|
62
|
+
symbolized = JSON.parse(data.to_json, symbolize_names: true)
|
|
63
|
+
marshal_load(symbolized) if data.is_a?(Hash)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Refunds helper
|
|
67
|
+
#
|
|
68
|
+
# @param params [Hash] the `amount` and the `descriptor`.
|
|
69
|
+
# @return [NilClass]
|
|
70
|
+
def refund(params)
|
|
71
|
+
refunds_uri = self.class.uri_sans_merchant_id(id, :refunds)
|
|
72
|
+
data = self.class.request(:post, refunds_uri, json: params)
|
|
73
|
+
symbolized = JSON.parse(data.to_json, symbolize_names: true)
|
|
74
|
+
marshal_load(symbolized) if data.is_a?(Hash)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Capture helper
|
|
78
|
+
#
|
|
79
|
+
# @param params [Hash] the `amount` and the `descriptor`.
|
|
80
|
+
# @return [NilClass]
|
|
81
|
+
def capture(params)
|
|
82
|
+
captures_uri = self.class.uri_sans_merchant_id(id, :captures)
|
|
83
|
+
data = self.class.request(:post, captures_uri, json: params)
|
|
84
|
+
symbolized = JSON.parse(data.to_json, symbolize_names: true)
|
|
85
|
+
marshal_load(symbolized) if data.is_a?(Hash)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Users endpoint resource
|
|
90
|
+
class User < Base
|
|
91
|
+
path "/merchants/#{ENV['PAYLIKE_MERCHANT_ID']}/users"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Applications endpoint resource
|
|
95
|
+
class App < Base
|
|
96
|
+
path "/merchants/#{ENV['PAYLIKE_MERCHANT_ID']}/apps"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Cards endpoint resource
|
|
100
|
+
class Card < Base
|
|
101
|
+
path "/merchants/#{ENV['PAYLIKE_MERCHANT_ID']}/cards"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Lines endpoint resource
|
|
105
|
+
class Line < Base
|
|
106
|
+
path "/merchants/#{ENV['PAYLIKE_MERCHANT_ID']}/lines"
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'paylike/resource'
|
|
2
|
+
|
|
3
|
+
module Paylike
|
|
4
|
+
# Gateway endpoint resources
|
|
5
|
+
#
|
|
6
|
+
# See: https://github.com/paylike/api-docs/blob/master/gateway.md#gateway-api-reference
|
|
7
|
+
module Gateway
|
|
8
|
+
# Base Gateway endpoint resources class
|
|
9
|
+
class Base < Resource
|
|
10
|
+
endpoint('https://gateway.paylike.io')
|
|
11
|
+
content_type 'application/json'
|
|
12
|
+
accept 'application/json'
|
|
13
|
+
|
|
14
|
+
# Customized resource creation helper to enable key-based authentication
|
|
15
|
+
#
|
|
16
|
+
# @return [Paylike::Gateway::Resource] instance
|
|
17
|
+
def self.create(params = {})
|
|
18
|
+
params[:key] = ENV['PAYLIKE_PUBLIC_KEY']
|
|
19
|
+
super(params)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Transaction endpoint resource (used only for creation)
|
|
24
|
+
#
|
|
25
|
+
# See: https://github.com/paylike/api-docs/blob/master/gateway.md#create-a-payment
|
|
26
|
+
class Transaction < Base
|
|
27
|
+
path '/transactions'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Card endpoint resource (used only for creation)
|
|
31
|
+
#
|
|
32
|
+
# See: https://github.com/paylike/api-docs/blob/master/gateway.md#tokenize-a-card-for-later-use
|
|
33
|
+
class Card < Base
|
|
34
|
+
path '/cards'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
require 'ostruct'
|
|
2
|
+
require 'http/rest_client'
|
|
3
|
+
|
|
4
|
+
module Paylike
|
|
5
|
+
# Base resource class
|
|
6
|
+
class Resource < OpenStruct
|
|
7
|
+
extend HTTP::RestClient::DSL
|
|
8
|
+
extend HTTP::RestClient::CRUD
|
|
9
|
+
|
|
10
|
+
# Resource collection finder, uses the default limit
|
|
11
|
+
#
|
|
12
|
+
# @param params [Hash] URI parameters to pass to the endpoint.
|
|
13
|
+
# @return [Array] of [Paylike::Resource] instances
|
|
14
|
+
def self.all(params = {})
|
|
15
|
+
params[:limit] ||= 100
|
|
16
|
+
super(params)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Resource finder
|
|
20
|
+
#
|
|
21
|
+
# @param id [String] resource indentifier
|
|
22
|
+
# @return [Paylike::Resource] instance
|
|
23
|
+
def self.find(id, params = {})
|
|
24
|
+
objectify(request(:get, uri_sans_merchant_id(id), params: params))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Like `uri`, but removes any merchant ID from the path
|
|
28
|
+
#
|
|
29
|
+
# @return [String]
|
|
30
|
+
def self.uri_sans_merchant_id(*args)
|
|
31
|
+
uri(*args).to_s.gsub(%r{\/merchants\/[\w]+}, '')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Custom response parser to extract successful payloads
|
|
35
|
+
#
|
|
36
|
+
# @param response [HTTP::Response] object
|
|
37
|
+
# @return [Object] on parsable responses
|
|
38
|
+
def self.parse_response(response)
|
|
39
|
+
parsed = super
|
|
40
|
+
|
|
41
|
+
return parsed.values.first if parsed.is_a?(Hash) && parsed.size == 1
|
|
42
|
+
|
|
43
|
+
return parsed.first if parsed.is_a?(Array) && parsed.size == 1
|
|
44
|
+
|
|
45
|
+
parsed
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Extracts the error message from the response
|
|
49
|
+
#
|
|
50
|
+
# @param response [HTTP::Response] the server response
|
|
51
|
+
# @param parsed_response [Object] the parsed server response
|
|
52
|
+
#
|
|
53
|
+
# @return [String]
|
|
54
|
+
def self.extract_error(_, parsed_response)
|
|
55
|
+
parsed_response.delete('message') if parsed_response.respond_to?(:delete)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
data/paylike.rb.gemspec
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'paylike/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'paylike.rb'
|
|
7
|
+
spec.version = Paylike::VERSION
|
|
8
|
+
spec.authors = ['Stas SUȘCOV']
|
|
9
|
+
spec.email = ['stas@nerd.ro']
|
|
10
|
+
|
|
11
|
+
spec.summary = 'Paylike Ruby SDK'
|
|
12
|
+
spec.description = 'Ruby SDK for working with Paylike payment services.'
|
|
13
|
+
spec.homepage = 'https://github.com/luneteyewear/paylike'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
|
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
|
19
|
+
end
|
|
20
|
+
spec.require_paths = ['lib']
|
|
21
|
+
|
|
22
|
+
spec.add_dependency 'http-rest_client'
|
|
23
|
+
|
|
24
|
+
spec.add_development_dependency 'bundler'
|
|
25
|
+
spec.add_development_dependency 'ffaker'
|
|
26
|
+
spec.add_development_dependency 'rake'
|
|
27
|
+
spec.add_development_dependency 'rspec'
|
|
28
|
+
spec.add_development_dependency 'rubocop-performance'
|
|
29
|
+
spec.add_development_dependency 'rubocop-rspec'
|
|
30
|
+
spec.add_development_dependency 'simplecov'
|
|
31
|
+
spec.add_development_dependency 'vcr'
|
|
32
|
+
spec.add_development_dependency 'webmock'
|
|
33
|
+
spec.add_development_dependency 'yardstick'
|
|
34
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.paylike.io/merchants/<PAYLIKE_MERCHANT_ID>/transactions?limit=2
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- Basic <AUTH_TOKEN>
|
|
12
|
+
Content-Type:
|
|
13
|
+
- application/json
|
|
14
|
+
Accept:
|
|
15
|
+
- application/json
|
|
16
|
+
Connection:
|
|
17
|
+
- close
|
|
18
|
+
Host:
|
|
19
|
+
- api.paylike.io
|
|
20
|
+
User-Agent:
|
|
21
|
+
- http.rb/4.1.1
|
|
22
|
+
response:
|
|
23
|
+
status:
|
|
24
|
+
code: 200
|
|
25
|
+
message: OK
|
|
26
|
+
headers:
|
|
27
|
+
Server:
|
|
28
|
+
- nginx
|
|
29
|
+
Date:
|
|
30
|
+
- Sun, 30 Jun 2019 12:08:41 GMT
|
|
31
|
+
Content-Type:
|
|
32
|
+
- application/json; charset=utf-8
|
|
33
|
+
Transfer-Encoding:
|
|
34
|
+
- chunked
|
|
35
|
+
Connection:
|
|
36
|
+
- close
|
|
37
|
+
Vary:
|
|
38
|
+
- Accept-Encoding
|
|
39
|
+
Strict-Transport-Security:
|
|
40
|
+
- max-age=31536000; includeSubdomains; preload
|
|
41
|
+
Content-Security-Policy:
|
|
42
|
+
- default-src 'none'; frame-ancestors 'none'
|
|
43
|
+
X-Content-Type-Options:
|
|
44
|
+
- nosniff
|
|
45
|
+
X-Request-Id:
|
|
46
|
+
- eaa1e63d0209d4bacf768cc38d88b5ba
|
|
47
|
+
body:
|
|
48
|
+
encoding: UTF-8
|
|
49
|
+
string: |-
|
|
50
|
+
[
|
|
51
|
+
{"id":"5d189be5b16522079008f0ab","test":true,"merchantId":"<PAYLIKE_MERCHANT_ID>","created":"2019-06-30T11:24:22.439Z","amount":1000,"refundedAmount":0,"capturedAmount":0,"voidedAmount":1000,"pendingAmount":0,"disputedAmount":0,"card":{"bin":"410000","last4":"0000","expiry":"2020-08-31T21:59:59.999Z","code":{"present":true},"scheme":"visa"},"tds":"none","currency":"EUR","custom":null,"recurring":false,"successful":true,"error":false,"descriptor":"A test descriptor","trail":[{"fee":{"flat":0,"rate":0},"amount":1000,"balance":0,"created":"2019-06-30T11:24:22.964Z","void":true}]},
|
|
52
|
+
{"id":"5d189be3b16522079008f0aa","test":true,"merchantId":"<PAYLIKE_MERCHANT_ID>","created":"2019-06-30T11:24:20.616Z","amount":1000,"refundedAmount":333,"capturedAmount":500,"voidedAmount":0,"pendingAmount":500,"disputedAmount":0,"card":{"bin":"410000","last4":"0000","expiry":"2020-08-31T21:59:59.999Z","code":{"present":true},"scheme":"visa"},"tds":"none","currency":"EUR","custom":null,"recurring":false,"successful":true,"error":false,"descriptor":"A test descriptor","trail":[{"fee":{"flat":191,"rate":92},"amount":500,"balance":3379,"created":"2019-06-30T11:27:42.396Z","capture":true,"descriptor":"A test descriptor","lineId":"5d189cae094009078f08f097"},{"fee":{"flat":0,"rate":-61},"amount":333,"balance":-2378,"created":"2019-06-30T11:48:29.602Z","refund":true,"descriptor":"A test descriptor","lineId":"5d18a18db16522079008f0ca"}]}
|
|
53
|
+
]
|
|
54
|
+
http_version:
|
|
55
|
+
recorded_at: Sun, 30 Jun 2019 12:08:41 GMT
|
|
56
|
+
recorded_with: VCR 5.0.0
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://gateway.paylike.io/transactions
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: '{"currency":"EUR","amount":1000,"card":{"number":"4100000000000000","code":"123","expiry":{"month":"08","year":"2020"}},"key":"<PAYLIKE_PUBLIC_KEY>"}'
|
|
9
|
+
headers:
|
|
10
|
+
Content-Type:
|
|
11
|
+
- application/json
|
|
12
|
+
Accept:
|
|
13
|
+
- application/json
|
|
14
|
+
Connection:
|
|
15
|
+
- close
|
|
16
|
+
Host:
|
|
17
|
+
- gateway.paylike.io
|
|
18
|
+
User-Agent:
|
|
19
|
+
- http.rb/4.1.1
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- nginx
|
|
27
|
+
Date:
|
|
28
|
+
- Sun, 30 Jun 2019 12:08:45 GMT
|
|
29
|
+
Content-Type:
|
|
30
|
+
- application/json; charset=utf-8
|
|
31
|
+
Transfer-Encoding:
|
|
32
|
+
- chunked
|
|
33
|
+
Connection:
|
|
34
|
+
- close
|
|
35
|
+
Vary:
|
|
36
|
+
- Accept-Encoding
|
|
37
|
+
Strict-Transport-Security:
|
|
38
|
+
- max-age=31536000; includeSubdomains; preload
|
|
39
|
+
X-Content-Type-Options:
|
|
40
|
+
- nosniff
|
|
41
|
+
X-Request-Id:
|
|
42
|
+
- 41cb88cf9c19348f684edfd83d3fcfcf
|
|
43
|
+
body:
|
|
44
|
+
encoding: UTF-8
|
|
45
|
+
string: "{\n\t\"transaction\": {\n\t\t\"id\": \"5d18a64c870272079cacff35\"\n\t}\n}"
|
|
46
|
+
http_version:
|
|
47
|
+
recorded_at: Sun, 30 Jun 2019 12:08:45 GMT
|
|
48
|
+
- request:
|
|
49
|
+
method: get
|
|
50
|
+
uri: https://api.paylike.io/transactions/5d18a64c870272079cacff35
|
|
51
|
+
body:
|
|
52
|
+
encoding: UTF-8
|
|
53
|
+
string: ''
|
|
54
|
+
headers:
|
|
55
|
+
Authorization:
|
|
56
|
+
- Basic <AUTH_TOKEN>
|
|
57
|
+
Content-Type:
|
|
58
|
+
- application/json
|
|
59
|
+
Accept:
|
|
60
|
+
- application/json
|
|
61
|
+
Connection:
|
|
62
|
+
- close
|
|
63
|
+
Host:
|
|
64
|
+
- api.paylike.io
|
|
65
|
+
User-Agent:
|
|
66
|
+
- http.rb/4.1.1
|
|
67
|
+
response:
|
|
68
|
+
status:
|
|
69
|
+
code: 200
|
|
70
|
+
message: OK
|
|
71
|
+
headers:
|
|
72
|
+
Server:
|
|
73
|
+
- nginx
|
|
74
|
+
Date:
|
|
75
|
+
- Sun, 30 Jun 2019 12:08:45 GMT
|
|
76
|
+
Content-Type:
|
|
77
|
+
- application/json; charset=utf-8
|
|
78
|
+
Transfer-Encoding:
|
|
79
|
+
- chunked
|
|
80
|
+
Connection:
|
|
81
|
+
- close
|
|
82
|
+
Vary:
|
|
83
|
+
- Accept-Encoding
|
|
84
|
+
Strict-Transport-Security:
|
|
85
|
+
- max-age=31536000; includeSubdomains; preload
|
|
86
|
+
Content-Security-Policy:
|
|
87
|
+
- default-src 'none'; frame-ancestors 'none'
|
|
88
|
+
X-Content-Type-Options:
|
|
89
|
+
- nosniff
|
|
90
|
+
X-Request-Id:
|
|
91
|
+
- 72c61d4b39422c586202592dae689e64
|
|
92
|
+
body:
|
|
93
|
+
encoding: UTF-8
|
|
94
|
+
string: '{"transaction":{"id":"5d18a64c870272079cacff35","test":true,"merchantId":"<PAYLIKE_MERCHANT_ID>","created":"2019-06-30T12:08:45.272Z","amount":1000,"refundedAmount":0,"capturedAmount":0,"voidedAmount":0,"pendingAmount":1000,"disputedAmount":0,"card":{"bin":"410000","last4":"0000","expiry":"2020-08-31T21:59:59.999Z","code":{"present":true},"scheme":"visa"},"tds":"none","currency":"EUR","custom":null,"recurring":false,"successful":true,"error":false,"descriptor":"A
|
|
95
|
+
test descriptor","trail":[]}}'
|
|
96
|
+
http_version:
|
|
97
|
+
recorded_at: Sun, 30 Jun 2019 12:08:45 GMT
|
|
98
|
+
- request:
|
|
99
|
+
method: post
|
|
100
|
+
uri: https://api.paylike.io/transactions/5d18a64c870272079cacff35/voids
|
|
101
|
+
body:
|
|
102
|
+
encoding: UTF-8
|
|
103
|
+
string: '{"amount":1000}'
|
|
104
|
+
headers:
|
|
105
|
+
Authorization:
|
|
106
|
+
- Basic <AUTH_TOKEN>
|
|
107
|
+
Content-Type:
|
|
108
|
+
- application/json
|
|
109
|
+
Accept:
|
|
110
|
+
- application/json
|
|
111
|
+
Connection:
|
|
112
|
+
- close
|
|
113
|
+
Host:
|
|
114
|
+
- api.paylike.io
|
|
115
|
+
User-Agent:
|
|
116
|
+
- http.rb/4.1.1
|
|
117
|
+
response:
|
|
118
|
+
status:
|
|
119
|
+
code: 201
|
|
120
|
+
message: Created
|
|
121
|
+
headers:
|
|
122
|
+
Server:
|
|
123
|
+
- nginx
|
|
124
|
+
Date:
|
|
125
|
+
- Sun, 30 Jun 2019 12:08:46 GMT
|
|
126
|
+
Content-Type:
|
|
127
|
+
- application/json; charset=utf-8
|
|
128
|
+
Transfer-Encoding:
|
|
129
|
+
- chunked
|
|
130
|
+
Connection:
|
|
131
|
+
- close
|
|
132
|
+
Strict-Transport-Security:
|
|
133
|
+
- max-age=31536000; includeSubdomains; preload
|
|
134
|
+
Content-Security-Policy:
|
|
135
|
+
- default-src 'none'; frame-ancestors 'none'
|
|
136
|
+
X-Content-Type-Options:
|
|
137
|
+
- nosniff
|
|
138
|
+
X-Request-Id:
|
|
139
|
+
- 456ea2b649defba97ded846ae4e4eb1d
|
|
140
|
+
body:
|
|
141
|
+
encoding: UTF-8
|
|
142
|
+
string: '{"transaction":{"id":"5d18a64c870272079cacff35","test":true,"merchantId":"<PAYLIKE_MERCHANT_ID>","created":"2019-06-30T12:08:45.272Z","amount":1000,"refundedAmount":0,"capturedAmount":0,"voidedAmount":1000,"pendingAmount":0,"disputedAmount":0,"card":{"bin":"410000","last4":"0000","expiry":"2020-08-31T21:59:59.999Z","code":{"present":true},"scheme":"visa"},"tds":"none","currency":"EUR","custom":null,"recurring":false,"successful":true,"error":false,"descriptor":"A
|
|
143
|
+
test descriptor","trail":[{"fee":{"flat":0,"rate":0},"amount":1000,"balance":0,"created":"2019-06-30T12:08:45.906Z","void":true}]}}'
|
|
144
|
+
http_version:
|
|
145
|
+
recorded_at: Sun, 30 Jun 2019 12:08:46 GMT
|
|
146
|
+
recorded_with: VCR 5.0.0
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://gateway.paylike.io/transactions
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: '{"currency":"EUR","amount":1000,"card":{"number":"4100000000000000","code":"123","expiry":{"month":"08","year":"2020"}},"key":"<PAYLIKE_PUBLIC_KEY>"}'
|
|
9
|
+
headers:
|
|
10
|
+
Content-Type:
|
|
11
|
+
- application/json
|
|
12
|
+
Accept:
|
|
13
|
+
- application/json
|
|
14
|
+
Connection:
|
|
15
|
+
- close
|
|
16
|
+
Host:
|
|
17
|
+
- gateway.paylike.io
|
|
18
|
+
User-Agent:
|
|
19
|
+
- http.rb/4.1.1
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Server:
|
|
26
|
+
- nginx
|
|
27
|
+
Date:
|
|
28
|
+
- Sun, 30 Jun 2019 12:08:42 GMT
|
|
29
|
+
Content-Type:
|
|
30
|
+
- application/json; charset=utf-8
|
|
31
|
+
Transfer-Encoding:
|
|
32
|
+
- chunked
|
|
33
|
+
Connection:
|
|
34
|
+
- close
|
|
35
|
+
Vary:
|
|
36
|
+
- Accept-Encoding
|
|
37
|
+
Strict-Transport-Security:
|
|
38
|
+
- max-age=31536000; includeSubdomains; preload
|
|
39
|
+
X-Content-Type-Options:
|
|
40
|
+
- nosniff
|
|
41
|
+
X-Request-Id:
|
|
42
|
+
- da0a41abdf845e069e2fe7f929308f6a
|
|
43
|
+
body:
|
|
44
|
+
encoding: UTF-8
|
|
45
|
+
string: "{\n\t\"transaction\": {\n\t\t\"id\": \"5d18a649451afb07969de6f4\"\n\t}\n}"
|
|
46
|
+
http_version:
|
|
47
|
+
recorded_at: Sun, 30 Jun 2019 12:08:42 GMT
|
|
48
|
+
- request:
|
|
49
|
+
method: get
|
|
50
|
+
uri: https://api.paylike.io/transactions/5d18a649451afb07969de6f4
|
|
51
|
+
body:
|
|
52
|
+
encoding: UTF-8
|
|
53
|
+
string: ''
|
|
54
|
+
headers:
|
|
55
|
+
Authorization:
|
|
56
|
+
- Basic <AUTH_TOKEN>
|
|
57
|
+
Content-Type:
|
|
58
|
+
- application/json
|
|
59
|
+
Accept:
|
|
60
|
+
- application/json
|
|
61
|
+
Connection:
|
|
62
|
+
- close
|
|
63
|
+
Host:
|
|
64
|
+
- api.paylike.io
|
|
65
|
+
User-Agent:
|
|
66
|
+
- http.rb/4.1.1
|
|
67
|
+
response:
|
|
68
|
+
status:
|
|
69
|
+
code: 200
|
|
70
|
+
message: OK
|
|
71
|
+
headers:
|
|
72
|
+
Server:
|
|
73
|
+
- nginx
|
|
74
|
+
Date:
|
|
75
|
+
- Sun, 30 Jun 2019 12:08:43 GMT
|
|
76
|
+
Content-Type:
|
|
77
|
+
- application/json; charset=utf-8
|
|
78
|
+
Transfer-Encoding:
|
|
79
|
+
- chunked
|
|
80
|
+
Connection:
|
|
81
|
+
- close
|
|
82
|
+
Vary:
|
|
83
|
+
- Accept-Encoding
|
|
84
|
+
Strict-Transport-Security:
|
|
85
|
+
- max-age=31536000; includeSubdomains; preload
|
|
86
|
+
Content-Security-Policy:
|
|
87
|
+
- default-src 'none'; frame-ancestors 'none'
|
|
88
|
+
X-Content-Type-Options:
|
|
89
|
+
- nosniff
|
|
90
|
+
X-Request-Id:
|
|
91
|
+
- 8e4e968e1ba3258f4af1faf1b8e8a420
|
|
92
|
+
body:
|
|
93
|
+
encoding: UTF-8
|
|
94
|
+
string: '{"transaction":{"id":"5d18a649451afb07969de6f4","test":true,"merchantId":"<PAYLIKE_MERCHANT_ID>","created":"2019-06-30T12:08:42.816Z","amount":1000,"refundedAmount":0,"capturedAmount":0,"voidedAmount":0,"pendingAmount":1000,"disputedAmount":0,"card":{"bin":"410000","last4":"0000","expiry":"2020-08-31T21:59:59.999Z","code":{"present":true},"scheme":"visa"},"tds":"none","currency":"EUR","custom":null,"recurring":false,"successful":true,"error":false,"descriptor":"A
|
|
95
|
+
test descriptor","trail":[]}}'
|
|
96
|
+
http_version:
|
|
97
|
+
recorded_at: Sun, 30 Jun 2019 12:08:43 GMT
|
|
98
|
+
- request:
|
|
99
|
+
method: post
|
|
100
|
+
uri: https://api.paylike.io/transactions/5d18a649451afb07969de6f4/captures
|
|
101
|
+
body:
|
|
102
|
+
encoding: UTF-8
|
|
103
|
+
string: '{"amount":500}'
|
|
104
|
+
headers:
|
|
105
|
+
Authorization:
|
|
106
|
+
- Basic <AUTH_TOKEN>
|
|
107
|
+
Content-Type:
|
|
108
|
+
- application/json
|
|
109
|
+
Accept:
|
|
110
|
+
- application/json
|
|
111
|
+
Connection:
|
|
112
|
+
- close
|
|
113
|
+
Host:
|
|
114
|
+
- api.paylike.io
|
|
115
|
+
User-Agent:
|
|
116
|
+
- http.rb/4.1.1
|
|
117
|
+
response:
|
|
118
|
+
status:
|
|
119
|
+
code: 201
|
|
120
|
+
message: Created
|
|
121
|
+
headers:
|
|
122
|
+
Server:
|
|
123
|
+
- nginx
|
|
124
|
+
Date:
|
|
125
|
+
- Sun, 30 Jun 2019 12:08:43 GMT
|
|
126
|
+
Content-Type:
|
|
127
|
+
- application/json; charset=utf-8
|
|
128
|
+
Transfer-Encoding:
|
|
129
|
+
- chunked
|
|
130
|
+
Connection:
|
|
131
|
+
- close
|
|
132
|
+
Strict-Transport-Security:
|
|
133
|
+
- max-age=31536000; includeSubdomains; preload
|
|
134
|
+
Content-Security-Policy:
|
|
135
|
+
- default-src 'none'; frame-ancestors 'none'
|
|
136
|
+
X-Content-Type-Options:
|
|
137
|
+
- nosniff
|
|
138
|
+
X-Request-Id:
|
|
139
|
+
- 771d7c8fddba2e62d5afc2f75deb06de
|
|
140
|
+
body:
|
|
141
|
+
encoding: UTF-8
|
|
142
|
+
string: '{"transaction":{"id":"5d18a649451afb07969de6f4","test":true,"merchantId":"<PAYLIKE_MERCHANT_ID>","created":"2019-06-30T12:08:42.816Z","amount":1000,"refundedAmount":0,"capturedAmount":500,"voidedAmount":0,"pendingAmount":500,"disputedAmount":0,"card":{"bin":"410000","last4":"0000","expiry":"2020-08-31T21:59:59.999Z","code":{"present":true},"scheme":"visa"},"tds":"none","currency":"EUR","custom":null,"recurring":false,"successful":true,"error":false,"descriptor":"A
|
|
143
|
+
test descriptor","trail":[{"fee":{"flat":191,"rate":92},"amount":500,"balance":3379,"created":"2019-06-30T12:08:43.445Z","capture":true,"descriptor":"A
|
|
144
|
+
test descriptor","lineId":"5d18a64b094009078f08f0ce"}]}}'
|
|
145
|
+
http_version:
|
|
146
|
+
recorded_at: Sun, 30 Jun 2019 12:08:43 GMT
|
|
147
|
+
- request:
|
|
148
|
+
method: post
|
|
149
|
+
uri: https://api.paylike.io/transactions/5d18a649451afb07969de6f4/refunds
|
|
150
|
+
body:
|
|
151
|
+
encoding: UTF-8
|
|
152
|
+
string: '{"amount":333}'
|
|
153
|
+
headers:
|
|
154
|
+
Authorization:
|
|
155
|
+
- Basic <AUTH_TOKEN>
|
|
156
|
+
Content-Type:
|
|
157
|
+
- application/json
|
|
158
|
+
Accept:
|
|
159
|
+
- application/json
|
|
160
|
+
Connection:
|
|
161
|
+
- close
|
|
162
|
+
Host:
|
|
163
|
+
- api.paylike.io
|
|
164
|
+
User-Agent:
|
|
165
|
+
- http.rb/4.1.1
|
|
166
|
+
response:
|
|
167
|
+
status:
|
|
168
|
+
code: 201
|
|
169
|
+
message: Created
|
|
170
|
+
headers:
|
|
171
|
+
Server:
|
|
172
|
+
- nginx
|
|
173
|
+
Date:
|
|
174
|
+
- Sun, 30 Jun 2019 12:08:44 GMT
|
|
175
|
+
Content-Type:
|
|
176
|
+
- application/json; charset=utf-8
|
|
177
|
+
Transfer-Encoding:
|
|
178
|
+
- chunked
|
|
179
|
+
Connection:
|
|
180
|
+
- close
|
|
181
|
+
Strict-Transport-Security:
|
|
182
|
+
- max-age=31536000; includeSubdomains; preload
|
|
183
|
+
Content-Security-Policy:
|
|
184
|
+
- default-src 'none'; frame-ancestors 'none'
|
|
185
|
+
X-Content-Type-Options:
|
|
186
|
+
- nosniff
|
|
187
|
+
X-Request-Id:
|
|
188
|
+
- f7135e27cd40516fa38b014f8bd747b0
|
|
189
|
+
body:
|
|
190
|
+
encoding: UTF-8
|
|
191
|
+
string: '{"transaction":{"id":"5d18a649451afb07969de6f4","test":true,"merchantId":"<PAYLIKE_MERCHANT_ID>","created":"2019-06-30T12:08:42.816Z","amount":1000,"refundedAmount":333,"capturedAmount":500,"voidedAmount":0,"pendingAmount":500,"disputedAmount":0,"card":{"bin":"410000","last4":"0000","expiry":"2020-08-31T21:59:59.999Z","code":{"present":true},"scheme":"visa"},"tds":"none","currency":"EUR","custom":null,"recurring":false,"successful":true,"error":false,"descriptor":"A
|
|
192
|
+
test descriptor","trail":[{"fee":{"flat":191,"rate":92},"amount":500,"balance":3379,"created":"2019-06-30T12:08:43.445Z","capture":true,"descriptor":"A
|
|
193
|
+
test descriptor","lineId":"5d18a64b094009078f08f0ce"},{"fee":{"flat":0,"rate":-61},"amount":333,"balance":-2378,"created":"2019-06-30T12:08:43.902Z","refund":true,"descriptor":"A
|
|
194
|
+
test descriptor","lineId":"5d18a64b451afb07969de6f5"}]}}'
|
|
195
|
+
http_version:
|
|
196
|
+
recorded_at: Sun, 30 Jun 2019 12:08:44 GMT
|
|
197
|
+
recorded_with: VCR 5.0.0
|
metadata
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: paylike.rb
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Stas SUȘCOV
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-06-30 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: http-rest_client
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: ffaker
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rspec
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rubocop-performance
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rubocop-rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: simplecov
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: vcr
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: webmock
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: yardstick
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - ">="
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '0'
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - ">="
|
|
165
|
+
- !ruby/object:Gem::Version
|
|
166
|
+
version: '0'
|
|
167
|
+
description: Ruby SDK for working with Paylike payment services.
|
|
168
|
+
email:
|
|
169
|
+
- stas@nerd.ro
|
|
170
|
+
executables: []
|
|
171
|
+
extensions: []
|
|
172
|
+
extra_rdoc_files: []
|
|
173
|
+
files:
|
|
174
|
+
- ".github/main.workflow"
|
|
175
|
+
- ".gitignore"
|
|
176
|
+
- ".rubocop.yml"
|
|
177
|
+
- ".yardstick.yml"
|
|
178
|
+
- CODE_OF_CONDUCT.md
|
|
179
|
+
- Gemfile
|
|
180
|
+
- Gemfile.lock
|
|
181
|
+
- LICENSE.txt
|
|
182
|
+
- README.md
|
|
183
|
+
- Rakefile
|
|
184
|
+
- lib/paylike.rb
|
|
185
|
+
- lib/paylike/gateway.rb
|
|
186
|
+
- lib/paylike/resource.rb
|
|
187
|
+
- lib/paylike/version.rb
|
|
188
|
+
- paylike.rb.gemspec
|
|
189
|
+
- vcr_cassettes/paylike-paylike-transaction-all.yml
|
|
190
|
+
- vcr_cassettes/paylike-paylike-transaction-create-creates-and-voids.yml
|
|
191
|
+
- vcr_cassettes/paylike-paylike-transaction-create-creates-captures-and-refunds.yml
|
|
192
|
+
homepage: https://github.com/luneteyewear/paylike
|
|
193
|
+
licenses:
|
|
194
|
+
- MIT
|
|
195
|
+
metadata: {}
|
|
196
|
+
post_install_message:
|
|
197
|
+
rdoc_options: []
|
|
198
|
+
require_paths:
|
|
199
|
+
- lib
|
|
200
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
|
+
requirements:
|
|
202
|
+
- - ">="
|
|
203
|
+
- !ruby/object:Gem::Version
|
|
204
|
+
version: '0'
|
|
205
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
|
+
requirements:
|
|
207
|
+
- - ">="
|
|
208
|
+
- !ruby/object:Gem::Version
|
|
209
|
+
version: '0'
|
|
210
|
+
requirements: []
|
|
211
|
+
rubygems_version: 3.0.1
|
|
212
|
+
signing_key:
|
|
213
|
+
specification_version: 4
|
|
214
|
+
summary: Paylike Ruby SDK
|
|
215
|
+
test_files: []
|