tazapay 0.1.3 → 0.1.5

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: b450d94fc7d24206476c392110db8e1defd931c6a8b9f31b127ecbe1f4ff6cf0
4
- data.tar.gz: 6c082cdd772f23a90fc78ed6aadd8d4d0ab0538ec7254d3c6dbe7f229a6e6537
3
+ metadata.gz: 07b9584c36266973e75bc7d6d4ce1f969e4b054525a753ecc07d26349ccbf615
4
+ data.tar.gz: 330a8ac22f82e147c931ad4e766fc81dfd127a515a798373d32fb8282059dbfe
5
5
  SHA512:
6
- metadata.gz: 07f5a205b8d63fa6459e9ca0af995e3b215c358761fd444bc8b9100451c2f1d6106ba4f179785ec7f3908022d5f1f2a408dec31366d3c0f61429508f0760698e
7
- data.tar.gz: b2c84373e543b873bd1aac04dcb33802db28e02ed0ea391b9b7ef0723dd298ec813dcafd1ca9b5c4bc40f4e10da88ce817eee61048e8cd56796fbeaeed478884
6
+ metadata.gz: ce96528de07357f85026e36f57f356a5527227d087dfd41fb1be36975c52bf05abe388e2b50b0db8918bed87449ec8f17f38e5402f6c33bedcfcc9b06a38c99f
7
+ data.tar.gz: 3ad2d4965e04818a02bc2b2307ecd829857f94461d399fb1f71df96caca1c3bcc3665188ccf0954e45f78cd467b705970391c4bdc2e39210230920ce8e45ad9e
data/CHANGELOG.md CHANGED
@@ -19,3 +19,16 @@
19
19
  ## [0.1.3] - 2023-02-25
20
20
 
21
21
  - Add Metadata API
22
+
23
+
24
+ ## [0.1.4] - 2023-02-25
25
+
26
+ - Add Escrow API
27
+
28
+
29
+ ## [0.1.5] - 2023-02-25
30
+
31
+ - Add Release API
32
+ - Add Refund API
33
+
34
+
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tazapay (0.1.3)
4
+ tazapay (0.1.5)
5
5
  faraday (~> 1.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Tazapay API ruby client
4
4
 
5
+ https://docs.tazapay.com/reference/introduction
5
6
 
6
7
  ## Installation
7
8
 
@@ -104,8 +105,44 @@ tazapay_bank.make_primary(bank_id: bank_id, account_id: user_id)
104
105
 
105
106
  ```
106
107
 
107
- See more details in tests
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
+ ### Release
127
+ ```ruby
108
128
 
129
+ # See https://docs.tazapay.com/reference/release-api
130
+ Tazapay::Release.new.release(txn_no: txn_no)
131
+
132
+ ```
133
+
134
+ ### Refund
135
+
136
+ ```ruby
137
+
138
+ tazapay_refund = Tazapay::Refund.new
139
+ # See https://docs.tazapay.com/reference/refund-api
140
+ tazapay_refund.request(txn_no: txn_no)
141
+
142
+ # See https://docs.tazapay.com/reference/refund-status-api
143
+ tazapay_refund.status(txn_no)
144
+
145
+ ```
109
146
 
110
147
  ### Metadata
111
148
 
@@ -114,21 +151,35 @@ See more details in tests
114
151
  tazapay_metadata = Tazapay::Metadata.new
115
152
 
116
153
  # See https://docs.tazapay.com/reference/country-configuration-api
154
+ country = "TH"
117
155
  tazapay_metadata.country_config(country)
118
156
 
119
157
  # See https://docs.tazapay.com/reference/invoice-currency-api
120
- tazapay_metadata.invoice_currency(buyer_country:, seller_country:)
158
+ tazapay_metadata.invoice_currency(
159
+ buyer_country: "US", seller_country: "TH"
160
+ )
121
161
 
122
162
  # See https://docs.tazapay.com/reference/collection-methods-api
123
- tazapay_metadata.collection_methods(buyer_country:, seller_country:, invoice_currency:, amount:)
163
+ tazapay_metadata.collection_methods(
164
+ buyer_country: "US",
165
+ seller_country: "TH"
166
+ invoice_currency: "USD",
167
+ amount: 100
168
+ )
124
169
 
125
170
  # See https://docs.tazapay.com/reference/disburse-methods-api
126
- tazapay_metadata.disbursement_methods(buyer_country:, seller_country:, invoice_currency:, amount:)
171
+ tazapay_metadata.disbursement_methods(
172
+ buyer_country: "US",
173
+ seller_country: "TH"
174
+ invoice_currency: "USD",
175
+ amount: 100
176
+ )
127
177
 
128
178
  # Doc upload URL
129
179
  tazapay_metadata.doc_upload_url
130
180
 
131
181
  # KYB Doc
182
+ country = "TH"
132
183
  tazapay_metadata.kyb_doc(country)
133
184
 
134
185
  # See https://docs.tazapay.com/reference/get-milestone-schemes
@@ -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,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tazapay/config"
4
+ require "tazapay/client"
5
+
6
+ module Tazapay
7
+ # Refund API
8
+ class Refund < Client
9
+ def request(txn_no:, amount: nil, callback_url: nil, remarks: nil, documents: nil)
10
+ path = "/v1/payment/refund/request"
11
+ data = {
12
+ txn_no: txn_no,
13
+ amount: amount,
14
+ remarks: remarks,
15
+ callback_url: callback_url,
16
+ documents: documents
17
+ }
18
+ send_request(method: :post, path: path, body: data)
19
+ end
20
+
21
+ def status(txn_no)
22
+ path = "/v1/payment/refund/status?txn_no=#{txn_no}"
23
+ send_request(method: :get, path: path)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tazapay/config"
4
+ require "tazapay/client"
5
+
6
+ module Tazapay
7
+ # Release API
8
+ class Release < Client
9
+ def release(txn_no:, release_docs:, callback_url:)
10
+ path = "/v1/session/release"
11
+ data = {
12
+ txn_no: txn_no,
13
+ release_docs: release_docs,
14
+ callback_url: callback_url
15
+ }
16
+ send_request(method: :post, path: path, body: data)
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tazapay
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.5"
5
5
  end
data/lib/tazapay.rb CHANGED
@@ -3,6 +3,9 @@
3
3
  require "tazapay/config"
4
4
  require "tazapay/version"
5
5
  require "tazapay/checkout"
6
+ require "tazapay/escrow"
7
+ require "tazapay/release"
8
+ require "tazapay/refund"
6
9
  require "tazapay/user"
7
10
  require "tazapay/bank"
8
11
  require "tazapay/metadata"
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.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Kuznetsov
@@ -88,7 +88,10 @@ files:
88
88
  - lib/tazapay/client.rb
89
89
  - lib/tazapay/config.rb
90
90
  - lib/tazapay/errors.rb
91
+ - lib/tazapay/escrow.rb
91
92
  - lib/tazapay/metadata.rb
93
+ - lib/tazapay/refund.rb
94
+ - lib/tazapay/release.rb
92
95
  - lib/tazapay/user.rb
93
96
  - lib/tazapay/version.rb
94
97
  - sig/tazapay.rbs