multicard 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83e277fb90b85d6ba4d0102b60ad62bf4356f7273c5b23fcdd3c0e5711e22d3d
4
- data.tar.gz: 7a1f25bfcfe356be1ee55b58d71c520102e6b9925d44d7434c21fdb94a9c3861
3
+ metadata.gz: 41b2116da3fd9724e750a8ace1d5803a09a14bf8eb11a58d323a4bc1235321cc
4
+ data.tar.gz: ced60479704e63bcfe013cef263bc9286368dc119da3448b373d97de53b14a74
5
5
  SHA512:
6
- metadata.gz: efc811a4c23204b0f617878a7bd2e769d5a21d4aa8bc2a2faaaa857c302cd4e460d6aa3c6ec6fa4f40c35a17afc62b00a579cbd605c51842bfa08b0c85968049
7
- data.tar.gz: 5800f6833e8304c7191f631d40421880281aced34fe9a15efb0105e92a3b36a9171de889ef1bc88555d3c25bf3dc697eac1b063e3743b1b770e55107fb3b7655
6
+ metadata.gz: c1a4f60027a4d7af9d865d434abb4853112051873f7cb86a6d34873b49c0f4dd32def71b7ba59db0f1a45941164536660c34f72f85935354746bca666cb3bf01
7
+ data.tar.gz: d29d537327f473bcdf8931c83a416ca7a4849607011f4e37b8d6a1c2afcd59772515bdac8dc69107f771ca5c1e611e9b98064159431b06682e5ee70abc5e5bd9
data/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.0] - 2026-06-22
9
+
10
+ ### Fixed
11
+
12
+ - `Payments#partial_refund` now uses the correct Multicard endpoint
13
+ `DELETE /payment/{uuid}/partial` with body `{ refund_amount, ofd, card_pan? }`.
14
+ Previously it issued `POST /payment/{uuid}/refund/partial { amount }` (wrong
15
+ verb, path, and missing the mandatory `ofd` fiscal array).
16
+
17
+ ### Changed
18
+
19
+ - **Breaking:** `Payments#partial_refund` signature is now
20
+ `partial_refund(payment_id, refund_amount:, ofd:, card_pan: nil)`
21
+ (was `partial_refund(payment_id, amount:)`). `ofd` is required (the original
22
+ receipt is cancelled and a new one issued for the remaining items); `card_pan`
23
+ is optional and only used for wallet apps (Payme/Click).
24
+ - `HttpClient#delete` and `Resources::Base#delete` now accept an optional JSON
25
+ `body:`, enabling DELETE-with-body requests.
26
+
8
27
  ## [0.1.1] - 2026-02-21
9
28
 
10
29
  ### Changed
@@ -12,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
31
  - Updated gem author metadata
13
32
  - Replaced HTTP.rb with Net::HTTP (zero runtime dependencies)
14
33
 
15
- ## [0.1.0] - 2026-02-16
34
+ ## [0.1.0] - 2026-02-21
16
35
 
17
36
  ### Added
18
37
 
data/README.md CHANGED
@@ -210,8 +210,16 @@ client.payments.confirm('payment-uuid', otp_code: '123456')
210
210
  # Full refund
211
211
  client.payments.refund('payment-uuid')
212
212
 
213
- # Partial refund
214
- client.payments.partial_refund('payment-uuid', amount: 100_000)
213
+ # Partial refund — cancels the original fiscal receipt and issues a new one
214
+ # for the remaining items, so the `ofd` array is mandatory.
215
+ client.payments.partial_refund(
216
+ 'payment-uuid',
217
+ refund_amount: 100_000,
218
+ ofd: [{ vat_percent: 12, price: 100_000, amount: 1, package_code: '1234567', mxik: '08110' }]
219
+ )
220
+
221
+ # Wallet refunds (Payme/Click) additionally require the masked PAN:
222
+ client.payments.partial_refund('payment-uuid', refund_amount: 100_000, ofd: [...], card_pan: '8600****1234')
215
223
  ```
216
224
 
217
225
  ### Fiscal Receipt
@@ -51,7 +51,7 @@ module Multicard
51
51
  # The 401 retry in authenticated_request is still applied (token refresh).
52
52
  @http_client.post(path, body: body || {}, headers: headers)
53
53
  when :delete
54
- @http_client.delete(path, params: params || {}, headers: headers)
54
+ @http_client.delete(path, body: body, params: params || {}, headers: headers)
55
55
  else
56
56
  raise ArgumentError, "Unsupported HTTP method: #{method}"
57
57
  end
@@ -11,7 +11,7 @@ module Multicard
11
11
  def initialize(**options)
12
12
  @application_id = options[:application_id]
13
13
  @secret = options[:secret]
14
- @base_url = options[:base_url] || DEFAULT_BASE_URL
14
+ @base_url = (options[:base_url] || DEFAULT_BASE_URL).chomp('/')
15
15
  @timeout = options[:timeout] || DEFAULT_TIMEOUT
16
16
  @open_timeout = options[:open_timeout] || DEFAULT_OPEN_TIMEOUT
17
17
  @logger = options[:logger]
@@ -18,8 +18,8 @@ module Multicard
18
18
  request(:post, path, body: body, headers: headers)
19
19
  end
20
20
 
21
- def delete(path, params: {}, headers: {})
22
- request(:delete, path, params: params, headers: headers)
21
+ def delete(path, body: nil, params: {}, headers: {})
22
+ request(:delete, path, body: body, params: params, headers: headers)
23
23
  end
24
24
 
25
25
  def get_with_retry(path, params: {}, headers: {}, retries: 2)
@@ -19,8 +19,8 @@ module Multicard
19
19
  @client.authenticated_request(:post, path, body: body)
20
20
  end
21
21
 
22
- def delete(path, params = {})
23
- @client.authenticated_request(:delete, path, params: params)
22
+ def delete(path, body: nil, params: {})
23
+ @client.authenticated_request(:delete, path, body: body, params: params)
24
24
  end
25
25
 
26
26
  def default_store_id
@@ -113,11 +113,20 @@ module Multicard
113
113
 
114
114
  # Partial refund.
115
115
  #
116
+ # Cancels the original fiscal receipt and issues a new one for the
117
+ # remaining items (the +ofd+ array is mandatory for partial refunds).
118
+ #
116
119
  # @param payment_id [String] payment ID (UUID)
117
- # @param amount [Integer] refund amount in tiyin
120
+ # @param refund_amount [Integer] refund amount in tiyin
121
+ # @param ofd [Array<Hash>] fiscal receipt items for the remaining goods
122
+ # @param card_pan [String, nil] masked PAN — required only for wallet apps (Payme/Click)
118
123
  # @return [Response]
119
- def partial_refund(payment_id, amount:)
120
- post("/payment/#{encode_path(payment_id)}/refund/partial", { amount: amount })
124
+ def partial_refund(payment_id, refund_amount:, ofd:, card_pan: nil)
125
+ delete("/payment/#{encode_path(payment_id)}/partial", body: {
126
+ refund_amount: refund_amount,
127
+ ofd: ofd,
128
+ card_pan: card_pan
129
+ }.compact)
121
130
  end
122
131
 
123
132
  # Submit a fiscal receipt link.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Multicard
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multicard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Skripin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-21 00:00:00.000000000 Z
11
+ date: 2026-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake