monetico_payment 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/MIT-LICENSE.txt +40 -0
- data/README.md +119 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/monetico_payment.rb +146 -0
- data/lib/monetico_payment/version.rb +2 -0
- data/monetico_payment.gemspec +42 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e79ecc56e7764a3a13c99a4013d301c9cb42842
|
4
|
+
data.tar.gz: 19d5451fb216a59b7cbc441907a4c1d0adfc48e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '00559e3a2b5f78e7716410b0ff0839587787b62ad349aea85d93e0ea9c649b96ffc033e6508346d932dc7b2382ea01f2174ab351b866589fcf5d5d5b33c64977'
|
7
|
+
data.tar.gz: 96b537d1a77aedb724c3481712cb8bc8127b495b056e5c741f723c3c3efd4e8eeb757657dd663848fc6cc879bb8800818e88c4207d1796f910ff215802e24fa0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
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 conan@conandalton.net. 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/MIT-LICENSE.txt
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 conan dalton <conan@conandalton.net>
|
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.
|
22
|
+
|
23
|
+
Extra license terms:
|
24
|
+
|
25
|
+
In particular, this software may not be compliant with any version of monetico,
|
26
|
+
it may not work, it may send money in the wrong direction, it may siphon cash away
|
27
|
+
to untraceable offshore accounts, it may cause you to get fired, sued, bankrupt and/or
|
28
|
+
divorced, and also lose your hair and/or custody of your children. By using this software you
|
29
|
+
indemnify, defend, and hold harmless the authors, copyright holders, and relevant
|
30
|
+
financial institutions from liability and damages of any kind arising directly or indirectly
|
31
|
+
from the use of this software.
|
32
|
+
|
33
|
+
By using this software you agree that you are using the software entirely at your own risk
|
34
|
+
and peril, and that you have inspected the source code of the software and that you have
|
35
|
+
satisfied yourself that the software does exactly what you expect it to do.
|
36
|
+
|
37
|
+
The original author is not in any way connected to or affiliated with Monetico, Crédit Mutuel,
|
38
|
+
CIC, or Euro-Information. No banking or financial institution has authorised, financed,
|
39
|
+
approved, verified or condoned this software. All trademarks are registered trademarks
|
40
|
+
of their respective owners.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# MoneticoPayment
|
2
|
+
|
3
|
+
Please take note of these important license terms, copied from "MIT-LICENSE.txt"
|
4
|
+
|
5
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
6
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
7
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
8
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
9
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
10
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
11
|
+
THE SOFTWARE.
|
12
|
+
|
13
|
+
In particular, this software is not suitable for production use, may not be compliant
|
14
|
+
with any version of monetico, it may not work, it may send money in the wrong direction or
|
15
|
+
to the wrong place, in particular to untraceable offshore accounts, it may cause you to get
|
16
|
+
fired, sued, bankrupt and/or divorced, and also lose your hair and/or custody of your children.
|
17
|
+
By using this software you indemnify, defend, and hold harmless the authors, copyright
|
18
|
+
holders, and financial institutions from liability and damages of any kind arising
|
19
|
+
directly or indirectly from the use of this software.
|
20
|
+
|
21
|
+
By using this software you agree that you are using the software entirely at your own risk
|
22
|
+
and peril, and that you have inspected the source code of the software and that you have
|
23
|
+
satisfied yourself that the software does exactly what you expect it to do.
|
24
|
+
|
25
|
+
The author is not in any way connected to or affiliated with Monetico, Crédit Mutuel, CIC, or
|
26
|
+
Euro-Information. No banking or financial institution has authorised, financed,
|
27
|
+
approved, verified or condoned this software. All trademarks are registered trademarks
|
28
|
+
of their respective owners.
|
29
|
+
|
30
|
+
================
|
31
|
+
|
32
|
+
You may prefer to use the development kit downloadable here:
|
33
|
+
https://www.monetico-paiement.fr/fr/installer/telechargements.html
|
34
|
+
|
35
|
+
|
36
|
+
## Installation
|
37
|
+
|
38
|
+
Add this line to your application's Gemfile:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
gem 'monetico_payment'
|
42
|
+
```
|
43
|
+
|
44
|
+
And then execute:
|
45
|
+
|
46
|
+
$ bundle
|
47
|
+
|
48
|
+
Or install it yourself as:
|
49
|
+
|
50
|
+
$ gem install monetico_payment
|
51
|
+
|
52
|
+
## Usage
|
53
|
+
|
54
|
+
### message validation
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
params = request.request_parameters # or whatever you use to get POST params
|
58
|
+
mp = MoneticoPayment.new(secret_key)
|
59
|
+
valid = mp.validate(params) # true if MAC matches ; false otherwise
|
60
|
+
```
|
61
|
+
|
62
|
+
|
63
|
+
### message creation
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
billing_info = { # make sure you have at least these keys, see docs for others
|
67
|
+
civility: "",
|
68
|
+
firstName: "",
|
69
|
+
lastName: "",
|
70
|
+
addressLine1: "",
|
71
|
+
city: "",
|
72
|
+
postalCode: "",
|
73
|
+
country: "",
|
74
|
+
email: "",
|
75
|
+
mobilePhone: ""
|
76
|
+
}
|
77
|
+
|
78
|
+
mp = MoneticoPayment.new(key: secret_key,
|
79
|
+
tpe: "1234567",
|
80
|
+
date: Time.now,
|
81
|
+
montant: "12.34",
|
82
|
+
currency: "EUR",
|
83
|
+
reference: "F-19/3475" # invoice number or whatever
|
84
|
+
url_retour_ok: "https://dom.example.com/pay/success",
|
85
|
+
url_retour_err: "https://dom.example.com/pay/failure",
|
86
|
+
lgue: "FR",
|
87
|
+
societe: "Ma Societe",
|
88
|
+
contexte_commande: { billing: billing_info },
|
89
|
+
texte_libre: "Ton argent est notre priorite",
|
90
|
+
mail: "client-name@son-domain.example.com" ) # mail: optional
|
91
|
+
|
92
|
+
|
93
|
+
# if you want to submit a form, use #hidden_inputs :
|
94
|
+
|
95
|
+
<form action="https://whatever-monetico-url-you-are-using/"><%= mp.hidden_inputs %></form>
|
96
|
+
|
97
|
+
# if you're showing monetico in an iframe, use #iframe_params :
|
98
|
+
|
99
|
+
<iframe src="https://whatever-monetico-url-you-are-using/?<%= mp.iframe_params %>"/>
|
100
|
+
|
101
|
+
```
|
102
|
+
|
103
|
+
## Development
|
104
|
+
|
105
|
+
After checking out the repo, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
106
|
+
|
107
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
108
|
+
|
109
|
+
## Contributing
|
110
|
+
|
111
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/conanite/monetico_payment. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
112
|
+
|
113
|
+
## License
|
114
|
+
|
115
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
116
|
+
|
117
|
+
## Code of Conduct
|
118
|
+
|
119
|
+
Everyone interacting in the MoneticoPayment project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/conanite/monetico_payment/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "monetico_payment"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'openssl'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
#
|
5
|
+
# Please take note of these important license terms, and even more important extra license terms, copied from "MIT-LICENSE.txt"
|
6
|
+
#
|
7
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
8
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
9
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
10
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
11
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
12
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
13
|
+
# THE SOFTWARE.
|
14
|
+
#
|
15
|
+
# Extra license terms:
|
16
|
+
#
|
17
|
+
# In particular, this software may not be compliant with any version of monetico,
|
18
|
+
# it may not work, it may send money in the wrong direction, it may siphon cash away
|
19
|
+
# to untraceable offshore accounts, it may cause you to get fired, sued, bankrupt and/or
|
20
|
+
# divorced, and also lose your hair and/or custody of your children. By using this software you
|
21
|
+
# indemnify, defend, and hold harmless the authors, copyright holders, and relevant
|
22
|
+
# financial institutions from liability and damages of any kind arising directly or indirectly
|
23
|
+
# from the use of this software.
|
24
|
+
#
|
25
|
+
# By using this software you agree that you are using the software entirely at your own risk
|
26
|
+
# and peril, and that you have inspected the source code of the software and that you have
|
27
|
+
# satisfied yourself that the software does exactly what you expect it to do.
|
28
|
+
#
|
29
|
+
# The author is not in any way connected to or affiliated with Monetico, Crédit Mutuel, CIC, or
|
30
|
+
# Euro-Information. No banking or financial institution has authorised, financed,
|
31
|
+
# approved, verified or condoned this software. All trademarks are registered trademarks
|
32
|
+
# of their respective owners.
|
33
|
+
#
|
34
|
+
# ================
|
35
|
+
#
|
36
|
+
# You may prefer to use the development kit downloadable here:
|
37
|
+
# https://www.monetico-paiement.fr/fr/installer/telechargements.html
|
38
|
+
#
|
39
|
+
# usage :
|
40
|
+
#
|
41
|
+
# message validation
|
42
|
+
#
|
43
|
+
# params = request.request_parameters # or whatever you use to get POST params
|
44
|
+
# mp = MoneticoPayment.new(secret_key)
|
45
|
+
# valid = mp.validate # true if MAC matches ; false otherwise
|
46
|
+
#
|
47
|
+
#
|
48
|
+
# message creation
|
49
|
+
#
|
50
|
+
# billing_info = { # make sure you have at least these keys, see docs for others
|
51
|
+
# civility: "",
|
52
|
+
# firstName: "",
|
53
|
+
# lastName: "",
|
54
|
+
# addressLine1: "",
|
55
|
+
# city: "",
|
56
|
+
# postalCode: "",
|
57
|
+
# country: "",
|
58
|
+
# email: "",
|
59
|
+
# mobilePhone: ""
|
60
|
+
# }
|
61
|
+
#
|
62
|
+
# mp = MoneticoPayment.new(key: secret_key,
|
63
|
+
# tpe: "1234567",
|
64
|
+
# date: Time.now,
|
65
|
+
# montant: "12.34",
|
66
|
+
# currency: "EUR",
|
67
|
+
# reference: "F-19/3475" # invoice number or whatever
|
68
|
+
# url_retour_ok: "https://dom.example.com/pay/success",
|
69
|
+
# url_retour_err: "https://dom.example.com/pay/failure",
|
70
|
+
# lgue: "FR",
|
71
|
+
# societe: "Ma Societe",
|
72
|
+
# contexte_commande: { billing: billing_info },
|
73
|
+
# texte_libre: "Ton argent est notre priorite",
|
74
|
+
# mail: "client-name@son-domain.example.com" ) # mail: optional
|
75
|
+
#
|
76
|
+
# mp.hidden_inputs # returns HTML string you just integrate into your form
|
77
|
+
#
|
78
|
+
#
|
79
|
+
class MoneticoPayment < Aduki::Initializable
|
80
|
+
ATTRS = { "version" => { value: ->(mp) { mp.version || "3.0" } },
|
81
|
+
"tpe" => { name: "TPE" },
|
82
|
+
"date" => { value: ->(mp) { mp.date.strftime("%d/%m/%Y:%H:%M:%S") } },
|
83
|
+
"montant" => { value: ->(mp) { ("%.2f" % mp.montant) + (mp.currency || "EUR") } },
|
84
|
+
"reference" => { },
|
85
|
+
"url_retour_ok" => { },
|
86
|
+
"url_retour_err" => { },
|
87
|
+
"lgue" => { },
|
88
|
+
"societe" => { },
|
89
|
+
"contexte_commande" => { value: ->(mp) { Base64.strict_encode64(mp.contexte_commande.to_json).strip } },
|
90
|
+
"texte_libre" => { name: "texte-libre" },
|
91
|
+
"mail" => { },
|
92
|
+
}
|
93
|
+
attr_accessor :key, :currency, *(ATTRS.keys)
|
94
|
+
|
95
|
+
# POST params only, ignore query params and other params ; in rails use req.request_parameters
|
96
|
+
# assumes params keys are symbols
|
97
|
+
def validate params, logger=nil
|
98
|
+
given_mac = params.delete(:MAC).upcase
|
99
|
+
message = params.keys.map(&:to_s).sort.map { |f| "#{f}=#{params[f.to_sym]}" }.join('*')
|
100
|
+
calc_mac = hmac_sha1(hmac_key, message).upcase
|
101
|
+
if logger
|
102
|
+
logger.info "MoneticoPayment#validate: given MAC is #{given_mac.inspect}"
|
103
|
+
logger.info "MoneticoPayment#validate: message is #{message.inspect}"
|
104
|
+
logger.info "MoneticoPayment#validate: calculated mac is #{calc_mac.inspect}"
|
105
|
+
end
|
106
|
+
given_mac == calc_mac
|
107
|
+
end
|
108
|
+
|
109
|
+
def hash_data_item attr, cfg, name=cfg[:name], val=cfg[:value]
|
110
|
+
[(name ? name : attr), (val ? val.call(self) : send(attr))]
|
111
|
+
end
|
112
|
+
|
113
|
+
def attr_name a ; ATTRS[a][:name] ? ATTRS[a][:name] : a ; end
|
114
|
+
def map_attrs ; ATTRS.keys.sort_by { |k| attr_name(k) }.map { |a| yield a } ; end
|
115
|
+
def hash_data ; map_attrs { |a| hash_data_item(a, ATTRS[a]).join("=") }.join('*') ; end
|
116
|
+
def hidden_input n, v ; "<input type='hidden' name='#{n}' value='#{v}'/>" ; end
|
117
|
+
def other_hidden_inputs ; map_attrs { |a| hidden_input *hash_data_item(a, ATTRS[a]) }.join ; end
|
118
|
+
def mac_hidden_input ; hidden_input :MAC, mac ; end
|
119
|
+
def hidden_inputs ; mac_hidden_input + other_hidden_inputs ; end
|
120
|
+
def mac ; hmac_sha1(hmac_key, hash_data) ; end
|
121
|
+
def hmac_sha1 k, data ; OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha1"), k, data) ; end
|
122
|
+
|
123
|
+
def percent_encode s
|
124
|
+
s.gsub('%', '%25').gsub(/[ \n"\!\#\$\'\(\)\*\+\,:;=@\&\?.<>\\^_`{\|}~\[\]\/]/) { |x| "%%%2X" % x.ord }
|
125
|
+
end
|
126
|
+
|
127
|
+
def iframe_param k, v ; "#{k}=#{percent_encode v}" ; end
|
128
|
+
def iframe_value a ; hash_data_item(a, ATTRS[a])[1] ; end
|
129
|
+
def iframe_params ; ([iframe_param(:MAC, mac)] + map_attrs { |a| iframe_param(a, iframe_value(a)) }).join("&") ; end
|
130
|
+
|
131
|
+
def hmac_key
|
132
|
+
k0 = key[0..37]
|
133
|
+
k1 = key[38..40] + "00"
|
134
|
+
cca0 = k1.ord
|
135
|
+
|
136
|
+
k0 += if cca0>70 and cca0<97
|
137
|
+
(cca0-23).chr + k1[1..2]
|
138
|
+
elsif k1[1..2] == "M"
|
139
|
+
k1[0..1] + "0"
|
140
|
+
else
|
141
|
+
k1[0..2]
|
142
|
+
end
|
143
|
+
|
144
|
+
[k0].pack("H*")
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "monetico_payment"
|
7
|
+
spec.version = "0.2.0"
|
8
|
+
spec.authors = ["conanite"]
|
9
|
+
spec.email = ["conan@conandalton.net"]
|
10
|
+
|
11
|
+
spec.summary = %q{Simple implementation for one-shot monetico payments}
|
12
|
+
spec.description = %q{Simple implementation for one-shot monetico payments. Generates and validates MAC parameter. }
|
13
|
+
spec.homepage = "https://github.com/conanite/monetico_payments"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["source_code_uri"] = "https://github.com/conanite/monetico_payments"
|
23
|
+
else
|
24
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
+
"public gem pushes."
|
26
|
+
end
|
27
|
+
|
28
|
+
# Specify which files should be added to the gem when it is released.
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
30
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
31
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
32
|
+
end
|
33
|
+
spec.bindir = "exe"
|
34
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
|
+
spec.require_paths = ["lib"]
|
36
|
+
|
37
|
+
spec.add_dependency 'aduki', '>= 0.2.7'
|
38
|
+
|
39
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
41
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: monetico_payment
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- conanite
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aduki
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.17'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.17'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: 'Simple implementation for one-shot monetico payments. Generates and
|
70
|
+
validates MAC parameter. '
|
71
|
+
email:
|
72
|
+
- conan@conandalton.net
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- CODE_OF_CONDUCT.md
|
81
|
+
- Gemfile
|
82
|
+
- MIT-LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/monetico_payment.rb
|
88
|
+
- lib/monetico_payment/version.rb
|
89
|
+
- monetico_payment.gemspec
|
90
|
+
homepage: https://github.com/conanite/monetico_payments
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata:
|
94
|
+
allowed_push_host: https://rubygems.org
|
95
|
+
homepage_uri: https://github.com/conanite/monetico_payments
|
96
|
+
source_code_uri: https://github.com/conanite/monetico_payments
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.5.2.3
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: Simple implementation for one-shot monetico payments
|
117
|
+
test_files: []
|