monopay-ruby 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -3
- data/Gemfile.lock +1 -5
- data/README.md +6 -2
- data/lib/monopay-ruby/invoices/simple_invoice.rb +7 -4
- data/lib/monopay-ruby/version.rb +1 -1
- data/monopay-ruby.gemspec +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a4c5b8555a208292b20a2769fbe598cd2efd59c594e039b05d8379e3fd01c39
|
4
|
+
data.tar.gz: ab1d3be69331294ecc21be5aad1a10656d0f075a0fce3fa11b91484b075f4cf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a9eb6011cc806b5c2f10d076dea0748004a527a1e036208fab3c3e51b43ac1647aaac2700b660dd3bd5db92fdeff94e0177e5b434d6513fc1eba4190248e76
|
7
|
+
data.tar.gz: 93faa86e2aa40b296e25a6a7806e134800bea8e0e14f892fcd81f0395bb16f6439e97e5a5c3c2ed973b6c6937854f756cf6cf7707594384afa39ef183782063e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
## [
|
1
|
+
## [0.1.1] - 2023-06-19
|
2
2
|
|
3
|
-
|
3
|
+
- Fix typo in a `README.md` file
|
4
|
+
- add ability to pass reference to an invoice by `reference` parameter in a `MonopayRuby::Invoices::SimpleInvoice::create` method
|
5
|
+
- Use named parameter of `destionation` for "MonopayRuby::Invoices::SimpleInvoice::create" method
|
4
6
|
|
5
|
-
-
|
7
|
+
## [0.1.0] - 2023-06-18
|
8
|
+
|
9
|
+
- Initial public release
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
monopay-ruby (0.1.
|
4
|
+
monopay-ruby (0.1.1)
|
5
5
|
base64 (~> 0.1.1)
|
6
6
|
json (~> 2.5)
|
7
7
|
money (~> 6.13)
|
8
|
-
openssl (~> 2.1)
|
9
8
|
rest-client (~> 2.1)
|
10
9
|
|
11
10
|
GEM
|
@@ -23,7 +22,6 @@ GEM
|
|
23
22
|
domain_name (~> 0.5)
|
24
23
|
i18n (1.14.1)
|
25
24
|
concurrent-ruby (~> 1.0)
|
26
|
-
ipaddr (1.2.5)
|
27
25
|
json (2.6.3)
|
28
26
|
method_source (1.0.0)
|
29
27
|
mime-types (3.4.1)
|
@@ -32,8 +30,6 @@ GEM
|
|
32
30
|
money (6.16.0)
|
33
31
|
i18n (>= 0.6.4, <= 2)
|
34
32
|
netrc (0.11.0)
|
35
|
-
openssl (2.2.3)
|
36
|
-
ipaddr
|
37
33
|
pry (0.14.2)
|
38
34
|
coderay (~> 1.1)
|
39
35
|
method_source (~> 1.0)
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Actions Status](https://github.com/loqimean/monopay-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/loqimean/monopay-ruby/actions)
|
2
|
+
|
1
3
|
# MonopayRuby
|
2
4
|
|
3
5
|
The "monopay-ruby" gem simplifies Monobank payment integration in Ruby and Rails applications. It provides an intuitive interface and essential functionalities for generating payment requests, verifying transactions, handling callbacks, and ensuring data integrity. With this gem, you can quickly and securely implement Monobank payments, saving development time and delivering a seamless payment experience to your users.
|
@@ -37,8 +39,10 @@ The second one - add to the environment variable:
|
|
37
39
|
MONOPAY_API_TOKEN=your_api_token
|
38
40
|
```
|
39
41
|
|
40
|
-
You can get the API token depending on the environment:
|
42
|
+
#### You can get the API token depending on the environment:
|
43
|
+
|
41
44
|
Development: [https://api.monobank.ua/](https://api.monobank.ua/)
|
45
|
+
|
42
46
|
Production: [https://fop.monobank.ua/](https://fop.monobank.ua/)
|
43
47
|
|
44
48
|
Just get the token and go to earn moneys! 🚀
|
@@ -54,7 +58,7 @@ class PaymentsController < ApplicationController
|
|
54
58
|
webhook_url: "https://example.com/payments/webhook"
|
55
59
|
)
|
56
60
|
|
57
|
-
if payment.create(amount: 100,
|
61
|
+
if payment.create(amount: 100, destination: "Payment description",)
|
58
62
|
# your success code processing
|
59
63
|
else
|
60
64
|
# your error code processing
|
@@ -4,11 +4,11 @@ require "money"
|
|
4
4
|
module MonopayRuby
|
5
5
|
module Invoices
|
6
6
|
class SimpleInvoice < MonopayRuby::Base
|
7
|
-
attr_reader :invoice_id, :page_url, :error_messages, :amount, :destination, :redirect_url, :webhook_url
|
7
|
+
attr_reader :invoice_id, :page_url, :error_messages, :amount, :destination, :reference, :redirect_url, :webhook_url
|
8
8
|
|
9
9
|
API_CREATE_INVOICE_URL = "#{API_URL}/merchant/invoice/create".freeze
|
10
10
|
|
11
|
-
|
11
|
+
DEFAULT_CURRENCY = "UAH".freeze
|
12
12
|
|
13
13
|
PAGE_URL_KEY = "pageUrl".freeze
|
14
14
|
INVOICE_ID_KEY = "invoiceId".freeze
|
@@ -28,11 +28,13 @@ module MonopayRuby
|
|
28
28
|
#
|
29
29
|
# @param [BigDecimal,Integer] amount in UAH (cents) to request payment
|
30
30
|
# @param [String] destination - additional info about payment
|
31
|
+
# @param [String] reference - bill number or other reference
|
31
32
|
# @return [Boolean] true if invoice was created successfully, false otherwise
|
32
|
-
def create(amount, destination
|
33
|
+
def create(amount, destination: nil, reference: nil)
|
33
34
|
begin
|
34
35
|
@amount = convert_to_cents(amount)
|
35
36
|
@destination = destination
|
37
|
+
@reference = reference
|
36
38
|
|
37
39
|
response = RestClient.post(API_CREATE_INVOICE_URL, request_body, headers)
|
38
40
|
response_body = JSON.parse(response.body)
|
@@ -64,6 +66,7 @@ module MonopayRuby
|
|
64
66
|
redirectUrl: redirect_url,
|
65
67
|
webHookUrl: webhook_url,
|
66
68
|
merchantPaymInfo: {
|
69
|
+
reference: reference,
|
67
70
|
destination: destination
|
68
71
|
}
|
69
72
|
}.to_json
|
@@ -71,7 +74,7 @@ module MonopayRuby
|
|
71
74
|
|
72
75
|
def convert_to_cents(amount)
|
73
76
|
if amount.is_a?(BigDecimal)
|
74
|
-
Money.from_amount(amount,
|
77
|
+
Money.from_amount(amount, DEFAULT_CURRENCY).cents
|
75
78
|
else
|
76
79
|
amount
|
77
80
|
end
|
data/lib/monopay-ruby/version.rb
CHANGED
data/monopay-ruby.gemspec
CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_dependency "rest-client", "~> 2.1"
|
38
38
|
spec.add_dependency "base64", "~> 0.1.1"
|
39
39
|
spec.add_dependency "json", "~> 2.5"
|
40
|
-
spec.add_dependency "openssl", "~> 2.1"
|
40
|
+
# spec.add_dependency "openssl", "~> 2.1"
|
41
41
|
spec.add_dependency "money", "~> 6.13"
|
42
42
|
|
43
43
|
spec.add_development_dependency "rspec", "~> 3.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monopay-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- loqimean
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.5'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: openssl
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.1'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.1'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: money
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|