tazapay 0.1.2 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11df37a78614be73791738660b0c7b8c449101ea8e920bfff7b30b0f5e752a03
4
- data.tar.gz: 2f72d20bdc2498e817e3d7a2e4e202fc5e97c164f106b4c5fdbb639ab8a53bf1
3
+ metadata.gz: e0b1c4e1c460619a1c0d32fa1659d64d5e30921d55cc07f70eb255505ee54d47
4
+ data.tar.gz: acaae46c307775efad82a8d2f52182b13b4925f13c83e3db1ddc175e3d24ba6f
5
5
  SHA512:
6
- metadata.gz: 12ab6bdad83dc4f993114f82d152da5683a0c8f20153e71e0fbfdc5b6baebca426dbb2e27fcba7cb006f18803e78e0f924c82fc4c50005c456ee99815730d3e4
7
- data.tar.gz: 2e3b49a30e61533b7ecf4ca7c43f47b2aefb5a0213c939e9e4d5ffe9cd55182b7eb76c39ca8108c36d1861aff5acd49209fab4f573a4e0bae698da972934ff30
6
+ metadata.gz: 4b4f33ce3be28d3fbe05c2ea3a8c882fd742d7159c3e0eb6fcee2c1e20930c3adfa3e9853d69839f642189bc43778bf9c5e790dd58c04b0f9fee8ececd5f9732
7
+ data.tar.gz: 332c126a95936e2af45fd0294a345611d474ccfde7e280ff45286235e9bbaf6ff71f623d019cd10acad52144748f5baae055a817ab760afa9baf3d724110edc8
data/CHANGELOG.md CHANGED
@@ -15,3 +15,13 @@
15
15
 
16
16
  - Add Bank API
17
17
 
18
+
19
+ ## [0.1.3] - 2023-02-25
20
+
21
+ - Add Metadata API
22
+
23
+
24
+ ## [0.1.4] - 2023-02-25
25
+
26
+ - Add Escrow API
27
+
data/CODE_OF_CONDUCT.md CHANGED
@@ -39,7 +39,7 @@ This Code of Conduct applies within all community spaces, and also applies when
39
39
 
40
40
  ## Enforcement
41
41
 
42
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at a.kuznetsov@okft.io. All complaints will be reviewed and investigated promptly and fairly.
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at m2lxkuz@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
43
 
44
44
  All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
