paymos 1.7.0 → 1.7.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -5
- data/conformance/contract.json +1 -6
- data/lib/paymos/client.rb +1 -1
- data/lib/paymos/models.rb +2 -2
- data/lib/paymos/version.rb +1 -1
- data/sig/paymos.rbs +1 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 57b262c38d6cb857ca0d294ce81d4597f1bfbfa0424c547d1503d67c679f19e7
|
|
4
|
+
data.tar.gz: 78d77c7ea30e6bfa9a364b69518bd5ce815d4b4346c914adfef1ac684fcc063d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b7d6b4c2eb4e485f491498b66b15ea078c9ae1b5cfae766f0307a3a565b26ee5f08456f7a3a5c72e8a2b4314a7e5d33167f5a015478791dab5bc554b9de33c3
|
|
7
|
+
data.tar.gz: 8f10f5358a1b2a8d1e0946b1b4bab01064d05ca78ad1edeae824420dad5af26cd6f9beea2b3eefbf3b5cf63ad6751c24eeebfe7c3cc4badcd6b451b24a75a5f8
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -31,14 +31,13 @@ balances = paymos.balances.get
|
|
|
31
31
|
|
|
32
32
|
### Product line items (`products[]`)
|
|
33
33
|
|
|
34
|
-
Pass optional `products:` (`1..50` `Paymos::InvoiceProduct` instances or Hashes) to display purchase context on hosted checkout, or omit `products:` / pass `products: nil` for a compatible `amount-only` invoice. Each `Paymos::InvoiceProduct` requires `title:` (<= 200 Unicode scalar values), positive integer `quantity:`, and decimal string `unit_amount:` (in the invoice currency); `description:` (plain text, <= 2000 scalars)
|
|
34
|
+
Pass optional `products:` (`1..50` `Paymos::InvoiceProduct` instances or Hashes) to display purchase context on hosted checkout, or omit `products:` / pass `products: nil` for a compatible `amount-only` invoice. Each `Paymos::InvoiceProduct` requires `title:` (<= 200 Unicode scalar values), positive integer `quantity:`, and decimal string `unit_amount:` (in the invoice currency); `description:` (plain text, <= 2000 scalars) is an optional keyword and is omitted on the wire when `nil`.
|
|
35
35
|
|
|
36
36
|
```ruby
|
|
37
|
-
# 1-item invoice with optional description
|
|
37
|
+
# 1-item invoice with optional description
|
|
38
38
|
studio_pro = Paymos::InvoiceProduct.new(
|
|
39
39
|
title: "Studio Pro",
|
|
40
40
|
description: "One-month access",
|
|
41
|
-
image_url: "https://shop.example/images/studio-pro.webp",
|
|
42
41
|
quantity: 2,
|
|
43
42
|
unit_amount: "24.50"
|
|
44
43
|
)
|
|
@@ -50,7 +49,7 @@ single_invoice = paymos.invoices.create(
|
|
|
50
49
|
products: [studio_pro]
|
|
51
50
|
)
|
|
52
51
|
|
|
53
|
-
# Multi-item cart including a minimal 3-field item (no description
|
|
52
|
+
# Multi-item cart including a minimal 3-field item (no description)
|
|
54
53
|
cart_invoice = paymos.invoices.create(
|
|
55
54
|
project_id: "prj_...",
|
|
56
55
|
amount: "59.00",
|
|
@@ -69,7 +68,7 @@ end
|
|
|
69
68
|
|
|
70
69
|
- **Authoritative `amount`:** `amount` is the exact order total and is never recomputed from `sum(quantity * unit_amount)`.
|
|
71
70
|
- **First-success replay:** the first successful create freezes `order.products` on the invoice. Replaying the same `external_order_id` with unchanged `(amount, currency, network)` returns HTTP 200 with the original `Paymos::Invoice` and `order.products`, even if `products` changed; changing `(amount, currency, network)` raises `Paymos::ConflictError` (`409 invoice_idempotency_conflict`). Legacy and `amount-only` invoices return `order.products == nil`.
|
|
72
|
-
- **
|
|
71
|
+
- **Webhooks:** signed invoice webhooks omit `products`.
|
|
73
72
|
|
|
74
73
|
Responses are immutable Ruby objects with documented RBS signatures (`sig/paymos.rbs`); request
|
|
75
74
|
keywords remain idiomatic `snake_case` and are converted directly to the Paymos
|
data/conformance/contract.json
CHANGED
|
@@ -1148,7 +1148,6 @@
|
|
|
1148
1148
|
{
|
|
1149
1149
|
"title": "Studio Pro",
|
|
1150
1150
|
"description": "One-month access",
|
|
1151
|
-
"image_url": "https://shop.example/images/studio-pro.webp",
|
|
1152
1151
|
"quantity": 2,
|
|
1153
1152
|
"unit_amount": "24.50"
|
|
1154
1153
|
}
|
|
@@ -1169,7 +1168,6 @@
|
|
|
1169
1168
|
{
|
|
1170
1169
|
"title": "Studio Pro",
|
|
1171
1170
|
"description": "One-month access",
|
|
1172
|
-
"image_url": "https://shop.example/images/studio-pro.webp",
|
|
1173
1171
|
"quantity": 2,
|
|
1174
1172
|
"unit_amount": "24.50"
|
|
1175
1173
|
}
|
|
@@ -1191,7 +1189,6 @@
|
|
|
1191
1189
|
{
|
|
1192
1190
|
"title": "Studio Pro",
|
|
1193
1191
|
"description": "One-month access",
|
|
1194
|
-
"image_url": "https://shop.example/images/studio-pro.webp",
|
|
1195
1192
|
"quantity": 2,
|
|
1196
1193
|
"unit_amount": "24.50"
|
|
1197
1194
|
},
|
|
@@ -1217,7 +1214,6 @@
|
|
|
1217
1214
|
{
|
|
1218
1215
|
"title": "Studio Pro",
|
|
1219
1216
|
"description": "One-month access",
|
|
1220
|
-
"image_url": "https://shop.example/images/studio-pro.webp",
|
|
1221
1217
|
"quantity": 2,
|
|
1222
1218
|
"unit_amount": "24.50"
|
|
1223
1219
|
},
|
|
@@ -1292,8 +1288,7 @@
|
|
|
1292
1288
|
"unit_amount"
|
|
1293
1289
|
],
|
|
1294
1290
|
"optional_item_fields": [
|
|
1295
|
-
"description"
|
|
1296
|
-
"image_url"
|
|
1291
|
+
"description"
|
|
1297
1292
|
],
|
|
1298
1293
|
"omit_null_optional_item_fields": true,
|
|
1299
1294
|
"quantity_type": "integer",
|
data/lib/paymos/client.rb
CHANGED
|
@@ -270,7 +270,7 @@ module Paymos
|
|
|
270
270
|
raise ArgumentError, 'products items must respond to to_h' unless item.respond_to?(:to_h)
|
|
271
271
|
|
|
272
272
|
item.to_h.transform_keys(&:to_sym).reject do |key, value|
|
|
273
|
-
|
|
273
|
+
key == :description && value.nil?
|
|
274
274
|
end
|
|
275
275
|
end
|
|
276
276
|
end
|
data/lib/paymos/models.rb
CHANGED
|
@@ -80,11 +80,11 @@ module Paymos
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
class InvoiceProduct < Model
|
|
83
|
-
fields :title, :description, :
|
|
83
|
+
fields :title, :description, :quantity, :unit_amount,
|
|
84
84
|
required: %i[title quantity unit_amount]
|
|
85
85
|
|
|
86
86
|
def to_h
|
|
87
|
-
super.reject { |key, value|
|
|
87
|
+
super.reject { |key, value| key == :description && value.nil? }
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
|
data/lib/paymos/version.rb
CHANGED
data/sig/paymos.rbs
CHANGED
|
@@ -76,11 +76,10 @@ module Paymos
|
|
|
76
76
|
class InvoiceProduct < Model
|
|
77
77
|
attr_reader title: String
|
|
78
78
|
attr_reader description: String?
|
|
79
|
-
attr_reader image_url: String?
|
|
80
79
|
attr_reader quantity: Integer
|
|
81
80
|
attr_reader unit_amount: String
|
|
82
81
|
|
|
83
|
-
def initialize: (title: String, quantity: Integer, unit_amount: String, ?description: String
|
|
82
|
+
def initialize: (title: String, quantity: Integer, unit_amount: String, ?description: String?) -> void
|
|
84
83
|
end
|
|
85
84
|
|
|
86
85
|
class Order < Model
|