45
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tazapay (0.1.2)
4
+ tazapay (0.1.4)
5
5
  faraday (~> 1.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Tazapay
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tazapay`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Tazapay API ruby client
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ https://docs.tazapay.com/reference/introduction
6
6
 
7
7
  ## Installation
8
8
 
@@ -105,6 +105,67 @@ tazapay_bank.make_primary(bank_id: bank_id, account_id: user_id)
105
105
 
106
106
  ```
107
107
 
108
+ ### Escrow
109
+ ```ruby
110
+ tazapay_escrow = Tazapay::Escrow.new
111
+
112
+ # See https://docs.tazapay.com/reference/create-escrow-api
113
+ txn_no = tazapay_escrow.create(data)['data']['txn_no']
114
+
115
+ # See https://docs.tazapay.com/reference/get-escrow-summary-1
116
+ tazapay_escrow.summary(txn_no)
117
+
118
+ # See https://docs.tazapay.com/reference/escrow-status-api
119
+ tazapay_escrow.status(txn_no)
120
+
121
+ # See https://docs.tazapay.com/reference/create-payment-api
122
+ payment_url = tazapay_escrow.create_payment(txn_no)['data']['redirect_url']
123
+
124
+ ```
125
+
126
+ ### Metadata
127
+
128
+ ```ruby
129
+
130
+ tazapay_metadata = Tazapay::Metadata.new
131
+
132
+ # See https://docs.tazapay.com/reference/country-configuration-api
133
+ country = "TH"
134
+ tazapay_metadata.country_config(country)
135
+
136
+ # See https://docs.tazapay.com/reference/invoice-currency-api
137
+ tazapay_metadata.invoice_currency(
138
+ buyer_country: "US", seller_country: "TH"
139
+ )
140
+
141
+ # See https://docs.tazapay.com/reference/collection-methods-api
142
+ tazapay_metadata.collection_methods(
143
+ buyer_country: "US",
144
+ seller_country: "TH"
145
+ invoice_currency: "USD",
146
+ amount: 100
147
+ )
148
+
149
+ # See https://docs.tazapay.com/reference/disburse-methods-api
150
+ tazapay_metadata.disbursement_methods(
151
+ buyer_country: "US",
152
+ seller_country: "TH"
153
+ invoice_currency: "USD",
154
+ amount: 100
155
+ )
156
+
157
+ # Doc upload URL
158
+ tazapay_metadata.doc_upload_url
159
+
160
+ # KYB Doc
161
+ country = "TH"
162
+ tazapay_metadata.kyb_doc(country)
163
+
164
+ # See https://docs.tazapay.com/reference/get-milestone-schemes
165
+ tazapay_metadata.milestone_scheme
166
+
167
+ ```
168
+
108
169
  See more details in tests
109
170
 
110
171
 
data/lib/tazapay/bank.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Implementation of the MTN API remittances client
4
-
5
3
  require "tazapay/config"
6
4
  require "tazapay/client"
7
5
 
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Implementation of the MTN API remittances client
4
-
5
3
  require "tazapay/config"
6
4
  require "tazapay/client"
7
5
 
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Base implementation of the MTN API client
4
-
5
- # Includes methods common to collections, disbursements and remittances
6
-
7
3
  require "faraday"
8
4
 
9
5
  require "tazapay/config"
@@ -3,7 +3,7 @@
3
3
  # Error handling for unsuccessful responses from the Tazapay API
4
4
 
5
5
  module Tazapay
6
- # Stanadrd API error
6
+ # Standard API error
7
7
  class Error < StandardError
8
8
  attr_reader :code, :response_body
9
9
 
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tazapay/config"
4
+ require "tazapay/client"
5
+
6
+ module Tazapay
7
+ # Escrow API
8
+ class Escrow < Client
9
+ def create(data)
10
+ path = "/v1/escrow"
11
+ send_request(method: :post, path: path, body: data)
12
+ end
13
+
14
+ def summary(tx_no)
15
+ path = "/v1/escrow/#{tx_no}/summary"
16
+ send_request(method: :get, path: path)
17
+ end
18
+
19
+ def create_payment(data)
20
+ path = "/v1/session/payment"
21
+ send_request(method: :post, path: path, body: data)
22
+ end
23
+
24
+ def status(tx_no)
25
+ path = "/v1/escrow/#{tx_no}"
26
+ send_request(method: :get, path: path)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tazapay/config"
4
+ require "tazapay/client"
5
+
6
+ module Tazapay
7
+ # Metadata API
8
+ class Metadata < Client
9
+ def country_config(country)
10
+ path = "v1/metadata/countryconfig?country=#{country}"
11
+ send_request(method: :get, path: path)
12
+ end
13
+
14
+ def invoice_currency(buyer_country:, seller_country:)
15
+ path = "v1/metadata/invoicecurrency?buyer_country=#{buyer_country}&seller_country=#{seller_country}"
16
+ send_request(method: :get, path: path)
17
+ end
18
+
19
+ def collection_methods(buyer_country:, seller_country:, invoice_currency:, amount:)
20
+ path = "v1/metadata/collect?buyer_country=#{buyer_country}" \
21
+ "&seller_country=#{seller_country}&invoice_currency=#{invoice_currency}" \
22
+ "&amount=#{amount}"
23
+ send_request(method: :get, path: path)
24
+ end
25
+
26
+ def disbursement_methods(buyer_country:, seller_country:, invoice_currency:, amount:)
27
+ path = "v1/metadata/disburse?buyer_country=#{buyer_country}" \
28
+ "&seller_country=#{seller_country}&invoice_currency=#{invoice_currency}" \
29
+ "&amount=#{amount}"
30
+ send_request(method: :get, path: path)
31
+ end
32
+
33
+ def doc_upload_url
34
+ path = "/v1/metadata/doc/upload"
35
+ send_request(method: :get, path: path)
36
+ end
37
+
38
+ def kyb_doc(country)
39
+ path = "/v1/metadata/kyb/doc?country=#{country}"
40
+ send_request(method: :get, path: path)
41
+ end
42
+
43
+ def milestone_scheme
44
+ path = "v1/metadata/milestone/scheme"
45
+ send_request(method: :get, path: path)
46
+ end
47
+ end
48
+ end
data/lib/tazapay/user.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Implementation of the MTN API remittances client
4
-
5
3
  require "tazapay/config"
6
4
  require "tazapay/client"
7
5
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tazapay
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/tazapay.rb CHANGED
@@ -3,8 +3,10 @@
3
3
  require "tazapay/config"
4
4
  require "tazapay/version"
5
5
  require "tazapay/checkout"
6
+ require "tazapay/escrow"
6
7
  require "tazapay/user"
7
8
  require "tazapay/bank"
9
+ require "tazapay/metadata"
8
10
 
9
11
  # Head module
10
12
  module Tazapay
data/tazapay.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.name = "tazapay"
9
9
  spec.version = Tazapay::VERSION
10
10
  spec.authors = ["Alexey Kuznetsov"]
11
- spec.email = ["a.kuznetsov@okft.io"]
11
+ spec.email = ["m2lxkuz@gmail.com"]
12
12
 
13
13
  spec.summary = "Tazapay payments API ruby client"
14
14
  spec.description = "Tazapay payments API ruby client"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tazapay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Kuznetsov
@@ -68,7 +68,7 @@ dependencies:
68
68
  version: '3.18'
69
69
  description: Tazapay payments API ruby client
70
70
  email:
71
- - a.kuznetsov@okft.io
71
+ - m2lxkuz@gmail.com
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
@@ -88,6 +88,8 @@ files:
88
88
  - lib/tazapay/client.rb
89
89
  - lib/tazapay/config.rb
90
90
  - lib/tazapay/errors.rb
91
+ - lib/tazapay/escrow.rb
92
+ - lib/tazapay/metadata.rb
91
93
  - lib/tazapay/user.rb
92
94
  - lib/tazapay/version.rb
93
95
  - sig/tazapay.rbs