mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-06-23 00:00:29 -04:00
Compare commits
300 Commits
master
...
v10.6.0-be
Author | SHA1 | Date | |
---|---|---|---|
|
783bcb163f | ||
|
3e5b22eeae | ||
|
452e0c4485 | ||
|
cb256e8e1c | ||
|
90aa83239b | ||
|
ab5266188f | ||
|
e8f3b94a9d | ||
|
52e17ef8ea | ||
|
16227fe1e6 | ||
|
0e8df39594 | ||
|
98fbfb8012 | ||
|
8acad71c3f | ||
|
3b4f6e4bcb | ||
|
e1017fb6ef | ||
|
4933ab3111 | ||
|
b06b78aa85 | ||
|
fb0f82090c | ||
|
7c14c42072 | ||
|
78032b72f5 | ||
|
446f6ec55c | ||
|
7567bd2cb7 | ||
|
002767748d | ||
|
92bad8eeee | ||
|
3d3552e00d | ||
|
5af00f12a2 | ||
|
208ead7817 | ||
|
cca659d7b3 | ||
|
8c0015fb2c | ||
|
5ece384518 | ||
|
d936ddcff1 | ||
|
77d8304c54 | ||
|
6ba63d9a87 | ||
|
0d538ab0f1 | ||
|
6a5b89c99d | ||
|
b036d14d27 | ||
|
eeaa682877 | ||
|
a9611340a4 | ||
|
fee677de9e | ||
|
08400e8df9 | ||
|
b62018ee93 | ||
|
d4e469fa3c | ||
|
cfd9943c83 | ||
|
6d82ac4b56 | ||
|
aeb1b59206 | ||
|
a7f1c57f2c | ||
|
7be7413461 | ||
|
42f0c2c9d4 | ||
|
0055df9a63 | ||
|
4638712b2b | ||
|
86f5a8ac5c | ||
|
5443a95598 | ||
|
bc3cd13405 | ||
|
02c47fd5f0 | ||
|
9a92aa9c72 | ||
|
0030faf88f | ||
|
3285671c8f | ||
|
119802aaf2 | ||
|
d7a09671d1 | ||
|
05ee1f8fd4 | ||
|
72ce4e5f83 | ||
|
7dbfa2b4c4 | ||
|
0d02750915 | ||
|
1e13984787 | ||
|
5a2cf963ec | ||
|
176f13b832 | ||
|
9f77cb9c05 | ||
|
12da6ae2a8 | ||
|
aed8e679c5 | ||
|
a11a923b23 | ||
|
ac980c4216 | ||
|
7852b2faeb | ||
|
0a0374b0a1 | ||
|
2e533be04d | ||
|
e058a85fe7 | ||
|
6bf2eaf832 | ||
|
fb6f536d00 | ||
|
f97b214181 | ||
|
7066d7d3a1 | ||
|
147e25b288 | ||
|
568b3191c4 | ||
|
1ef9ff4b88 | ||
|
3165ed5905 | ||
|
be4388721d | ||
|
6ed6014b89 | ||
|
0ea7c61bcf | ||
|
f94c2cb45c | ||
|
c4bdddbe3c | ||
|
81b5190aed | ||
|
3fd4e48999 | ||
|
44a1547344 | ||
|
65768f9ee1 | ||
|
2ebd8cc795 | ||
|
206c80733f | ||
|
600c5fb883 | ||
|
8dfa6f6eaa | ||
|
c3b05c5e71 | ||
|
fee9143bb1 | ||
|
bd62fe08d6 | ||
|
658a0b786a | ||
|
84bf38a606 | ||
|
882c2a8c36 | ||
|
f7d4abdb5f | ||
|
8977ca553f | ||
|
e8f09f4001 | ||
|
4430246744 | ||
|
e9b70ffd51 | ||
|
b578ab2eb3 | ||
|
79dee2ae96 | ||
|
e0cfc89447 | ||
|
37b1db8140 | ||
|
ce925ab7a4 | ||
|
d604af0247 | ||
|
078adfcc37 | ||
|
e6ff2138c6 | ||
|
5609c6ce72 | ||
|
2227067f71 | ||
|
4981cc844d | ||
|
7e2a036dc5 | ||
|
900ecf2db9 | ||
|
8d5a5ef183 | ||
|
5bf957f53e | ||
|
0e5e7b8647 | ||
|
a334cb5fb4 | ||
|
801b65759e | ||
|
3d772067d1 | ||
|
6db03363ff | ||
|
1af83889bb | ||
|
e6b3043f66 | ||
|
e74bd2e7f7 | ||
|
bc924840dd | ||
|
456f10ab93 | ||
|
96b7453ee9 | ||
|
c0310bc4a7 | ||
|
a2806aca65 | ||
|
2f7ede30d1 | ||
|
4eae12c528 | ||
|
24801210b9 | ||
|
88ef71cf32 | ||
|
50c64e6c06 | ||
|
91015aa41c | ||
|
17619449ed | ||
|
a22bc332ad | ||
|
a5519a6a57 | ||
|
90a2a55687 | ||
|
6e2e8c757d | ||
|
c7a26629e6 | ||
|
62c0f898c3 | ||
|
cd0e601188 | ||
|
43f6318ebd | ||
|
150be92efc | ||
|
99dbffb9c6 | ||
|
a77bbab966 | ||
|
4d5a2aab6e | ||
|
7356579799 | ||
|
23cbd8fc82 | ||
|
adc0ccf8e7 | ||
|
d9118a7dfe | ||
|
f33553bef2 | ||
|
1d1d8a90f0 | ||
|
943dd4b020 | ||
|
6366593ed5 | ||
|
8cdb85cb36 | ||
|
9990e2b8b1 | ||
|
d600f2e9a1 | ||
|
c3cc36ed12 | ||
|
00077b44d8 | ||
|
2c06e9c83e | ||
|
4b74f4c93f | ||
|
e3f0da227f | ||
|
3ac330785f | ||
|
0075550ff8 | ||
|
890cdae767 | ||
|
732a1467b5 | ||
|
d39dcb4a81 | ||
|
fb655489eb | ||
|
4143d3930d | ||
|
23bc1b1f3b | ||
|
fe73975f07 | ||
|
24f8480c71 | ||
|
9d8ca624e3 | ||
|
105506a7fd | ||
|
75b29c3484 | ||
|
a6614ee701 | ||
|
33544c7c25 | ||
|
8f210e251a | ||
|
3b31fb29a6 | ||
|
4519e8fa19 | ||
|
f471a2c6a4 | ||
|
1e3428e87d | ||
|
7233155b42 | ||
|
cbfe81107a | ||
|
0b6cffde22 | ||
|
1be10ae4fc | ||
|
167daeaf62 | ||
|
080fddce5a | ||
|
466824d0af | ||
|
945e691968 | ||
|
f8a9a287ab | ||
|
92083a8615 | ||
|
705078e2cf | ||
|
29d8261b17 | ||
|
3958d6a9df | ||
|
696be38196 | ||
|
ff853fda95 | ||
|
d10398a825 | ||
|
6f70bd8696 | ||
|
1d21c60802 | ||
|
b9c10b9c2f | ||
|
446ffc7a22 | ||
|
58db6d32ef | ||
|
9a4dfdcb2f | ||
|
50bbc0df17 | ||
|
8226f0ad99 | ||
|
43fa8f5af7 | ||
|
0e61789557 | ||
|
cfe69c131e | ||
|
7bf9cace9e | ||
|
d7eac6010d | ||
|
7d91cb83d9 | ||
|
ce4946f5d8 | ||
|
15415fcbf3 | ||
|
f8acdb5f6a | ||
|
fe794f4868 | ||
|
2b841bc109 | ||
|
1835883848 | ||
|
e11400adc8 | ||
|
5ea85d0867 | ||
|
600b1965f6 | ||
|
5fdd180667 | ||
|
97e24e9e57 | ||
|
9531f57236 | ||
|
094574d2fe | ||
|
cff25d0c8b | ||
|
0795c1d3d0 | ||
|
802a1a7aa6 | ||
|
13b0bca995 | ||
|
51d364c844 | ||
|
f4c6f2b304 | ||
|
b64fe42043 | ||
|
586e685e63 | ||
|
3b5c725539 | ||
|
ea91a6f0b9 | ||
|
21f31edff4 | ||
|
a11f1ffd2a | ||
|
4bd92239d5 | ||
|
c261f6bbb6 | ||
|
f45fc7d703 | ||
|
5cd522c007 | ||
|
e6bda8356d | ||
|
2354633a92 | ||
|
549a73544f | ||
|
25833c1408 | ||
|
a59b57c3d1 | ||
|
63d447df77 | ||
|
5cd6f9f9bc | ||
|
ffa3747bdf | ||
|
ddf79610d9 | ||
|
edad946244 | ||
|
e3785d5893 | ||
|
2062e988eb | ||
|
0bdc688516 | ||
|
82ac9f2720 | ||
|
7381eb02a6 | ||
|
6720fc8d3f | ||
|
35a29332c5 | ||
|
519d68ce10 | ||
|
b95ea4ba27 | ||
|
318e244a76 | ||
|
bb1c995e93 | ||
|
0f12721697 | ||
|
671163245a | ||
|
486bee15a8 | ||
|
fdf5be66f5 | ||
|
c732841fd3 | ||
|
22db70b479 | ||
|
2db4fd9d06 | ||
|
6797f906e1 | ||
|
59f2d4d0fe | ||
|
0d1b570bfa | ||
|
d7d3c1b425 | ||
|
7df619de69 | ||
|
f649ed3824 | ||
|
32a95902cc | ||
|
bdcfe6cc33 | ||
|
5e1c4a2302 | ||
|
54a073783f | ||
|
e6a07ae658 | ||
|
588ed3b5e7 | ||
|
de33cde125 | ||
|
d849ec3b14 | ||
|
8b5f78aa6a | ||
|
7f6ba1c35c | ||
|
e55a2559ae | ||
|
0b00266be1 | ||
|
d0cd4fbaa6 | ||
|
979da6f84b | ||
|
d95c518a3c | ||
|
83c773f61e | ||
|
d9f719ba01 | ||
|
73d10e8557 |
@ -41,6 +41,10 @@ Metrics/MethodLength:
|
|||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Metrics/ParameterLists:
|
||||||
|
# There's 2 methods in `StripeClient` that have long parameter lists.
|
||||||
|
Max: 8
|
||||||
|
|
||||||
Style/AccessModifierDeclarations:
|
Style/AccessModifierDeclarations:
|
||||||
EnforcedStyle: inline
|
EnforcedStyle: inline
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2023-11-28 01:02:03 UTC using RuboCop version 1.57.2.
|
# on 2023-11-29 18:39:02 UTC using RuboCop version 1.57.2.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
@ -11,15 +11,15 @@ Lint/HashCompareByIdentity:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/stripe/stripe_client.rb'
|
- 'lib/stripe/stripe_client.rb'
|
||||||
|
|
||||||
# Offense count: 26
|
# Offense count: 27
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Max: 50
|
Max: 55
|
||||||
|
|
||||||
# Offense count: 9
|
# Offense count: 10
|
||||||
# Configuration parameters: CountComments, CountAsOne.
|
# Configuration parameters: CountComments, CountAsOne.
|
||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Max: 592
|
Max: 618
|
||||||
|
|
||||||
# Offense count: 12
|
# Offense count: 12
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||||
@ -27,14 +27,9 @@ Metrics/CyclomaticComplexity:
|
|||||||
Max: 12
|
Max: 12
|
||||||
|
|
||||||
# Offense count: 9
|
# Offense count: 9
|
||||||
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
||||||
Metrics/ParameterLists:
|
|
||||||
Max: 7
|
|
||||||
|
|
||||||
# Offense count: 8
|
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Max: 12
|
Max: 13
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
@ -49,7 +44,7 @@ Style/CombinableLoops:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/stripe/stripe_client.rb'
|
- 'lib/stripe/stripe_client.rb'
|
||||||
|
|
||||||
# Offense count: 39
|
# Offense count: 44
|
||||||
# Configuration parameters: AllowedConstants.
|
# Configuration parameters: AllowedConstants.
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
295
CHANGELOG.md
295
CHANGELOG.md
@ -1,8 +1,17 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 10.6.0-beta.1 - 2024-01-04
|
||||||
|
* [#1302](https://github.com/stripe/stripe-ruby/pull/1302) Update generated code for beta
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
|
||||||
|
|
||||||
## 10.5.0 - 2024-01-04
|
## 10.5.0 - 2024-01-04
|
||||||
* [#1306](https://github.com/stripe/stripe-ruby/pull/1306) Update generated code
|
* [#1306](https://github.com/stripe/stripe-ruby/pull/1306) Update generated code
|
||||||
* Add support for `retrieve` method on resource `Tax.Registration`
|
* Add support for `retrieve` method on resource `Tax.Registration`
|
||||||
|
|
||||||
|
## 10.5.0-beta.1 - 2023-12-22
|
||||||
|
* [#1302](https://github.com/stripe/stripe-ruby/pull/1302) Update generated code for beta
|
||||||
|
|
||||||
## 10.4.0 - 2023-12-22
|
## 10.4.0 - 2023-12-22
|
||||||
* [#1303](https://github.com/stripe/stripe-ruby/pull/1303) Update generated code
|
* [#1303](https://github.com/stripe/stripe-ruby/pull/1303) Update generated code
|
||||||
* Add support for new resource `FinancialConnections.Transaction`
|
* Add support for new resource `FinancialConnections.Transaction`
|
||||||
@ -10,9 +19,16 @@
|
|||||||
* Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account`
|
* Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account`
|
||||||
* [#1304](https://github.com/stripe/stripe-ruby/pull/1304) Add support for updatable singleton resources
|
* [#1304](https://github.com/stripe/stripe-ruby/pull/1304) Add support for updatable singleton resources
|
||||||
|
|
||||||
|
## 10.4.0-beta.1 - 2023-12-14
|
||||||
|
Updated stable APIs to the latest version
|
||||||
|
|
||||||
## 10.3.0 - 2023-12-14
|
## 10.3.0 - 2023-12-14
|
||||||
* [#1294](https://github.com/stripe/stripe-ruby/pull/1294) Support sending parameters inside singleton retrieve
|
* [#1294](https://github.com/stripe/stripe-ruby/pull/1294) Support sending parameters inside singleton retrieve
|
||||||
|
|
||||||
|
## 10.3.0-beta.1 - 2023-11-30
|
||||||
|
* [#1298](https://github.com/stripe/stripe-ruby/pull/1298) Update generated code for beta
|
||||||
|
* [#1296](https://github.com/stripe/stripe-ruby/pull/1296) Merge master into beta
|
||||||
|
|
||||||
## 10.2.0 - 2023-11-30
|
## 10.2.0 - 2023-11-30
|
||||||
* [#1292](https://github.com/stripe/stripe-ruby/pull/1292) Update generated code
|
* [#1292](https://github.com/stripe/stripe-ruby/pull/1292) Update generated code
|
||||||
* Add support for new resources `Climate.Order`, `Climate.Product`, and `Climate.Supplier`
|
* Add support for new resources `Climate.Order`, `Climate.Product`, and `Climate.Supplier`
|
||||||
@ -25,12 +41,26 @@
|
|||||||
|
|
||||||
* [#1288](https://github.com/stripe/stripe-ruby/pull/1288) Update generated code
|
* [#1288](https://github.com/stripe/stripe-ruby/pull/1288) Update generated code
|
||||||
|
|
||||||
|
## 10.2.0-beta.1 - 2023-11-02
|
||||||
|
* [#1287](https://github.com/stripe/stripe-ruby/pull/1287) Update generated code for beta
|
||||||
|
* Add support for `attach_payment_intent` method on resource `Invoice`
|
||||||
|
* [#1285](https://github.com/stripe/stripe-ruby/pull/1285) Update generated code for beta
|
||||||
|
|
||||||
## 10.1.0 - 2023-11-02
|
## 10.1.0 - 2023-11-02
|
||||||
* [#1286](https://github.com/stripe/stripe-ruby/pull/1286) Update generated code
|
* [#1286](https://github.com/stripe/stripe-ruby/pull/1286) Update generated code
|
||||||
* Add support for new resource `Tax.Registration`
|
* Add support for new resource `Tax.Registration`
|
||||||
* Add support for `create`, `list`, and `update` methods on resource `Registration`
|
* Add support for `create`, `list`, and `update` methods on resource `Registration`
|
||||||
|
|
||||||
|
## 10.1.0-beta.2 - 2023-10-26
|
||||||
|
* [#1285](https://github.com/stripe/stripe-ruby/pull/1285) Update generated code for beta
|
||||||
|
* Add support for new resource `Margin`
|
||||||
|
* Add support for `create`, `list`, `retrieve`, and `update` methods on resource `Margin`
|
||||||
|
|
||||||
|
## 10.1.0-beta.1 - 2023-10-17
|
||||||
|
* [#1284](https://github.com/stripe/stripe-ruby/pull/1284) Update generated code for beta
|
||||||
|
- Update pinned API version to `2023-10-16`
|
||||||
|
* [#1282](https://github.com/stripe/stripe-ruby/pull/1282) Update generated code for beta
|
||||||
|
|
||||||
## 10.0.0 - 2023-10-16
|
## 10.0.0 - 2023-10-16
|
||||||
* This release changes the pinned API version to `2023-10-16`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2023-10-16) and carefully review the API changes before upgrading `stripe-ruby`.
|
* This release changes the pinned API version to `2023-10-16`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2023-10-16) and carefully review the API changes before upgrading `stripe-ruby`.
|
||||||
* [#1283](https://github.com/stripe/stripe-ruby/pull/1283) Update generated code
|
* [#1283](https://github.com/stripe/stripe-ruby/pull/1283) Update generated code
|
||||||
@ -38,11 +68,33 @@
|
|||||||
* [#1281](https://github.com/stripe/stripe-ruby/pull/1281) Update generated code
|
* [#1281](https://github.com/stripe/stripe-ruby/pull/1281) Update generated code
|
||||||
* Documentation only changes
|
* Documentation only changes
|
||||||
|
|
||||||
|
## 9.5.0-beta.2 - 2023-10-12
|
||||||
|
* [#1280](https://github.com/stripe/stripe-ruby/pull/1280) Update generated code for beta
|
||||||
|
* Add support for new resources `AccountNotice` and `Issuing.CreditUnderwritingRecord`
|
||||||
|
* Add support for `list`, `retrieve`, and `update` methods on resource `AccountNotice`
|
||||||
|
* Add support for `correct`, `create_from_application`, `create_from_proactive_review`, `list`, `report_decision`, and `retrieve` methods on resource `CreditUnderwritingRecord`
|
||||||
|
|
||||||
|
## 9.5.0-beta.1 - 2023-10-05
|
||||||
|
* [#1278](https://github.com/stripe/stripe-ruby/pull/1278) Update generated code for beta
|
||||||
|
* Add support for `mark_draft` and `mark_stale` methods on resource `Quote`
|
||||||
|
* Remove support for `draft_quote` and `mark_stale_quote` methods on resource `Quote`
|
||||||
|
* Rename `preview_invoice_lines` to `list_preview_invoice_lines` on resource `Quote`
|
||||||
|
|
||||||
## 9.4.0 - 2023-10-05
|
## 9.4.0 - 2023-10-05
|
||||||
* [#1277](https://github.com/stripe/stripe-ruby/pull/1277) Update generated code
|
* [#1277](https://github.com/stripe/stripe-ruby/pull/1277) Update generated code
|
||||||
* Add support for new resources `Issuing.Token`
|
* Add support for new resources `Issuing.Token`
|
||||||
* Add support for `list`, `retrieve`, and `update` methods on resource `Token`
|
* Add support for `list`, `retrieve`, and `update` methods on resource `Token`
|
||||||
|
|
||||||
|
## 9.4.0-beta.3 - 2023-09-28
|
||||||
|
* [#1276](https://github.com/stripe/stripe-ruby/pull/1276) Update generated code for beta
|
||||||
|
* Rename resources `Issuing.CardDesign` and `Issuing.CardBundle` to `Issuing.PersonalizationDesign` and `Issuing.PhysicalBundle`
|
||||||
|
|
||||||
|
## 9.4.0-beta.2 - 2023-09-21
|
||||||
|
* [#1273](https://github.com/stripe/stripe-ruby/pull/1273) Update generated code for beta
|
||||||
|
|
||||||
|
## 9.4.0-beta.1 - 2023-09-14
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
|
||||||
## 9.3.0 - 2023-09-14
|
## 9.3.0 - 2023-09-14
|
||||||
* [#1272](https://github.com/stripe/stripe-ruby/pull/1272) Update generated code
|
* [#1272](https://github.com/stripe/stripe-ruby/pull/1272) Update generated code
|
||||||
* Add support for new resource `PaymentMethodConfiguration`
|
* Add support for new resource `PaymentMethodConfiguration`
|
||||||
@ -51,18 +103,38 @@
|
|||||||
* Add support for `capture`, `create`, `expire`, `increment`, and `reverse` test helper methods on resource `Issuing.Authorization`
|
* Add support for `capture`, `create`, `expire`, `increment`, and `reverse` test helper methods on resource `Issuing.Authorization`
|
||||||
* Add support for `create_force_capture`, `create_unlinked_refund`, and `refund` test helper methods on resource `Issuing.Transaction`
|
* Add support for `create_force_capture`, `create_unlinked_refund`, and `refund` test helper methods on resource `Issuing.Transaction`
|
||||||
|
|
||||||
|
## 9.3.0-beta.1 - 2023-09-07
|
||||||
|
* [#1269](https://github.com/stripe/stripe-ruby/pull/1269) Update generated code for beta
|
||||||
|
* Release specs are identical.
|
||||||
|
* [#1268](https://github.com/stripe/stripe-ruby/pull/1268) Update generated code for beta
|
||||||
|
* Remove support for `submit_card` test helper method on resource `Issuing.Card`
|
||||||
|
* [#1265](https://github.com/stripe/stripe-ruby/pull/1265) Update generated code for beta
|
||||||
|
* Rename `Quote.preview_invoices` to `QuotePreviewInvoice.list` and `Quote.preview_schedules` to `QuotePreviewSchedules.list`
|
||||||
|
* [#1264](https://github.com/stripe/stripe-ruby/pull/1264) Update generated code for beta
|
||||||
|
* Add support for new resources `QuotePreviewInvoice` and `QuotePreviewSchedule`
|
||||||
|
* [#1259](https://github.com/stripe/stripe-ruby/pull/1259) Update generated code for beta
|
||||||
|
|
||||||
|
* [#1257](https://github.com/stripe/stripe-ruby/pull/1257) Update generated code for beta
|
||||||
|
|
||||||
|
* [#1254](https://github.com/stripe/stripe-ruby/pull/1254) Update generated code for beta
|
||||||
|
* Add support for `submit_card` test helper method on resource `Issuing.Card`
|
||||||
|
* [#1252](https://github.com/stripe/stripe-ruby/pull/1252) Remove developer_message support
|
||||||
|
|
||||||
## 9.2.0 - 2023-09-07
|
## 9.2.0 - 2023-09-07
|
||||||
* [#1267](https://github.com/stripe/stripe-ruby/pull/1267) Update generated code
|
* [#1267](https://github.com/stripe/stripe-ruby/pull/1267) Update generated code
|
||||||
* Add support for new resource `PaymentMethodDomain`
|
* Add support for new resource `PaymentMethodDomain`
|
||||||
* Add support for `create`, `list`, `retrieve`, `update`, and `validate` methods on resource `PaymentMethodDomain`
|
* Add support for `create`, `list`, `retrieve`, `update`, and `validate` methods on resource `PaymentMethodDomain`
|
||||||
|
|
||||||
|
## 9.2.0-beta.1 - 2023-08-31
|
||||||
|
* [#1265](https://github.com/stripe/stripe-ruby/pull/1265) Update generated code for beta
|
||||||
|
* Rename `Quote.preview_invoices` to `QuotePreviewInvoice.list` and `Quote.preview_schedules` to `QuotePreviewSchedules.list`
|
||||||
|
|
||||||
## 9.1.0 - 2023-08-31
|
## 9.1.0 - 2023-08-31
|
||||||
* [#1266](https://github.com/stripe/stripe-ruby/pull/1266) Update generated code
|
* [#1266](https://github.com/stripe/stripe-ruby/pull/1266) Update generated code
|
||||||
* Add support for new resource `AccountSession`
|
* Add support for new resource `AccountSession`
|
||||||
* Add support for `create` method on resource `AccountSession`
|
* Add support for `create` method on resource `AccountSession`
|
||||||
* [#1262](https://github.com/stripe/stripe-ruby/pull/1262) Explicitly format timestamp in SignatureVerificationError message
|
* [#1262](https://github.com/stripe/stripe-ruby/pull/1262) Explicitly format timestamp in SignatureVerificationError message
|
||||||
|
|
||||||
|
|
||||||
## 9.0.0 - 2023-08-16
|
## 9.0.0 - 2023-08-16
|
||||||
**⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️**
|
**⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️**
|
||||||
|
|
||||||
@ -95,10 +167,39 @@
|
|||||||
|
|
||||||
That is, instead of upgrading stripe-ruby and separately upgrading your Stripe API Version through the Stripe Dashboard. whenever you upgrade major versions of stripe-ruby, you should also upgrade your integration to be compatible with the latest Stripe API version.
|
That is, instead of upgrading stripe-ruby and separately upgrading your Stripe API Version through the Stripe Dashboard. whenever you upgrade major versions of stripe-ruby, you should also upgrade your integration to be compatible with the latest Stripe API version.
|
||||||
|
|
||||||
|
## 9.0.0-beta.1 - 2023-08-24
|
||||||
|
* [#1264](https://github.com/stripe/stripe-ruby/pull/1264) Update generated code for beta
|
||||||
|
* Add support for new resources `QuotePreviewInvoice` and `QuotePreviewSchedule`
|
||||||
|
* [#1259](https://github.com/stripe/stripe-ruby/pull/1259) Update generated code for beta
|
||||||
|
|
||||||
|
## 8.8.0-beta.1 - 2023-08-10
|
||||||
|
* [#1257](https://github.com/stripe/stripe-ruby/pull/1257) Update generated code for beta
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
|
||||||
## 8.7.0 - 2023-08-10
|
## 8.7.0 - 2023-08-10
|
||||||
* [#1256](https://github.com/stripe/stripe-ruby/pull/1256) Update generated code
|
* [#1256](https://github.com/stripe/stripe-ruby/pull/1256) Update generated code
|
||||||
Add resources `Tax::CalculationLineItem`, `Tax::TransactionLineItem`, and `Treasury::FinancialAccountFeatures`. These resources have no methods on them, but do represent the return type of methods elsewhere.
|
Add resources `Tax::CalculationLineItem`, `Tax::TransactionLineItem`, and `Treasury::FinancialAccountFeatures`. These resources have no methods on them, but do represent the return type of methods elsewhere.
|
||||||
|
|
||||||
|
## 8.7.0-beta.3 - 2023-08-03
|
||||||
|
* [#1254](https://github.com/stripe/stripe-ruby/pull/1254) Update generated code for beta
|
||||||
|
* Add support for `submit_card` test helper method on resource `Issuing.Card`
|
||||||
|
* [#1252](https://github.com/stripe/stripe-ruby/pull/1252) Remove developer_message support
|
||||||
|
|
||||||
|
## 8.7.0-beta.2 - 2023-07-28
|
||||||
|
* [#1251](https://github.com/stripe/stripe-ruby/pull/1251) Update generated code for beta
|
||||||
|
* Add support for new resource `Tax.Form`
|
||||||
|
* Add support for `list`, `pdf`, and `retrieve` methods on resource `Form`
|
||||||
|
* [#1249](https://github.com/stripe/stripe-ruby/pull/1249) Update generated code for beta
|
||||||
|
* [#1246](https://github.com/stripe/stripe-ruby/pull/1246) Update generated code for beta
|
||||||
|
|
||||||
|
## 8.7.0-beta.1 - 2023-07-13
|
||||||
|
* [#1245](https://github.com/stripe/stripe-ruby/pull/1245) Update generated code for beta
|
||||||
|
Release specs are identical.
|
||||||
|
* [#1243](https://github.com/stripe/stripe-ruby/pull/1243) Update generated code for beta
|
||||||
|
* Add support for new resource `PaymentMethodConfiguration`
|
||||||
|
* Add support for `create`, `list`, `retrieve`, and `update` methods on resource `PaymentMethodConfiguration`
|
||||||
|
* [#1239](https://github.com/stripe/stripe-ruby/pull/1239) Update generated code for beta
|
||||||
|
|
||||||
## 8.6.0 - 2023-07-13
|
## 8.6.0 - 2023-07-13
|
||||||
* [#1244](https://github.com/stripe/stripe-ruby/pull/1244) Update generated code
|
* [#1244](https://github.com/stripe/stripe-ruby/pull/1244) Update generated code
|
||||||
* Add support for new resource `Tax.Settings`
|
* Add support for new resource `Tax.Settings`
|
||||||
@ -127,6 +228,37 @@
|
|||||||
|
|
||||||
* [#1204](https://github.com/stripe/stripe-ruby/pull/1204) Update generated code
|
* [#1204](https://github.com/stripe/stripe-ruby/pull/1204) Update generated code
|
||||||
|
|
||||||
|
## 8.6.0-beta.6 - 2023-06-22
|
||||||
|
* [#1237](https://github.com/stripe/stripe-ruby/pull/1237) Update generated code for beta
|
||||||
|
* Add support for new resource `CustomerSession`
|
||||||
|
* Add support for `create` method on resource `CustomerSession`
|
||||||
|
* [#1233](https://github.com/stripe/stripe-ruby/pull/1233) Update generated code for beta
|
||||||
|
* [#1229](https://github.com/stripe/stripe-ruby/pull/1229) Update generated code for beta
|
||||||
|
|
||||||
|
## 8.6.0-beta.5 - 2023-06-01
|
||||||
|
* [#1227](https://github.com/stripe/stripe-ruby/pull/1227) Update generated code for beta
|
||||||
|
* [#1228](https://github.com/stripe/stripe-ruby/pull/1228) Document raw_request
|
||||||
|
* [#1222](https://github.com/stripe/stripe-ruby/pull/1222) Update generated code for beta
|
||||||
|
* [#1224](https://github.com/stripe/stripe-ruby/pull/1224) Handle developer message in preview error responses
|
||||||
|
|
||||||
|
## 8.6.0-beta.4 - 2023-05-19
|
||||||
|
* [#1220](https://github.com/stripe/stripe-ruby/pull/1220) Update generated code for beta
|
||||||
|
* Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account`
|
||||||
|
* [#1217](https://github.com/stripe/stripe-ruby/pull/1217) Add raw_request
|
||||||
|
* [#1216](https://github.com/stripe/stripe-ruby/pull/1216) Update generated code for beta
|
||||||
|
* [#1214](https://github.com/stripe/stripe-ruby/pull/1214) Update generated code for beta
|
||||||
|
|
||||||
|
## 8.6.0-beta.3 - 2023-04-17
|
||||||
|
* [#1211](https://github.com/stripe/stripe-ruby/pull/1211) Update generated code for beta
|
||||||
|
* [#1210](https://github.com/stripe/stripe-ruby/pull/1210), [#1212](https://github.com/stripe/stripe-ruby/pull/1212), [#1213](https://github.com/stripe/stripe-ruby/pull/1213) Add support for request signing
|
||||||
|
|
||||||
|
## 8.6.0-beta.2 - 2023-04-13
|
||||||
|
* [#1206](https://github.com/stripe/stripe-ruby/pull/1206) Update generated code for beta
|
||||||
|
* Add support for `collect_payment_method` and `confirm_payment_intent` methods on resource `Terminal.Reader`
|
||||||
|
* [#1205](https://github.com/stripe/stripe-ruby/pull/1205) Update generated code for beta
|
||||||
|
|
||||||
|
## 8.6.0-beta.1 - 2023-03-30
|
||||||
|
* [#1202](https://github.com/stripe/stripe-ruby/pull/1202) Update generated code for beta
|
||||||
|
|
||||||
## 8.5.0 - 2023-03-30
|
## 8.5.0 - 2023-03-30
|
||||||
* [#1203](https://github.com/stripe/stripe-ruby/pull/1203) Update generated code
|
* [#1203](https://github.com/stripe/stripe-ruby/pull/1203) Update generated code
|
||||||
@ -134,6 +266,11 @@
|
|||||||
* This is not a breaking change, as this method was deprecated before the Tax Transactions API was released in favor of the `create_from_calculation` method.
|
* This is not a breaking change, as this method was deprecated before the Tax Transactions API was released in favor of the `create_from_calculation` method.
|
||||||
* [#1201](https://github.com/stripe/stripe-ruby/pull/1201) Update save deprecation message
|
* [#1201](https://github.com/stripe/stripe-ruby/pull/1201) Update save deprecation message
|
||||||
|
|
||||||
|
## 8.5.0-beta.1 - 2023-03-23
|
||||||
|
* [#1194](https://github.com/stripe/stripe-ruby/pull/1194) Update generated code for beta (new)
|
||||||
|
* Add support for new resources `Tax.CalculationLineItem` and `Tax.TransactionLineItem`
|
||||||
|
* Add support for `collect_inputs` method on resource `Terminal.Reader`
|
||||||
|
|
||||||
## 8.4.0 - 2023-03-23
|
## 8.4.0 - 2023-03-23
|
||||||
* [#1197](https://github.com/stripe/stripe-ruby/pull/1197) Update generated code (new)
|
* [#1197](https://github.com/stripe/stripe-ruby/pull/1197) Update generated code (new)
|
||||||
* Add support for new resources `Tax.CalculationLineItem`, `Tax.Calculation`, `Tax.TransactionLineItem`, and `Tax.Transaction`
|
* Add support for new resources `Tax.CalculationLineItem`, `Tax.Calculation`, `Tax.TransactionLineItem`, and `Tax.Transaction`
|
||||||
@ -141,18 +278,91 @@
|
|||||||
* Add support for `create_from_calculation`, `create_reversal`, `create`, `list_line_items`, and `retrieve` methods on resource `Transaction`
|
* Add support for `create_from_calculation`, `create_reversal`, `create`, `list_line_items`, and `retrieve` methods on resource `Transaction`
|
||||||
* [#1152](https://github.com/stripe/stripe-ruby/pull/1152) Symbolize hash keys inside `convert_to_stripe_object_with_params`
|
* [#1152](https://github.com/stripe/stripe-ruby/pull/1152) Symbolize hash keys inside `convert_to_stripe_object_with_params`
|
||||||
|
|
||||||
|
## 8.4.0-beta.4 - 2023-03-16
|
||||||
|
* [#1189](https://github.com/stripe/stripe-ruby/pull/1189) Update generated code for beta (new)
|
||||||
|
* Add support for `create_from_calculation` method on resource `Tax.Transaction`
|
||||||
|
* [#1188](https://github.com/stripe/stripe-ruby/pull/1188) Update generated code for beta (new)
|
||||||
|
* Remove support for resources `Capital.FinancingOffer` and `Capital.FinancingSummary`
|
||||||
|
* Remove support for `list`, `mark_delivered`, and `retrieve` methods on resource `FinancingOffer`
|
||||||
|
* Remove support for `retrieve` method on resource `FinancingSummary`
|
||||||
|
* [#1187](https://github.com/stripe/stripe-ruby/pull/1187) Merge upstream master
|
||||||
|
|
||||||
|
## 8.4.0-beta.3 - 2023-03-09
|
||||||
|
* [#1184](https://github.com/stripe/stripe-ruby/pull/1184) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Remove support for `list_transactions` method on resource `Tax.Transaction`
|
||||||
|
|
||||||
|
## 8.4.0-beta.2 - 2023-03-03
|
||||||
|
* [#1183](https://github.com/stripe/stripe-ruby/pull/1183) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Add support for new resources `Issuing.CardBundle` and `Issuing.CardDesign`
|
||||||
|
* Add support for `list` and `retrieve` methods on resource `CardBundle`
|
||||||
|
* Add support for `list`, `retrieve`, and `update` methods on resource `CardDesign`
|
||||||
|
|
||||||
|
## 8.4.0-beta.1 - 2023-02-23
|
||||||
|
* [#1182](https://github.com/stripe/stripe-ruby/pull/1182) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
|
||||||
## 8.3.0 - 2023-02-16
|
## 8.3.0 - 2023-02-16
|
||||||
* [#1175](https://github.com/stripe/stripe-ruby/pull/1175) API Updates
|
* [#1175](https://github.com/stripe/stripe-ruby/pull/1175) API Updates
|
||||||
* Add support for `refund_payment` method on resource `Terminal.Reader`
|
* Add support for `refund_payment` method on resource `Terminal.Reader`
|
||||||
|
|
||||||
|
## 8.3.0-beta.1 - 2023-02-02
|
||||||
|
* [#1174](https://github.com/stripe/stripe-ruby/pull/1174) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Add support for new resource `FinancialConnections.Transaction`
|
||||||
|
* Add support for `list` method on resource `Transaction`
|
||||||
|
|
||||||
## 8.2.0 - 2023-02-02
|
## 8.2.0 - 2023-02-02
|
||||||
* [#1173](https://github.com/stripe/stripe-ruby/pull/1173) API Updates
|
* [#1173](https://github.com/stripe/stripe-ruby/pull/1173) API Updates
|
||||||
* Add support for `resume` method on resource `Subscription`
|
* Add support for `resume` method on resource `Subscription`
|
||||||
* [#1171](https://github.com/stripe/stripe-ruby/pull/1171) Remove unused `partial` param from `initialize_from`
|
* [#1171](https://github.com/stripe/stripe-ruby/pull/1171) Remove unused `partial` param from `initialize_from`
|
||||||
|
|
||||||
|
## 8.2.0-beta.3 - 2023-01-26
|
||||||
|
* [#1172](https://github.com/stripe/stripe-ruby/pull/1172) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Add support for `list_transactions` method on resource `Tax.Transaction`
|
||||||
|
|
||||||
|
## 8.2.0-beta.2 - 2023-01-19
|
||||||
|
* [#1170](https://github.com/stripe/stripe-ruby/pull/1170) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Add support for `Tax.Settings` resource.
|
||||||
|
|
||||||
|
## 8.2.0-beta.1 - 2023-01-12
|
||||||
|
* [#1167](https://github.com/stripe/stripe-ruby/pull/1167) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Change `quote.draft_quote` implementation to from calling `POST /v1/quotes/{quote}/draft` to `POST /v1/quotes/{quote}/mark_draft`
|
||||||
|
* Add support for `Tax::Register` resource
|
||||||
|
|
||||||
## 8.1.0 - 2023-01-12
|
## 8.1.0 - 2023-01-12
|
||||||
* [#1162](https://github.com/stripe/stripe-ruby/pull/1162) Improve request events instrumentation
|
* [#1162](https://github.com/stripe/stripe-ruby/pull/1162) Improve request events instrumentation
|
||||||
|
|
||||||
|
## 8.1.0-beta.4 - 2023-01-05
|
||||||
|
* [#1164](https://github.com/stripe/stripe-ruby/pull/1164) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Add support for `mark_stale_quote` method on resource `Quote`
|
||||||
|
|
||||||
|
## 8.1.0-beta.3 - 2022-12-22
|
||||||
|
* [#1158](https://github.com/stripe/stripe-ruby/pull/1158) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Move `TaxCalculation` and `TaxTransaction` to `Tax::Calculation` and `Tax::Transaction`.
|
||||||
|
|
||||||
|
## 8.1.0-beta.2 - 2022-12-15
|
||||||
|
* [#1156](https://github.com/stripe/stripe-ruby/pull/1156) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Add support for new resources `TaxCalculation`, and `TaxTransaction`
|
||||||
|
* Add support for `create` and `list_line_items` methods on resource `TaxCalculation`
|
||||||
|
* Add support for `create_reversal`, `create`, and `retrieve` methods on resource `TaxTransaction`
|
||||||
|
* [#1155](https://github.com/stripe/stripe-ruby/pull/1155) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Add support for new resource `QuoteLine`.
|
||||||
|
|
||||||
|
## 8.1.0-beta.1 - 2022-12-08
|
||||||
|
* [#1153](https://github.com/stripe/stripe-ruby/pull/1153) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* [#1146](https://github.com/stripe/stripe-ruby/pull/1146) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
|
||||||
## 8.0.0 - 2022-11-16
|
## 8.0.0 - 2022-11-16
|
||||||
* [#1144](https://github.com/stripe/stripe-ruby/pull/1144) Next major release changes
|
* [#1144](https://github.com/stripe/stripe-ruby/pull/1144) Next major release changes
|
||||||
|
|
||||||
@ -160,30 +370,29 @@ Breaking changes that arose during code generation of the library that we postpo
|
|||||||
|
|
||||||
"⚠️" symbol highlights breaking changes.
|
"⚠️" symbol highlights breaking changes.
|
||||||
|
|
||||||
### Deprecated
|
## 7.2.0-beta.5 - 2022-11-02
|
||||||
- The `save` method is deprecated. Prefer the static `update` method that doesn't require retrieval of the resource to update it.
|
* [#1139](https://github.com/stripe/stripe-ruby/pull/1139) API Updates for beta branch
|
||||||
``` ruby
|
* Updated beta APIs to the latest stable version
|
||||||
# before
|
* [#1135](https://github.com/stripe/stripe-ruby/pull/1135) API Updates for beta branch
|
||||||
refund = Stripe::Refund.retrieve("re_123")
|
* Updated stable APIs to the latest version
|
||||||
refund.description = "Refund description"
|
|
||||||
refund.save
|
|
||||||
|
|
||||||
# after
|
|
||||||
Stripe::Refund.update("re_123", description: "Refund description")
|
|
||||||
```
|
|
||||||
|
|
||||||
### ⚠️ Removed
|
## 7.2.0-beta.4 - 2022-10-07
|
||||||
- Removed deprecated `Sku` resource.
|
* [#999](https://github.com/stripe/stripe-ruby/pull/999) DESCRIBE CHANGES HERE (try to use the same style, tense, etc. as the other entries)
|
||||||
- Removed deprecated `Orders` resource.
|
|
||||||
- Removed deprecated `delete` method on `Subscription` resource. Please use `cancel` method instead.
|
|
||||||
```ruby
|
|
||||||
# before
|
|
||||||
Stripe::Subscription::delete("sub_12345")
|
|
||||||
|
|
||||||
# after
|
## 7.2.0-beta.3 - 2022-09-26
|
||||||
Stripe::Subscription::cancel("sub_12345")
|
* [#1129](https://github.com/stripe/stripe-ruby/pull/1129) API Updates for beta branch
|
||||||
```
|
* Updated stable APIs to the latest version
|
||||||
|
* Add `FinancingOffer`, `FinancingSummary` and `FinancingTransaction` resources.
|
||||||
|
|
||||||
|
## 7.2.0-beta.2 - 2022-08-26
|
||||||
|
* [#1127](https://github.com/stripe/stripe-ruby/pull/1127) API Updates for beta branch
|
||||||
|
* Updated stable APIs to the latest version
|
||||||
|
* Add support for the beta [Gift Card API](https://stripe.com/docs/gift-cards).
|
||||||
|
|
||||||
|
## 7.2.0-beta.1 - 2022-08-23
|
||||||
|
* [#1122](https://github.com/stripe/stripe-ruby/pull/1122) API Updates for beta branch
|
||||||
|
- Updated stable APIs to the latest version
|
||||||
|
- `Stripe-Version` beta headers are not pinned by-default and need to be manually specified, please refer to [beta SDKs README section](https://github.com/stripe/stripe-ruby/blob/master/README.md#beta-sdks)
|
||||||
|
|
||||||
## 7.1.0 - 2022-08-19
|
## 7.1.0 - 2022-08-19
|
||||||
* [#1116](https://github.com/stripe/stripe-ruby/pull/1116) API Updates
|
* [#1116](https://github.com/stripe/stripe-ruby/pull/1116) API Updates
|
||||||
@ -192,6 +401,16 @@ Breaking changes that arose during code generation of the library that we postpo
|
|||||||
* [#1117](https://github.com/stripe/stripe-ruby/pull/1117) Refresh rubocop config.
|
* [#1117](https://github.com/stripe/stripe-ruby/pull/1117) Refresh rubocop config.
|
||||||
* [#1115](https://github.com/stripe/stripe-ruby/pull/1115) Add a support section to the readme
|
* [#1115](https://github.com/stripe/stripe-ruby/pull/1115) Add a support section to the readme
|
||||||
|
|
||||||
|
## 7.1.0-beta.2 - 2022-08-11
|
||||||
|
* [#1113](https://github.com/stripe/stripe-ruby/pull/1113) API Updates for beta branch
|
||||||
|
- Updated stable APIs to the latest version
|
||||||
|
- Add `refund_payment` method to Terminal resource
|
||||||
|
|
||||||
|
## 7.1.0-beta.1 - 2022-08-03
|
||||||
|
* [#1107](https://github.com/stripe/stripe-ruby/pull/1107) API Updates for beta branch
|
||||||
|
- Updated stable APIs to the latest version
|
||||||
|
- Added the `Order` resource support
|
||||||
|
|
||||||
## 7.0.0 - 2022-08-02
|
## 7.0.0 - 2022-08-02
|
||||||
|
|
||||||
Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the SDK, read more detailed description at https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v7. For changes to the Stripe products, read more at https://stripe.com/docs/upgrades#2022-08-01.
|
Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the SDK, read more detailed description at https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v7. For changes to the Stripe products, read more at https://stripe.com/docs/upgrades#2022-08-01.
|
||||||
@ -203,21 +422,19 @@ Breaking changes that arose during code generation of the library that we postpo
|
|||||||
* [#1090](https://github.com/stripe/stripe-ruby/pull/1090) Use auto-generation for `Invoice` methods
|
* [#1090](https://github.com/stripe/stripe-ruby/pull/1090) Use auto-generation for `Invoice` methods
|
||||||
* [#1103](https://github.com/stripe/stripe-ruby/pull/1103) Next major release changes
|
* [#1103](https://github.com/stripe/stripe-ruby/pull/1103) Next major release changes
|
||||||
|
|
||||||
### ⚠️ Changed
|
## 6.6.0-beta.1 - 2022-07-22
|
||||||
* `retrieve_cash_balance` and `update_cash_balance` methods on `Customer` resource no longer requires the second argument to always be `nil`. The methods now now take in `customer_id`, `params`, and `opts` parameters.
|
* [#1100](https://github.com/stripe/stripe-ruby/pull/1100) API Updates for beta branch
|
||||||
* Update default bundle of CA certificates to April 26, 2022.
|
- Updated stable APIs to the latest version
|
||||||
|
- Add `QuotePhase` resource
|
||||||
### Deprecated
|
* [#1097](https://github.com/stripe/stripe-ruby/pull/1097) API Updates for beta branch
|
||||||
* Deprecate `delete` method on `Subscription` resource. Please use `cancel` method instead.
|
- Updated stable APIs to the latest version
|
||||||
|
- Add `SubscriptionSchedule.amend` method.
|
||||||
### ⚠️ Removed
|
* [#1093](https://github.com/stripe/stripe-ruby/pull/1093) API Updates for beta branch
|
||||||
* Remove `details` method from `Issuing.Card` resource. The method was not supported.
|
- Include `server_side_confirmation_beta=v1` beta
|
||||||
* Remove `Issuing.CardDetails` resource. Read more at https://stripe.com/docs/issuing/cards/virtual.
|
- Add `secretKeyConfirmation` to `PaymentIntent`
|
||||||
* Remove `create` method from `ReportType` resource. The method was not supported.
|
* [#1085](https://github.com/stripe/stripe-ruby/pull/1085) API Updates for beta branch
|
||||||
* Remove `usage_record_summaries` method from `SubscriptionItem` resource. Please use `list_usage_record_summaries` method instead.
|
- Updated stable APIs to the latest version
|
||||||
* Remove `AlipayAccount`, `BitcoinReceiver`, `BitcoinTransaction`, `Issuing::CardDetails`, `Recipient`, ` RecipientTransfer`, and `ThreeDSecure` resources. The resources were deprecated or no longer in use.
|
* [#1075](https://github.com/stripe/stripe-ruby/pull/1075) Use the generated API version
|
||||||
* Remove ability to list `Card` resource for a `Recipient`.
|
|
||||||
* Remove `cancel` method from `Transfer` resource. The method was deprecated.
|
|
||||||
|
|
||||||
## 6.5.0 - 2022-06-29
|
## 6.5.0 - 2022-06-29
|
||||||
* [#1084](https://github.com/stripe/stripe-ruby/pull/1084) API Updates
|
* [#1084](https://github.com/stripe/stripe-ruby/pull/1084) API Updates
|
||||||
@ -247,8 +464,6 @@ Breaking changes that arose during code generation of the library that we postpo
|
|||||||
* Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction`
|
* Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction`
|
||||||
* Add support for `retrieve_payment_method` method on resource `Customer`
|
* Add support for `retrieve_payment_method` method on resource `Customer`
|
||||||
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
|
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 6.0.0 - 2022-05-09
|
## 6.0.0 - 2022-05-09
|
||||||
* [#1056](https://github.com/stripe/stripe-ruby/pull/1056) API Updates
|
* [#1056](https://github.com/stripe/stripe-ruby/pull/1056) API Updates
|
||||||
@ -264,7 +479,6 @@ Breaking changes that arose during code generation of the library that we postpo
|
|||||||
## 5.55.0 - 2022-05-05
|
## 5.55.0 - 2022-05-05
|
||||||
* [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
|
* [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
|
||||||
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
|
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
|
||||||
|
|
||||||
|
|
||||||
## 5.54.0 - 2022-05-03
|
## 5.54.0 - 2022-05-03
|
||||||
* [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
|
* [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
|
||||||
@ -1295,3 +1509,4 @@ Identical to 1.56.0 above. I incorrectly cut a patch-level release.
|
|||||||
<!--
|
<!--
|
||||||
# vim: set tw=0:
|
# vim: set tw=0:
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
11
README.md
11
README.md
@ -324,6 +324,17 @@ If your beta feature requires a `Stripe-Version` header to be sent, use the `Str
|
|||||||
Stripe.api_version += "; feature_beta=v3"
|
Stripe.api_version += "; feature_beta=v3"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Custom requests
|
||||||
|
|
||||||
|
If you would like to send a request to an undocumented API (for example you are in a private beta), or if you prefer to bypass the method definitions in the library and specify your request details directly, you can use the `raw_request` method on `Stripe`.
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
resp = Stripe.raw_request(:post, "/v1/beta_endpoint", {param: 123}, {stripe_version: "2022-11-15; feature_beta=v3"})
|
||||||
|
|
||||||
|
# (Optional) resp is a StripeResponse. You can use `Stripe.deserialize` to get a StripeObject.
|
||||||
|
deserialized_resp = Stripe.deserialize(resp.http_body)
|
||||||
|
```
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
New features and bug fixes are released on the latest major version of the Stripe Ruby library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
|
New features and bug fixes are released on the latest major version of the Stripe Ruby library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
|
||||||
|
@ -13,6 +13,7 @@ require "set"
|
|||||||
require "socket"
|
require "socket"
|
||||||
require "uri"
|
require "uri"
|
||||||
require "forwardable"
|
require "forwardable"
|
||||||
|
require "base64"
|
||||||
|
|
||||||
# Version
|
# Version
|
||||||
require "stripe/api_version"
|
require "stripe/api_version"
|
||||||
@ -45,6 +46,7 @@ require "stripe/api_resource_test_helpers"
|
|||||||
require "stripe/singleton_api_resource"
|
require "stripe/singleton_api_resource"
|
||||||
require "stripe/webhook"
|
require "stripe/webhook"
|
||||||
require "stripe/stripe_configuration"
|
require "stripe/stripe_configuration"
|
||||||
|
require "stripe/request_signing_authenticator"
|
||||||
|
|
||||||
# Named API resources
|
# Named API resources
|
||||||
require "stripe/resources"
|
require "stripe/resources"
|
||||||
@ -71,6 +73,7 @@ module Stripe
|
|||||||
|
|
||||||
# User configurable options
|
# User configurable options
|
||||||
def_delegators :@config, :api_key, :api_key=
|
def_delegators :@config, :api_key, :api_key=
|
||||||
|
def_delegators :@config, :authenticator, :authenticator=
|
||||||
def_delegators :@config, :api_version, :api_version=
|
def_delegators :@config, :api_version, :api_version=
|
||||||
def_delegators :@config, :stripe_account, :stripe_account=
|
def_delegators :@config, :stripe_account, :stripe_account=
|
||||||
def_delegators :@config, :api_base, :api_base=
|
def_delegators :@config, :api_base, :api_base=
|
||||||
@ -117,6 +120,49 @@ module Stripe
|
|||||||
version: version,
|
version: version,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Preview
|
||||||
|
def self._get_default_opts(opts)
|
||||||
|
{ api_mode: :preview }.merge(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.get(url, opts = {})
|
||||||
|
Stripe.raw_request(:get, url, {}, _get_default_opts(opts))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.post(url, params = {}, opts = {})
|
||||||
|
Stripe.raw_request(:post, url, params, _get_default_opts(opts))
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.delete(url, opts = {})
|
||||||
|
Stripe.raw_request(:delete, url, {}, _get_default_opts(opts))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class RawRequest
|
||||||
|
include Stripe::APIOperations::Request
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@opts = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
def execute(method, url, params = {}, opts = {})
|
||||||
|
resp, = execute_resource_request(method, url, params, opts)
|
||||||
|
|
||||||
|
resp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Sends a request to Stripe REST API
|
||||||
|
def self.raw_request(method, url, params = {}, opts = {})
|
||||||
|
req = RawRequest.new
|
||||||
|
req.execute(method, url, params, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.deserialize(data)
|
||||||
|
data = JSON.parse(data) if data.is_a?(String)
|
||||||
|
Util.convert_to_stripe_object(data, {})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
|
Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
|
||||||
|
@ -48,13 +48,14 @@ module Stripe
|
|||||||
api_key = headers.delete(:api_key)
|
api_key = headers.delete(:api_key)
|
||||||
api_base = headers.delete(:api_base)
|
api_base = headers.delete(:api_base)
|
||||||
client = headers.delete(:client)
|
client = headers.delete(:client)
|
||||||
|
api_mode = headers.delete(:api_mode)
|
||||||
# Assume all remaining opts must be headers
|
# Assume all remaining opts must be headers
|
||||||
|
|
||||||
resp, opts[:api_key] = client.send(
|
resp, opts[:api_key] = client.send(
|
||||||
client_request_method_sym,
|
client_request_method_sym,
|
||||||
method, url,
|
method, url,
|
||||||
api_base: api_base, api_key: api_key,
|
api_base: api_base, api_key: api_key,
|
||||||
headers: headers, params: params, usage: usage,
|
headers: headers, params: params, usage: usage, api_mode: api_mode,
|
||||||
&read_body_chunk_block
|
&read_body_chunk_block
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
module Stripe
|
module Stripe
|
||||||
module ApiVersion
|
module ApiVersion
|
||||||
CURRENT = "2023-10-16"
|
CURRENT = "2023-10-16"
|
||||||
|
PREVIEW = "2023-12-11.preview-v2"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -14,6 +14,7 @@ module Stripe
|
|||||||
# business objects
|
# business objects
|
||||||
Account::OBJECT_NAME => Account,
|
Account::OBJECT_NAME => Account,
|
||||||
AccountLink::OBJECT_NAME => AccountLink,
|
AccountLink::OBJECT_NAME => AccountLink,
|
||||||
|
AccountNotice::OBJECT_NAME => AccountNotice,
|
||||||
AccountSession::OBJECT_NAME => AccountSession,
|
AccountSession::OBJECT_NAME => AccountSession,
|
||||||
ApplePayDomain::OBJECT_NAME => ApplePayDomain,
|
ApplePayDomain::OBJECT_NAME => ApplePayDomain,
|
||||||
ApplicationFee::OBJECT_NAME => ApplicationFee,
|
ApplicationFee::OBJECT_NAME => ApplicationFee,
|
||||||
@ -25,6 +26,9 @@ module Stripe
|
|||||||
BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
|
BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
|
||||||
BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
|
BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
|
||||||
Capability::OBJECT_NAME => Capability,
|
Capability::OBJECT_NAME => Capability,
|
||||||
|
Capital::FinancingOffer::OBJECT_NAME => Capital::FinancingOffer,
|
||||||
|
Capital::FinancingSummary::OBJECT_NAME => Capital::FinancingSummary,
|
||||||
|
Capital::FinancingTransaction::OBJECT_NAME => Capital::FinancingTransaction,
|
||||||
Card::OBJECT_NAME => Card,
|
Card::OBJECT_NAME => Card,
|
||||||
CashBalance::OBJECT_NAME => CashBalance,
|
CashBalance::OBJECT_NAME => CashBalance,
|
||||||
Charge::OBJECT_NAME => Charge,
|
Charge::OBJECT_NAME => Charge,
|
||||||
@ -32,6 +36,7 @@ module Stripe
|
|||||||
Climate::Order::OBJECT_NAME => Climate::Order,
|
Climate::Order::OBJECT_NAME => Climate::Order,
|
||||||
Climate::Product::OBJECT_NAME => Climate::Product,
|
Climate::Product::OBJECT_NAME => Climate::Product,
|
||||||
Climate::Supplier::OBJECT_NAME => Climate::Supplier,
|
Climate::Supplier::OBJECT_NAME => Climate::Supplier,
|
||||||
|
ConfirmationToken::OBJECT_NAME => ConfirmationToken,
|
||||||
CountrySpec::OBJECT_NAME => CountrySpec,
|
CountrySpec::OBJECT_NAME => CountrySpec,
|
||||||
Coupon::OBJECT_NAME => Coupon,
|
Coupon::OBJECT_NAME => Coupon,
|
||||||
CreditNote::OBJECT_NAME => CreditNote,
|
CreditNote::OBJECT_NAME => CreditNote,
|
||||||
@ -39,6 +44,7 @@ module Stripe
|
|||||||
Customer::OBJECT_NAME => Customer,
|
Customer::OBJECT_NAME => Customer,
|
||||||
CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
|
CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
|
||||||
CustomerCashBalanceTransaction::OBJECT_NAME => CustomerCashBalanceTransaction,
|
CustomerCashBalanceTransaction::OBJECT_NAME => CustomerCashBalanceTransaction,
|
||||||
|
CustomerSession::OBJECT_NAME => CustomerSession,
|
||||||
Discount::OBJECT_NAME => Discount,
|
Discount::OBJECT_NAME => Discount,
|
||||||
Dispute::OBJECT_NAME => Dispute,
|
Dispute::OBJECT_NAME => Dispute,
|
||||||
EphemeralKey::OBJECT_NAME => EphemeralKey,
|
EphemeralKey::OBJECT_NAME => EphemeralKey,
|
||||||
@ -48,26 +54,36 @@ module Stripe
|
|||||||
File::OBJECT_NAME_ALT => File,
|
File::OBJECT_NAME_ALT => File,
|
||||||
FileLink::OBJECT_NAME => FileLink,
|
FileLink::OBJECT_NAME => FileLink,
|
||||||
FinancialConnections::Account::OBJECT_NAME => FinancialConnections::Account,
|
FinancialConnections::Account::OBJECT_NAME => FinancialConnections::Account,
|
||||||
|
FinancialConnections::AccountInferredBalance::OBJECT_NAME =>
|
||||||
|
FinancialConnections::AccountInferredBalance,
|
||||||
FinancialConnections::AccountOwner::OBJECT_NAME => FinancialConnections::AccountOwner,
|
FinancialConnections::AccountOwner::OBJECT_NAME => FinancialConnections::AccountOwner,
|
||||||
FinancialConnections::AccountOwnership::OBJECT_NAME =>
|
FinancialConnections::AccountOwnership::OBJECT_NAME =>
|
||||||
FinancialConnections::AccountOwnership,
|
FinancialConnections::AccountOwnership,
|
||||||
FinancialConnections::Session::OBJECT_NAME => FinancialConnections::Session,
|
FinancialConnections::Session::OBJECT_NAME => FinancialConnections::Session,
|
||||||
FinancialConnections::Transaction::OBJECT_NAME => FinancialConnections::Transaction,
|
FinancialConnections::Transaction::OBJECT_NAME => FinancialConnections::Transaction,
|
||||||
FundingInstructions::OBJECT_NAME => FundingInstructions,
|
FundingInstructions::OBJECT_NAME => FundingInstructions,
|
||||||
|
GiftCards::Card::OBJECT_NAME => GiftCards::Card,
|
||||||
|
GiftCards::Transaction::OBJECT_NAME => GiftCards::Transaction,
|
||||||
Identity::VerificationReport::OBJECT_NAME => Identity::VerificationReport,
|
Identity::VerificationReport::OBJECT_NAME => Identity::VerificationReport,
|
||||||
Identity::VerificationSession::OBJECT_NAME => Identity::VerificationSession,
|
Identity::VerificationSession::OBJECT_NAME => Identity::VerificationSession,
|
||||||
Invoice::OBJECT_NAME => Invoice,
|
Invoice::OBJECT_NAME => Invoice,
|
||||||
InvoiceItem::OBJECT_NAME => InvoiceItem,
|
InvoiceItem::OBJECT_NAME => InvoiceItem,
|
||||||
InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
|
InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
|
||||||
|
InvoicePayment::OBJECT_NAME => InvoicePayment,
|
||||||
Issuing::Authorization::OBJECT_NAME => Issuing::Authorization,
|
Issuing::Authorization::OBJECT_NAME => Issuing::Authorization,
|
||||||
Issuing::Card::OBJECT_NAME => Issuing::Card,
|
Issuing::Card::OBJECT_NAME => Issuing::Card,
|
||||||
Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
|
Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
|
||||||
|
Issuing::CreditUnderwritingRecord::OBJECT_NAME => Issuing::CreditUnderwritingRecord,
|
||||||
Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
|
Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
|
||||||
|
Issuing::PersonalizationDesign::OBJECT_NAME => Issuing::PersonalizationDesign,
|
||||||
|
Issuing::PhysicalBundle::OBJECT_NAME => Issuing::PhysicalBundle,
|
||||||
Issuing::Token::OBJECT_NAME => Issuing::Token,
|
Issuing::Token::OBJECT_NAME => Issuing::Token,
|
||||||
Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
|
Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
|
||||||
LineItem::OBJECT_NAME => LineItem,
|
LineItem::OBJECT_NAME => LineItem,
|
||||||
LoginLink::OBJECT_NAME => LoginLink,
|
LoginLink::OBJECT_NAME => LoginLink,
|
||||||
Mandate::OBJECT_NAME => Mandate,
|
Mandate::OBJECT_NAME => Mandate,
|
||||||
|
Margin::OBJECT_NAME => Margin,
|
||||||
|
Order::OBJECT_NAME => Order,
|
||||||
PaymentIntent::OBJECT_NAME => PaymentIntent,
|
PaymentIntent::OBJECT_NAME => PaymentIntent,
|
||||||
PaymentLink::OBJECT_NAME => PaymentLink,
|
PaymentLink::OBJECT_NAME => PaymentLink,
|
||||||
PaymentMethod::OBJECT_NAME => PaymentMethod,
|
PaymentMethod::OBJECT_NAME => PaymentMethod,
|
||||||
@ -80,6 +96,9 @@ module Stripe
|
|||||||
Product::OBJECT_NAME => Product,
|
Product::OBJECT_NAME => Product,
|
||||||
PromotionCode::OBJECT_NAME => PromotionCode,
|
PromotionCode::OBJECT_NAME => PromotionCode,
|
||||||
Quote::OBJECT_NAME => Quote,
|
Quote::OBJECT_NAME => Quote,
|
||||||
|
QuotePhase::OBJECT_NAME => QuotePhase,
|
||||||
|
QuotePreviewInvoice::OBJECT_NAME => QuotePreviewInvoice,
|
||||||
|
QuotePreviewSubscriptionSchedule::OBJECT_NAME => QuotePreviewSubscriptionSchedule,
|
||||||
Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
|
Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
|
||||||
Radar::ValueList::OBJECT_NAME => Radar::ValueList,
|
Radar::ValueList::OBJECT_NAME => Radar::ValueList,
|
||||||
Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
|
Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
|
||||||
@ -99,6 +118,7 @@ module Stripe
|
|||||||
SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
|
SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
|
||||||
Tax::Calculation::OBJECT_NAME => Tax::Calculation,
|
Tax::Calculation::OBJECT_NAME => Tax::Calculation,
|
||||||
Tax::CalculationLineItem::OBJECT_NAME => Tax::CalculationLineItem,
|
Tax::CalculationLineItem::OBJECT_NAME => Tax::CalculationLineItem,
|
||||||
|
Tax::Form::OBJECT_NAME => Tax::Form,
|
||||||
Tax::Registration::OBJECT_NAME => Tax::Registration,
|
Tax::Registration::OBJECT_NAME => Tax::Registration,
|
||||||
Tax::Settings::OBJECT_NAME => Tax::Settings,
|
Tax::Settings::OBJECT_NAME => Tax::Settings,
|
||||||
Tax::Transaction::OBJECT_NAME => Tax::Transaction,
|
Tax::Transaction::OBJECT_NAME => Tax::Transaction,
|
||||||
|
79
lib/stripe/request_signing_authenticator.rb
Normal file
79
lib/stripe/request_signing_authenticator.rb
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class RequestSigningAuthenticator
|
||||||
|
AUTHORIZATION_HEADER_NAME = "Authorization"
|
||||||
|
CONTENT_TYPE_HEADER_NAME = "Content-Type"
|
||||||
|
STRIPE_CONTEXT_HEADER_NAME = "Stripe-Context"
|
||||||
|
STRIPE_ACCOUNT_HEADER_NAME = "Stripe-Account"
|
||||||
|
CONTENT_DIGEST_HEADER_NAME = "Content-Digest"
|
||||||
|
SIGNATURE_INPUT_HEADER_NAME = "Signature-Input"
|
||||||
|
SIGNATURE_HEADER_NAME = "Signature"
|
||||||
|
|
||||||
|
attr_reader :auth_token, :sign_lambda
|
||||||
|
|
||||||
|
def initialize(auth_token, sign_lambda)
|
||||||
|
raise ArgumentError, "auth_token must be a string" unless auth_token.is_a?(String)
|
||||||
|
raise ArgumentError, "sign_lambda must be a lambda" unless sign_lambda.is_a?(Proc)
|
||||||
|
|
||||||
|
@auth_token = auth_token
|
||||||
|
@sign_lambda = sign_lambda
|
||||||
|
end
|
||||||
|
|
||||||
|
def authenticate(method, headers, body)
|
||||||
|
covered_headers = [CONTENT_TYPE_HEADER_NAME,
|
||||||
|
CONTENT_DIGEST_HEADER_NAME,
|
||||||
|
STRIPE_CONTEXT_HEADER_NAME,
|
||||||
|
STRIPE_ACCOUNT_HEADER_NAME,
|
||||||
|
AUTHORIZATION_HEADER_NAME,]
|
||||||
|
|
||||||
|
headers[AUTHORIZATION_HEADER_NAME] = "STRIPE-V2-SIG #{auth_token}"
|
||||||
|
|
||||||
|
if method == :get
|
||||||
|
covered_headers -= [CONTENT_TYPE_HEADER_NAME,
|
||||||
|
CONTENT_DIGEST_HEADER_NAME,]
|
||||||
|
else
|
||||||
|
content = body || ""
|
||||||
|
headers[CONTENT_DIGEST_HEADER_NAME] =
|
||||||
|
%(sha-256=:#{content_digest(content)}:)
|
||||||
|
end
|
||||||
|
|
||||||
|
covered_headers_formatted = covered_headers
|
||||||
|
.map { |string| %("#{string.downcase}") }
|
||||||
|
.join(" ")
|
||||||
|
|
||||||
|
signature_input = "(#{covered_headers_formatted});created=#{created_time}"
|
||||||
|
|
||||||
|
inputs = covered_headers
|
||||||
|
.map { |header| %("#{header.downcase}": #{headers[header]}) }
|
||||||
|
.join("\n")
|
||||||
|
|
||||||
|
signature_base = %(#{inputs}\n"@signature-params": #{signature_input})
|
||||||
|
.encode(Encoding::UTF_8)
|
||||||
|
|
||||||
|
headers[SIGNATURE_INPUT_HEADER_NAME] = "sig1=#{signature_input}"
|
||||||
|
|
||||||
|
headers[SIGNATURE_HEADER_NAME] =
|
||||||
|
"sig1=:#{encoded_signature(signature_base)}:"
|
||||||
|
end
|
||||||
|
|
||||||
|
private def sign(signature_base)
|
||||||
|
@sign_lambda.call(signature_base)
|
||||||
|
end
|
||||||
|
|
||||||
|
private def encoded_signature(signature_base)
|
||||||
|
Base64.strict_encode64(sign(signature_base))
|
||||||
|
rescue StandardError
|
||||||
|
raise AuthenticationError, "Encountered '#{e.message} (#{e.class})' " \
|
||||||
|
"when calculating request signature."
|
||||||
|
end
|
||||||
|
|
||||||
|
private def content_digest(content)
|
||||||
|
Base64.strict_encode64(OpenSSL::Digest.new("SHA256").digest(content))
|
||||||
|
end
|
||||||
|
|
||||||
|
private def created_time
|
||||||
|
Time.now.to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
require "stripe/resources/account"
|
require "stripe/resources/account"
|
||||||
require "stripe/resources/account_link"
|
require "stripe/resources/account_link"
|
||||||
|
require "stripe/resources/account_notice"
|
||||||
require "stripe/resources/account_session"
|
require "stripe/resources/account_session"
|
||||||
require "stripe/resources/apple_pay_domain"
|
require "stripe/resources/apple_pay_domain"
|
||||||
require "stripe/resources/application_fee"
|
require "stripe/resources/application_fee"
|
||||||
@ -14,6 +15,9 @@ require "stripe/resources/bank_account"
|
|||||||
require "stripe/resources/billing_portal/configuration"
|
require "stripe/resources/billing_portal/configuration"
|
||||||
require "stripe/resources/billing_portal/session"
|
require "stripe/resources/billing_portal/session"
|
||||||
require "stripe/resources/capability"
|
require "stripe/resources/capability"
|
||||||
|
require "stripe/resources/capital/financing_offer"
|
||||||
|
require "stripe/resources/capital/financing_summary"
|
||||||
|
require "stripe/resources/capital/financing_transaction"
|
||||||
require "stripe/resources/card"
|
require "stripe/resources/card"
|
||||||
require "stripe/resources/cash_balance"
|
require "stripe/resources/cash_balance"
|
||||||
require "stripe/resources/charge"
|
require "stripe/resources/charge"
|
||||||
@ -21,6 +25,7 @@ require "stripe/resources/checkout/session"
|
|||||||
require "stripe/resources/climate/order"
|
require "stripe/resources/climate/order"
|
||||||
require "stripe/resources/climate/product"
|
require "stripe/resources/climate/product"
|
||||||
require "stripe/resources/climate/supplier"
|
require "stripe/resources/climate/supplier"
|
||||||
|
require "stripe/resources/confirmation_token"
|
||||||
require "stripe/resources/country_spec"
|
require "stripe/resources/country_spec"
|
||||||
require "stripe/resources/coupon"
|
require "stripe/resources/coupon"
|
||||||
require "stripe/resources/credit_note"
|
require "stripe/resources/credit_note"
|
||||||
@ -28,6 +33,7 @@ require "stripe/resources/credit_note_line_item"
|
|||||||
require "stripe/resources/customer"
|
require "stripe/resources/customer"
|
||||||
require "stripe/resources/customer_balance_transaction"
|
require "stripe/resources/customer_balance_transaction"
|
||||||
require "stripe/resources/customer_cash_balance_transaction"
|
require "stripe/resources/customer_cash_balance_transaction"
|
||||||
|
require "stripe/resources/customer_session"
|
||||||
require "stripe/resources/discount"
|
require "stripe/resources/discount"
|
||||||
require "stripe/resources/dispute"
|
require "stripe/resources/dispute"
|
||||||
require "stripe/resources/ephemeral_key"
|
require "stripe/resources/ephemeral_key"
|
||||||
@ -36,25 +42,34 @@ require "stripe/resources/exchange_rate"
|
|||||||
require "stripe/resources/file"
|
require "stripe/resources/file"
|
||||||
require "stripe/resources/file_link"
|
require "stripe/resources/file_link"
|
||||||
require "stripe/resources/financial_connections/account"
|
require "stripe/resources/financial_connections/account"
|
||||||
|
require "stripe/resources/financial_connections/account_inferred_balance"
|
||||||
require "stripe/resources/financial_connections/account_owner"
|
require "stripe/resources/financial_connections/account_owner"
|
||||||
require "stripe/resources/financial_connections/account_ownership"
|
require "stripe/resources/financial_connections/account_ownership"
|
||||||
require "stripe/resources/financial_connections/session"
|
require "stripe/resources/financial_connections/session"
|
||||||
require "stripe/resources/financial_connections/transaction"
|
require "stripe/resources/financial_connections/transaction"
|
||||||
require "stripe/resources/funding_instructions"
|
require "stripe/resources/funding_instructions"
|
||||||
|
require "stripe/resources/gift_cards/card"
|
||||||
|
require "stripe/resources/gift_cards/transaction"
|
||||||
require "stripe/resources/identity/verification_report"
|
require "stripe/resources/identity/verification_report"
|
||||||
require "stripe/resources/identity/verification_session"
|
require "stripe/resources/identity/verification_session"
|
||||||
require "stripe/resources/invoice"
|
require "stripe/resources/invoice"
|
||||||
require "stripe/resources/invoice_item"
|
require "stripe/resources/invoice_item"
|
||||||
require "stripe/resources/invoice_line_item"
|
require "stripe/resources/invoice_line_item"
|
||||||
|
require "stripe/resources/invoice_payment"
|
||||||
require "stripe/resources/issuing/authorization"
|
require "stripe/resources/issuing/authorization"
|
||||||
require "stripe/resources/issuing/card"
|
require "stripe/resources/issuing/card"
|
||||||
require "stripe/resources/issuing/cardholder"
|
require "stripe/resources/issuing/cardholder"
|
||||||
|
require "stripe/resources/issuing/credit_underwriting_record"
|
||||||
require "stripe/resources/issuing/dispute"
|
require "stripe/resources/issuing/dispute"
|
||||||
|
require "stripe/resources/issuing/personalization_design"
|
||||||
|
require "stripe/resources/issuing/physical_bundle"
|
||||||
require "stripe/resources/issuing/token"
|
require "stripe/resources/issuing/token"
|
||||||
require "stripe/resources/issuing/transaction"
|
require "stripe/resources/issuing/transaction"
|
||||||
require "stripe/resources/line_item"
|
require "stripe/resources/line_item"
|
||||||
require "stripe/resources/login_link"
|
require "stripe/resources/login_link"
|
||||||
require "stripe/resources/mandate"
|
require "stripe/resources/mandate"
|
||||||
|
require "stripe/resources/margin"
|
||||||
|
require "stripe/resources/order"
|
||||||
require "stripe/resources/payment_intent"
|
require "stripe/resources/payment_intent"
|
||||||
require "stripe/resources/payment_link"
|
require "stripe/resources/payment_link"
|
||||||
require "stripe/resources/payment_method"
|
require "stripe/resources/payment_method"
|
||||||
@ -67,6 +82,9 @@ require "stripe/resources/price"
|
|||||||
require "stripe/resources/product"
|
require "stripe/resources/product"
|
||||||
require "stripe/resources/promotion_code"
|
require "stripe/resources/promotion_code"
|
||||||
require "stripe/resources/quote"
|
require "stripe/resources/quote"
|
||||||
|
require "stripe/resources/quote_phase"
|
||||||
|
require "stripe/resources/quote_preview_invoice"
|
||||||
|
require "stripe/resources/quote_preview_subscription_schedule"
|
||||||
require "stripe/resources/radar/early_fraud_warning"
|
require "stripe/resources/radar/early_fraud_warning"
|
||||||
require "stripe/resources/radar/value_list"
|
require "stripe/resources/radar/value_list"
|
||||||
require "stripe/resources/radar/value_list_item"
|
require "stripe/resources/radar/value_list_item"
|
||||||
@ -86,6 +104,7 @@ require "stripe/resources/subscription_item"
|
|||||||
require "stripe/resources/subscription_schedule"
|
require "stripe/resources/subscription_schedule"
|
||||||
require "stripe/resources/tax/calculation"
|
require "stripe/resources/tax/calculation"
|
||||||
require "stripe/resources/tax/calculation_line_item"
|
require "stripe/resources/tax/calculation_line_item"
|
||||||
|
require "stripe/resources/tax/form"
|
||||||
require "stripe/resources/tax/registration"
|
require "stripe/resources/tax/registration"
|
||||||
require "stripe/resources/tax/settings"
|
require "stripe/resources/tax/settings"
|
||||||
require "stripe/resources/tax/transaction"
|
require "stripe/resources/tax/transaction"
|
||||||
|
14
lib/stripe/resources/account_notice.rb
Normal file
14
lib/stripe/resources/account_notice.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# A notice to a Connected account. Notice can be sent by Stripe on your behalf or you can opt to send the notices yourself.
|
||||||
|
#
|
||||||
|
# See the [guide to send notices](https://stripe.com/docs/issuing/compliance-us/issuing-regulated-customer-notices) to your connected accounts.
|
||||||
|
class AccountNotice < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
include Stripe::APIOperations::Save
|
||||||
|
|
||||||
|
OBJECT_NAME = "account_notice"
|
||||||
|
end
|
||||||
|
end
|
36
lib/stripe/resources/capital/financing_offer.rb
Normal file
36
lib/stripe/resources/capital/financing_offer.rb
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Capital
|
||||||
|
# This is an object representing an offer of financing from
|
||||||
|
# Stripe Capital to a Connect subaccount.
|
||||||
|
class FinancingOffer < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "capital.financing_offer"
|
||||||
|
|
||||||
|
# Acknowledges that platform has received and delivered the financing_offer to
|
||||||
|
# the intended merchant recipient.
|
||||||
|
def mark_delivered(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/capital/financing_offers/%<financing_offer>s/mark_delivered", { financing_offer: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Acknowledges that platform has received and delivered the financing_offer to
|
||||||
|
# the intended merchant recipient.
|
||||||
|
def self.mark_delivered(financing_offer, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/capital/financing_offers/%<financing_offer>s/mark_delivered", { financing_offer: CGI.escape(financing_offer) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
lib/stripe/resources/capital/financing_summary.rb
Normal file
12
lib/stripe/resources/capital/financing_summary.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Capital
|
||||||
|
# A financing object describes an account's current financing state. Used by Connect
|
||||||
|
# platforms to read the state of Capital offered to their connected accounts.
|
||||||
|
class FinancingSummary < SingletonAPIResource
|
||||||
|
OBJECT_NAME = "capital.financing_summary"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/stripe/resources/capital/financing_transaction.rb
Normal file
13
lib/stripe/resources/capital/financing_transaction.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Capital
|
||||||
|
# This is an object representing the details of a transaction on a Capital financing object.
|
||||||
|
class FinancingTransaction < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "capital.financing_transaction"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/stripe/resources/confirmation_token.rb
Normal file
13
lib/stripe/resources/confirmation_token.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# ConfirmationTokens help transport client side data collected by Stripe JS over
|
||||||
|
# to your server for confirming a PaymentIntent or SetupIntent. If the confirmation
|
||||||
|
# is successful, values present on the ConfirmationToken are written onto the Intent.
|
||||||
|
#
|
||||||
|
# To learn more or request access, visit the related guided: [Finalize payments on the server using Confirmation Tokens](https://stripe.com/docs/payments/finalize-payments-on-the-server-confirmation-tokens).
|
||||||
|
class ConfirmationToken < APIResource
|
||||||
|
OBJECT_NAME = "confirmation_token"
|
||||||
|
end
|
||||||
|
end
|
12
lib/stripe/resources/customer_session.rb
Normal file
12
lib/stripe/resources/customer_session.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# A customer session allows you to grant client access to Stripe's frontend SDKs (like StripeJs)
|
||||||
|
# control over a customer.
|
||||||
|
class CustomerSession < APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
|
||||||
|
OBJECT_NAME = "customer_session"
|
||||||
|
end
|
||||||
|
end
|
@ -6,9 +6,12 @@ module Stripe
|
|||||||
# A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access.
|
# A Financial Connections Account represents an account that exists outside of Stripe, to which you have been granted some degree of access.
|
||||||
class Account < APIResource
|
class Account < APIResource
|
||||||
extend Stripe::APIOperations::List
|
extend Stripe::APIOperations::List
|
||||||
|
extend Stripe::APIOperations::NestedResource
|
||||||
|
|
||||||
OBJECT_NAME = "financial_connections.account"
|
OBJECT_NAME = "financial_connections.account"
|
||||||
|
|
||||||
|
nested_resource_class_methods :inferred_balance, operations: %i[list]
|
||||||
|
|
||||||
# Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
|
# Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions).
|
||||||
def disconnect(params = {}, opts = {})
|
def disconnect(params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module FinancialConnections
|
||||||
|
# A historical balance for the account on a particular day. It may be sourced from a balance snapshot provided by a financial institution, or inferred using transactions data.
|
||||||
|
class AccountInferredBalance < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "financial_connections.account_inferred_balance"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
26
lib/stripe/resources/gift_cards/card.rb
Normal file
26
lib/stripe/resources/gift_cards/card.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module GiftCards
|
||||||
|
# A gift card represents a single gift card owned by a customer, including the
|
||||||
|
# remaining balance, gift card code, and whether or not it is active.
|
||||||
|
class Card < APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
include Stripe::APIOperations::Save
|
||||||
|
|
||||||
|
OBJECT_NAME = "gift_cards.card"
|
||||||
|
|
||||||
|
# Validates a gift card code, returning the matching gift card object if it exists.
|
||||||
|
def self.validate(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/gift_cards/cards/validate",
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
60
lib/stripe/resources/gift_cards/transaction.rb
Normal file
60
lib/stripe/resources/gift_cards/transaction.rb
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module GiftCards
|
||||||
|
# A gift card transaction represents a single transaction on a referenced gift card.
|
||||||
|
# A transaction is in one of three states, `confirmed`, `held` or `canceled`. A `confirmed`
|
||||||
|
# transaction is one that has added/deducted funds. A `held` transaction has created a
|
||||||
|
# temporary hold on funds, which can then be cancelled or confirmed. A `held` transaction
|
||||||
|
# can be confirmed into a `confirmed` transaction, or canceled into a `canceled` transaction.
|
||||||
|
# A `canceled` transaction has no effect on a gift card's balance.
|
||||||
|
class Transaction < APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
include Stripe::APIOperations::Save
|
||||||
|
|
||||||
|
OBJECT_NAME = "gift_cards.transaction"
|
||||||
|
|
||||||
|
# Cancel a gift card transaction
|
||||||
|
def cancel(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/gift_cards/transactions/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Confirm a gift card transaction
|
||||||
|
def confirm(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/gift_cards/transactions/%<id>s/confirm", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Cancel a gift card transaction
|
||||||
|
def self.cancel(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/gift_cards/transactions/%<id>s/cancel", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Confirm a gift card transaction
|
||||||
|
def self.confirm(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/gift_cards/transactions/%<id>s/confirm", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -40,9 +40,30 @@ module Stripe
|
|||||||
extend Stripe::APIOperations::List
|
extend Stripe::APIOperations::List
|
||||||
extend Stripe::APIOperations::Search
|
extend Stripe::APIOperations::Search
|
||||||
include Stripe::APIOperations::Save
|
include Stripe::APIOperations::Save
|
||||||
|
extend Stripe::APIOperations::NestedResource
|
||||||
|
|
||||||
OBJECT_NAME = "invoice"
|
OBJECT_NAME = "invoice"
|
||||||
|
|
||||||
|
nested_resource_class_methods :payment, operations: %i[retrieve list]
|
||||||
|
|
||||||
|
# Attaches a PaymentIntent to the invoice, adding it to the list of payments.
|
||||||
|
# When the PaymentIntent's status changes to succeeded, the payment is credited
|
||||||
|
# to the invoice, increasing its amount_paid. When the invoice is fully paid, the
|
||||||
|
# invoice's status becomes paid.
|
||||||
|
#
|
||||||
|
# If the PaymentIntent's status is already succeeded when it is attached, it is
|
||||||
|
# credited to the invoice immediately.
|
||||||
|
#
|
||||||
|
# Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
|
||||||
|
def attach_payment_intent(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
|
# Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
|
||||||
def finalize_invoice(params = {}, opts = {})
|
def finalize_invoice(params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
@ -95,6 +116,24 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Attaches a PaymentIntent to the invoice, adding it to the list of payments.
|
||||||
|
# When the PaymentIntent's status changes to succeeded, the payment is credited
|
||||||
|
# to the invoice, increasing its amount_paid. When the invoice is fully paid, the
|
||||||
|
# invoice's status becomes paid.
|
||||||
|
#
|
||||||
|
# If the PaymentIntent's status is already succeeded when it is attached, it is
|
||||||
|
# credited to the invoice immediately.
|
||||||
|
#
|
||||||
|
# Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
|
||||||
|
def self.attach_payment_intent(invoice, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/invoices/%<invoice>s/attach_payment_intent", { invoice: CGI.escape(invoice) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
|
# Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
|
||||||
def self.finalize_invoice(invoice, params = {}, opts = {})
|
def self.finalize_invoice(invoice, params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
|
11
lib/stripe/resources/invoice_payment.rb
Normal file
11
lib/stripe/resources/invoice_payment.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# The invoice payment object
|
||||||
|
class InvoicePayment < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "invoice_payment"
|
||||||
|
end
|
||||||
|
end
|
75
lib/stripe/resources/issuing/credit_underwriting_record.rb
Normal file
75
lib/stripe/resources/issuing/credit_underwriting_record.rb
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Issuing
|
||||||
|
# Every time an applicant submits an application for a Charge Card product your platform offers, or every time your platform takes a proactive credit decision on an existing account, you must record the decision by creating a new `CreditUnderwritingRecord` object on a connected account.
|
||||||
|
#
|
||||||
|
# [Follow the guide](https://stripe.com/docs/issuing/credit/report-credit-decisions-and-manage-aans) to learn about your requirements as a platform.
|
||||||
|
class CreditUnderwritingRecord < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "issuing.credit_underwriting_record"
|
||||||
|
|
||||||
|
# Update a CreditUnderwritingRecord object to correct mistakes.
|
||||||
|
def correct(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/correct", { credit_underwriting_record: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update a CreditUnderwritingRecord object from a decision made on a credit application.
|
||||||
|
def report_decision(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/report_decision", { credit_underwriting_record: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update a CreditUnderwritingRecord object to correct mistakes.
|
||||||
|
def self.correct(credit_underwriting_record, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/correct", { credit_underwriting_record: CGI.escape(credit_underwriting_record) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Creates a CreditUnderwritingRecord object with information about a credit application submission.
|
||||||
|
def self.create_from_application(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/issuing/credit_underwriting_records/create_from_application",
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Creates a CreditUnderwritingRecord object from an underwriting decision coming from a proactive review of an existing accountholder.
|
||||||
|
def self.create_from_proactive_review(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/issuing/credit_underwriting_records/create_from_proactive_review",
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update a CreditUnderwritingRecord object from a decision made on a credit application.
|
||||||
|
def self.report_decision(credit_underwriting_record, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/issuing/credit_underwriting_records/%<credit_underwriting_record>s/report_decision", { credit_underwriting_record: CGI.escape(credit_underwriting_record) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
83
lib/stripe/resources/issuing/personalization_design.rb
Normal file
83
lib/stripe/resources/issuing/personalization_design.rb
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Issuing
|
||||||
|
# A Personalization Design is a logical grouping of a Physical Bundle, card logo, and carrier text that represents a product line.
|
||||||
|
class PersonalizationDesign < APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
include Stripe::APIOperations::Save
|
||||||
|
|
||||||
|
OBJECT_NAME = "issuing.personalization_design"
|
||||||
|
|
||||||
|
def test_helpers
|
||||||
|
TestHelpers.new(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
class TestHelpers < APIResourceTestHelpers
|
||||||
|
RESOURCE_CLASS = PersonalizationDesign
|
||||||
|
|
||||||
|
# Updates the status of the specified testmode personalization design object to active.
|
||||||
|
def self.activate(personalization_design, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/test_helpers/issuing/personalization_designs/%<personalization_design>s/activate", { personalization_design: CGI.escape(personalization_design) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates the status of the specified testmode personalization design object to inactive.
|
||||||
|
def self.deactivate(personalization_design, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/test_helpers/issuing/personalization_designs/%<personalization_design>s/deactivate", { personalization_design: CGI.escape(personalization_design) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates the status of the specified testmode personalization design object to rejected.
|
||||||
|
def self.reject(personalization_design, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/test_helpers/issuing/personalization_designs/%<personalization_design>s/reject", { personalization_design: CGI.escape(personalization_design) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates the status of the specified testmode personalization design object to active.
|
||||||
|
def activate(params = {}, opts = {})
|
||||||
|
@resource.request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/test_helpers/issuing/personalization_designs/%<personalization_design>s/activate", { personalization_design: CGI.escape(@resource["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates the status of the specified testmode personalization design object to inactive.
|
||||||
|
def deactivate(params = {}, opts = {})
|
||||||
|
@resource.request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/test_helpers/issuing/personalization_designs/%<personalization_design>s/deactivate", { personalization_design: CGI.escape(@resource["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates the status of the specified testmode personalization design object to rejected.
|
||||||
|
def reject(params = {}, opts = {})
|
||||||
|
@resource.request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/test_helpers/issuing/personalization_designs/%<personalization_design>s/reject", { personalization_design: CGI.escape(@resource["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/stripe/resources/issuing/physical_bundle.rb
Normal file
13
lib/stripe/resources/issuing/physical_bundle.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Issuing
|
||||||
|
# A Physical Bundle represents the bundle of physical items - card stock, carrier letter, and envelope - that is shipped to a cardholder when you create a physical card.
|
||||||
|
class PhysicalBundle < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "issuing.physical_bundle"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
14
lib/stripe/resources/margin.rb
Normal file
14
lib/stripe/resources/margin.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# A (partner) margin represents a specific discount distributed in partner reseller programs to business partners who
|
||||||
|
# resell products and services and earn a discount (margin) for doing so.
|
||||||
|
class Margin < APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
include Stripe::APIOperations::Save
|
||||||
|
|
||||||
|
OBJECT_NAME = "margin"
|
||||||
|
end
|
||||||
|
end
|
97
lib/stripe/resources/order.rb
Normal file
97
lib/stripe/resources/order.rb
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# An Order describes a purchase being made by a customer, including the
|
||||||
|
# products & quantities being purchased, the order status, the payment information,
|
||||||
|
# and the billing/shipping details.
|
||||||
|
#
|
||||||
|
# Related guide: [Orders overview](https://stripe.com/docs/orders)
|
||||||
|
class Order < APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
include Stripe::APIOperations::Save
|
||||||
|
|
||||||
|
OBJECT_NAME = "order"
|
||||||
|
|
||||||
|
# Cancels the order as well as the payment intent if one is attached.
|
||||||
|
def cancel(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
|
||||||
|
def list_line_items(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Reopens a submitted order.
|
||||||
|
def reopen(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the [reopen](https://stripe.com/docs/api#reopen_order) method is called.
|
||||||
|
def submit(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Cancels the order as well as the payment intent if one is attached.
|
||||||
|
def self.cancel(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# When retrieving an order, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
|
||||||
|
def self.list_line_items(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Reopens a submitted order.
|
||||||
|
def self.reopen(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Submitting an Order transitions the status to processing and creates a PaymentIntent object so the order can be paid. If the Order has an amount_total of 0, no PaymentIntent object will be created. Once the order is submitted, its contents cannot be changed, unless the [reopen](https://stripe.com/docs/api#reopen_order) method is called.
|
||||||
|
def self.submit(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -8,9 +8,13 @@ module Stripe
|
|||||||
extend Stripe::APIOperations::Create
|
extend Stripe::APIOperations::Create
|
||||||
extend Stripe::APIOperations::List
|
extend Stripe::APIOperations::List
|
||||||
include Stripe::APIOperations::Save
|
include Stripe::APIOperations::Save
|
||||||
|
extend Stripe::APIOperations::NestedResource
|
||||||
|
|
||||||
OBJECT_NAME = "quote"
|
OBJECT_NAME = "quote"
|
||||||
|
|
||||||
|
nested_resource_class_methods :preview_invoice, operations: %i[list]
|
||||||
|
nested_resource_class_methods :preview_subscription_schedule, operations: %i[list]
|
||||||
|
|
||||||
# Accepts the specified quote.
|
# Accepts the specified quote.
|
||||||
def accept(params = {}, opts = {})
|
def accept(params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
@ -61,6 +65,46 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
|
||||||
|
def list_lines(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Preview the invoice line items that would be generated by accepting the quote.
|
||||||
|
def list_preview_invoice_lines(preview_invoice, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(self["id"]), preview_invoice: CGI.escape(preview_invoice) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Converts a stale quote to draft.
|
||||||
|
def mark_draft(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Converts a draft or open quote to stale.
|
||||||
|
def mark_stale(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Download the PDF for a finalized quote
|
# Download the PDF for a finalized quote
|
||||||
def pdf(params = {}, opts = {}, &read_body_chunk_block)
|
def pdf(params = {}, opts = {}, &read_body_chunk_block)
|
||||||
config = opts[:client]&.config || Stripe.config
|
config = opts[:client]&.config || Stripe.config
|
||||||
@ -74,6 +118,16 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Recompute the upcoming invoice estimate for the quote.
|
||||||
|
def reestimate(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Accepts the specified quote.
|
# Accepts the specified quote.
|
||||||
def self.accept(quote, params = {}, opts = {})
|
def self.accept(quote, params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
@ -124,6 +178,46 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Retrieves a paginated list of lines for a quote. These lines describe changes that will be used to create new subscription schedules or update existing subscription schedules when the quote is accepted.
|
||||||
|
def self.list_lines(quote, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/quotes/%<quote>s/lines", { quote: CGI.escape(quote) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Preview the invoice line items that would be generated by accepting the quote.
|
||||||
|
def self.list_preview_invoice_lines(quote, preview_invoice, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/quotes/%<quote>s/preview_invoices/%<preview_invoice>s/lines", { quote: CGI.escape(quote), preview_invoice: CGI.escape(preview_invoice) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Converts a stale quote to draft.
|
||||||
|
def self.mark_draft(quote, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/quotes/%<quote>s/mark_draft", { quote: CGI.escape(quote) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Converts a draft or open quote to stale.
|
||||||
|
def self.mark_stale(quote, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/quotes/%<quote>s/mark_stale", { quote: CGI.escape(quote) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Download the PDF for a finalized quote
|
# Download the PDF for a finalized quote
|
||||||
def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
|
def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block)
|
||||||
config = opts[:client]&.config || Stripe.config
|
config = opts[:client]&.config || Stripe.config
|
||||||
@ -136,5 +230,15 @@ module Stripe
|
|||||||
&read_body_chunk_block
|
&read_body_chunk_block
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Recompute the upcoming invoice estimate for the quote.
|
||||||
|
def self.reestimate(quote, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/quotes/%<quote>s/reestimate", { quote: CGI.escape(quote) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
31
lib/stripe/resources/quote_phase.rb
Normal file
31
lib/stripe/resources/quote_phase.rb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# A quote phase describes the line items, coupons, and trialing status of a subscription for a predefined time period.
|
||||||
|
class QuotePhase < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "quote_phase"
|
||||||
|
|
||||||
|
# When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
|
||||||
|
def list_line_items(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/quote_phases/%<quote_phase>s/line_items", { quote_phase: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# When retrieving a quote phase, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
|
||||||
|
def self.list_line_items(quote_phase, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/quote_phases/%<quote_phase>s/line_items", { quote_phase: CGI.escape(quote_phase) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
42
lib/stripe/resources/quote_preview_invoice.rb
Normal file
42
lib/stripe/resources/quote_preview_invoice.rb
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# Invoices are statements of amounts owed by a customer, and are either
|
||||||
|
# generated one-off, or generated periodically from a subscription.
|
||||||
|
#
|
||||||
|
# They contain [invoice items](https://stripe.com/docs/api#invoiceitems), and proration adjustments
|
||||||
|
# that may be caused by subscription upgrades/downgrades (if necessary).
|
||||||
|
#
|
||||||
|
# If your invoice is configured to be billed through automatic charges,
|
||||||
|
# Stripe automatically finalizes your invoice and attempts payment. Note
|
||||||
|
# that finalizing the invoice,
|
||||||
|
# [when automatic](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection), does
|
||||||
|
# not happen immediately as the invoice is created. Stripe waits
|
||||||
|
# until one hour after the last webhook was successfully sent (or the last
|
||||||
|
# webhook timed out after failing). If you (and the platforms you may have
|
||||||
|
# connected to) have no webhooks configured, Stripe waits one hour after
|
||||||
|
# creation to finalize the invoice.
|
||||||
|
#
|
||||||
|
# If your invoice is configured to be billed by sending an email, then based on your
|
||||||
|
# [email settings](https://dashboard.stripe.com/account/billing/automatic),
|
||||||
|
# Stripe will email the invoice to your customer and await payment. These
|
||||||
|
# emails can contain a link to a hosted page to pay the invoice.
|
||||||
|
#
|
||||||
|
# Stripe applies any customer credit on the account before determining the
|
||||||
|
# amount due for the invoice (i.e., the amount that will be actually
|
||||||
|
# charged). If the amount due for the invoice is less than Stripe's [minimum allowed charge
|
||||||
|
# per currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts), the
|
||||||
|
# invoice is automatically marked paid, and we add the amount due to the
|
||||||
|
# customer's credit balance which is applied to the next invoice.
|
||||||
|
#
|
||||||
|
# More details on the customer's credit balance are
|
||||||
|
# [here](https://stripe.com/docs/billing/customer/balance).
|
||||||
|
#
|
||||||
|
# Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending)
|
||||||
|
class QuotePreviewInvoice < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "quote_preview_invoice"
|
||||||
|
end
|
||||||
|
end
|
10
lib/stripe/resources/quote_preview_subscription_schedule.rb
Normal file
10
lib/stripe/resources/quote_preview_subscription_schedule.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class QuotePreviewSubscriptionSchedule < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "quote_preview_subscription_schedule"
|
||||||
|
end
|
||||||
|
end
|
@ -12,6 +12,16 @@ module Stripe
|
|||||||
|
|
||||||
OBJECT_NAME = "subscription_schedule"
|
OBJECT_NAME = "subscription_schedule"
|
||||||
|
|
||||||
|
# Amends an existing subscription schedule.
|
||||||
|
def amend(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
|
# Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
|
||||||
def cancel(params = {}, opts = {})
|
def cancel(params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
@ -32,6 +42,16 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Amends an existing subscription schedule.
|
||||||
|
def self.amend(schedule, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(schedule) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
|
# Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
|
||||||
def self.cancel(schedule, params = {}, opts = {})
|
def self.cancel(schedule, params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
|
41
lib/stripe/resources/tax/form.rb
Normal file
41
lib/stripe/resources/tax/form.rb
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Tax
|
||||||
|
# Tax forms are legal documents which are delivered to one or more tax authorities for information reporting purposes.
|
||||||
|
#
|
||||||
|
# Related guide: [US tax reporting for Connect platforms](https://stripe.com/docs/connect/tax-reporting)
|
||||||
|
class Form < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "tax.form"
|
||||||
|
|
||||||
|
# Download the PDF for a tax form.
|
||||||
|
def pdf(params = {}, opts = {}, &read_body_chunk_block)
|
||||||
|
config = opts[:client]&.config || Stripe.config
|
||||||
|
opts = { api_base: config.uploads_base }.merge(opts)
|
||||||
|
request_stream(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/tax/forms/%<id>s/pdf", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
&read_body_chunk_block
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Download the PDF for a tax form.
|
||||||
|
def self.pdf(id, params = {}, opts = {}, &read_body_chunk_block)
|
||||||
|
config = opts[:client]&.config || Stripe.config
|
||||||
|
opts = { api_base: config.uploads_base }.merge(opts)
|
||||||
|
execute_resource_request_stream(
|
||||||
|
:get,
|
||||||
|
format("/v1/tax/forms/%<id>s/pdf", { id: CGI.escape(id) }),
|
||||||
|
params,
|
||||||
|
opts,
|
||||||
|
&read_body_chunk_block
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -24,6 +24,36 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Initiates an input collection flow on a Reader.
|
||||||
|
def collect_inputs(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.
|
||||||
|
def collect_payment_method(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Finalizes a payment on a Reader.
|
||||||
|
def confirm_payment_intent(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Initiates a payment flow on a Reader.
|
# Initiates a payment flow on a Reader.
|
||||||
def process_payment_intent(params = {}, opts = {})
|
def process_payment_intent(params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
@ -74,6 +104,36 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Initiates an input collection flow on a Reader.
|
||||||
|
def self.collect_inputs(reader, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/terminal/readers/%<reader>s/collect_inputs", { reader: CGI.escape(reader) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Initiates a payment flow on a Reader and updates the PaymentIntent with card details before manual confirmation.
|
||||||
|
def self.collect_payment_method(reader, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/terminal/readers/%<reader>s/collect_payment_method", { reader: CGI.escape(reader) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Finalizes a payment on a Reader.
|
||||||
|
def self.confirm_payment_intent(reader, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/terminal/readers/%<reader>s/confirm_payment_intent", { reader: CGI.escape(reader) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Initiates a payment flow on a Reader.
|
# Initiates a payment flow on a Reader.
|
||||||
def self.process_payment_intent(reader, params = {}, opts = {})
|
def self.process_payment_intent(reader, params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
|
@ -209,9 +209,10 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
def execute_request(method, path,
|
def execute_request(method, path,
|
||||||
api_base: nil, api_key: nil, headers: {}, params: {}, usage: [])
|
api_base: nil, api_key: nil,
|
||||||
|
headers: {}, params: {}, api_mode: nil, usage: [])
|
||||||
http_resp, api_key = execute_request_internal(
|
http_resp, api_key = execute_request_internal(
|
||||||
method, path, api_base, api_key, headers, params, usage
|
method, path, api_base, api_key, headers, params, api_mode, usage
|
||||||
)
|
)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -242,6 +243,7 @@ module Stripe
|
|||||||
def execute_request_stream(method, path,
|
def execute_request_stream(method, path,
|
||||||
api_base: nil, api_key: nil, usage: [],
|
api_base: nil, api_key: nil, usage: [],
|
||||||
headers: {}, params: {},
|
headers: {}, params: {},
|
||||||
|
api_mode: nil,
|
||||||
&read_body_chunk_block)
|
&read_body_chunk_block)
|
||||||
unless block_given?
|
unless block_given?
|
||||||
raise ArgumentError,
|
raise ArgumentError,
|
||||||
@ -249,7 +251,8 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
http_resp, api_key = execute_request_internal(
|
http_resp, api_key = execute_request_internal(
|
||||||
method, path, api_base, api_key, headers, params, usage, &read_body_chunk_block
|
method, path, api_base, api_key,
|
||||||
|
headers, params, api_mode, usage, &read_body_chunk_block
|
||||||
)
|
)
|
||||||
|
|
||||||
# When the read_body_chunk_block is given, we no longer have access to the
|
# When the read_body_chunk_block is given, we no longer have access to the
|
||||||
@ -428,8 +431,8 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
private def execute_request_internal(method, path,
|
private def execute_request_internal(method, path,
|
||||||
api_base, api_key, headers, params, usage,
|
api_base, api_key, headers, params,
|
||||||
&read_body_chunk_block)
|
api_mode, usage, &read_body_chunk_block)
|
||||||
raise ArgumentError, "method should be a symbol" \
|
raise ArgumentError, "method should be a symbol" \
|
||||||
unless method.is_a?(Symbol)
|
unless method.is_a?(Symbol)
|
||||||
raise ArgumentError, "path should be a string" \
|
raise ArgumentError, "path should be a string" \
|
||||||
@ -437,9 +440,10 @@ module Stripe
|
|||||||
|
|
||||||
api_base ||= config.api_base
|
api_base ||= config.api_base
|
||||||
api_key ||= config.api_key
|
api_key ||= config.api_key
|
||||||
|
authenticator ||= config.authenticator
|
||||||
params = Util.objects_to_ids(params)
|
params = Util.objects_to_ids(params)
|
||||||
|
|
||||||
check_api_key!(api_key)
|
check_keys!(api_key, authenticator)
|
||||||
|
|
||||||
body_params = nil
|
body_params = nil
|
||||||
query_params = nil
|
query_params = nil
|
||||||
@ -452,8 +456,9 @@ module Stripe
|
|||||||
|
|
||||||
query_params, path = merge_query_params(query_params, path)
|
query_params, path = merge_query_params(query_params, path)
|
||||||
|
|
||||||
headers = request_headers(api_key, method)
|
headers = request_headers(api_key, method, api_mode)
|
||||||
.update(Util.normalize_headers(headers))
|
.update(Util.normalize_headers(headers))
|
||||||
|
|
||||||
url = api_url(path, api_base)
|
url = api_url(path, api_base)
|
||||||
|
|
||||||
# Merge given query parameters with any already encoded in the path.
|
# Merge given query parameters with any already encoded in the path.
|
||||||
@ -464,13 +469,16 @@ module Stripe
|
|||||||
# a log-friendly variant of the encoded form. File objects are displayed
|
# a log-friendly variant of the encoded form. File objects are displayed
|
||||||
# as such instead of as their file contents.
|
# as such instead of as their file contents.
|
||||||
body, body_log =
|
body, body_log =
|
||||||
body_params ? encode_body(body_params, headers) : [nil, nil]
|
body_params ? encode_body(body_params, headers, api_mode) : [nil, nil]
|
||||||
|
|
||||||
|
authenticator.authenticate(method, headers, body) unless api_key
|
||||||
|
|
||||||
# stores information on the request we're about to make so that we don't
|
# stores information on the request we're about to make so that we don't
|
||||||
# have to pass as many parameters around for logging.
|
# have to pass as many parameters around for logging.
|
||||||
context = RequestLogContext.new
|
context = RequestLogContext.new
|
||||||
context.account = headers["Stripe-Account"]
|
context.account = headers["Stripe-Account"]
|
||||||
context.api_key = api_key
|
context.api_key = api_key
|
||||||
|
context.authenticator = authenticator
|
||||||
context.api_version = headers["Stripe-Version"]
|
context.api_version = headers["Stripe-Version"]
|
||||||
context.body = body_log
|
context.body = body_log
|
||||||
context.idempotency_key = headers["Idempotency-Key"]
|
context.idempotency_key = headers["Idempotency-Key"]
|
||||||
@ -507,8 +515,16 @@ module Stripe
|
|||||||
(api_base || config.api_base) + url
|
(api_base || config.api_base) + url
|
||||||
end
|
end
|
||||||
|
|
||||||
private def check_api_key!(api_key)
|
private def check_keys!(api_key, authenticator)
|
||||||
unless api_key
|
if api_key && authenticator
|
||||||
|
raise AuthenticationError, "Can't specify both API key " \
|
||||||
|
"and authenticator. Either set your API key" \
|
||||||
|
'using "Stripe.api_key = <API-KEY>", or set your authenticator ' \
|
||||||
|
'using "Stripe.authenticator = <AUTHENTICATOR>"' \
|
||||||
|
end
|
||||||
|
|
||||||
|
unless api_key || authenticator
|
||||||
|
# Default to missing API key error message for general users.
|
||||||
raise AuthenticationError, "No API key provided. " \
|
raise AuthenticationError, "No API key provided. " \
|
||||||
'Set your API key using "Stripe.api_key = <API-KEY>". ' \
|
'Set your API key using "Stripe.api_key = <API-KEY>". ' \
|
||||||
"You can generate API keys from the Stripe web interface. " \
|
"You can generate API keys from the Stripe web interface. " \
|
||||||
@ -527,7 +543,7 @@ module Stripe
|
|||||||
# Encodes a set of body parameters using multipart if `Content-Type` is set
|
# Encodes a set of body parameters using multipart if `Content-Type` is set
|
||||||
# for that, or standard form-encoding otherwise. Returns the encoded body
|
# for that, or standard form-encoding otherwise. Returns the encoded body
|
||||||
# and a version of the encoded body that's safe to be logged.
|
# and a version of the encoded body that's safe to be logged.
|
||||||
private def encode_body(body_params, headers)
|
private def encode_body(body_params, headers, api_mode)
|
||||||
body = nil
|
body = nil
|
||||||
flattened_params = Util.flatten_params(body_params)
|
flattened_params = Util.flatten_params(body_params)
|
||||||
|
|
||||||
@ -543,15 +559,22 @@ module Stripe
|
|||||||
flattened_params =
|
flattened_params =
|
||||||
flattened_params.map { |k, v| [k, v.is_a?(String) ? v : v.to_s] }.to_h
|
flattened_params.map { |k, v| [k, v.is_a?(String) ? v : v.to_s] }.to_h
|
||||||
|
|
||||||
|
elsif api_mode == :preview
|
||||||
|
body = JSON.generate(body_params)
|
||||||
|
headers["Content-Type"] = "application/json"
|
||||||
else
|
else
|
||||||
body = Util.encode_parameters(body_params)
|
body = Util.encode_parameters(body_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
# We don't use `Util.encode_parameters` partly as an optimization (to not
|
body_log = if api_mode == :preview
|
||||||
# redo work we've already done), and partly because the encoded forms of
|
body
|
||||||
# certain characters introduce a lot of visual noise and it's nice to
|
else
|
||||||
# have a clearer format for logs.
|
# We don't use `Util.encode_parameters` partly as an optimization (to
|
||||||
body_log = flattened_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
# not redo work we've already done), and partly because the encoded
|
||||||
|
# forms of certain characters introduce a lot of visual noise and it's
|
||||||
|
# nice to have a clearer format for logs.
|
||||||
|
flattened_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
||||||
|
end
|
||||||
|
|
||||||
[body, body_log]
|
[body, body_log]
|
||||||
end
|
end
|
||||||
@ -738,10 +761,11 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
private def specific_api_error(resp, error_data, context)
|
private def specific_api_error(resp, error_data, context)
|
||||||
|
message = error_data[:message]
|
||||||
Util.log_error("Stripe API error",
|
Util.log_error("Stripe API error",
|
||||||
status: resp.http_status,
|
status: resp.http_status,
|
||||||
error_code: error_data[:code],
|
error_code: error_data[:code],
|
||||||
error_message: error_data[:message],
|
error_message: message,
|
||||||
error_param: error_data[:param],
|
error_param: error_data[:param],
|
||||||
error_type: error_data[:type],
|
error_type: error_data[:type],
|
||||||
idempotency_key: context.idempotency_key,
|
idempotency_key: context.idempotency_key,
|
||||||
@ -762,26 +786,26 @@ module Stripe
|
|||||||
when 400, 404
|
when 400, 404
|
||||||
case error_data[:type]
|
case error_data[:type]
|
||||||
when "idempotency_error"
|
when "idempotency_error"
|
||||||
IdempotencyError.new(error_data[:message], **opts)
|
IdempotencyError.new(message, **opts)
|
||||||
else
|
else
|
||||||
InvalidRequestError.new(
|
InvalidRequestError.new(
|
||||||
error_data[:message], error_data[:param],
|
message, error_data[:param],
|
||||||
**opts
|
**opts
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
when 401
|
when 401
|
||||||
AuthenticationError.new(error_data[:message], **opts)
|
AuthenticationError.new(message, **opts)
|
||||||
when 402
|
when 402
|
||||||
CardError.new(
|
CardError.new(
|
||||||
error_data[:message], error_data[:param],
|
message, error_data[:param],
|
||||||
**opts
|
**opts
|
||||||
)
|
)
|
||||||
when 403
|
when 403
|
||||||
PermissionError.new(error_data[:message], **opts)
|
PermissionError.new(message, **opts)
|
||||||
when 429
|
when 429
|
||||||
RateLimitError.new(error_data[:message], **opts)
|
RateLimitError.new(message, **opts)
|
||||||
else
|
else
|
||||||
APIError.new(error_data[:message], **opts)
|
APIError.new(message, **opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -849,16 +873,20 @@ module Stripe
|
|||||||
message + "\n\n(Network error: #{error.message})"
|
message + "\n\n(Network error: #{error.message})"
|
||||||
end
|
end
|
||||||
|
|
||||||
private def request_headers(api_key, method)
|
private def request_headers(api_key, method, api_mode)
|
||||||
user_agent = "Stripe/v1 RubyBindings/#{Stripe::VERSION}"
|
user_agent = "Stripe/v1 RubyBindings/#{Stripe::VERSION}"
|
||||||
user_agent += " " + format_app_info(Stripe.app_info) unless Stripe.app_info.nil?
|
user_agent += " " + format_app_info(Stripe.app_info) unless Stripe.app_info.nil?
|
||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
"User-Agent" => user_agent,
|
"User-Agent" => user_agent,
|
||||||
"Authorization" => "Bearer #{api_key}",
|
"Authorization" => "Bearer #{api_key}",
|
||||||
"Content-Type" => "application/x-www-form-urlencoded",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if api_mode != :preview
|
||||||
|
# TODO: (major) don't set Content-Type if method is not post
|
||||||
|
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
||||||
|
end
|
||||||
|
|
||||||
if config.enable_telemetry? && !@last_request_metrics.nil?
|
if config.enable_telemetry? && !@last_request_metrics.nil?
|
||||||
headers["X-Stripe-Client-Telemetry"] = JSON.generate(
|
headers["X-Stripe-Client-Telemetry"] = JSON.generate(
|
||||||
last_request_metrics: @last_request_metrics.payload
|
last_request_metrics: @last_request_metrics.payload
|
||||||
@ -871,7 +899,12 @@ module Stripe
|
|||||||
headers["Idempotency-Key"] ||= SecureRandom.uuid
|
headers["Idempotency-Key"] ||= SecureRandom.uuid
|
||||||
end
|
end
|
||||||
|
|
||||||
headers["Stripe-Version"] = config.api_version if config.api_version
|
if api_mode == :preview
|
||||||
|
headers["Stripe-Version"] = ApiVersion::PREVIEW
|
||||||
|
elsif config.api_version
|
||||||
|
headers["Stripe-Version"] = config.api_version
|
||||||
|
end
|
||||||
|
|
||||||
headers["Stripe-Account"] = config.stripe_account if config.stripe_account
|
headers["Stripe-Account"] = config.stripe_account if config.stripe_account
|
||||||
|
|
||||||
user_agent = @system_profiler.user_agent
|
user_agent = @system_profiler.user_agent
|
||||||
@ -954,7 +987,8 @@ module Stripe
|
|||||||
# that we can log certain information. It's useful because it means that we
|
# that we can log certain information. It's useful because it means that we
|
||||||
# don't have to pass around as many parameters.
|
# don't have to pass around as many parameters.
|
||||||
class RequestLogContext
|
class RequestLogContext
|
||||||
attr_accessor :body, :account, :api_key, :api_version, :idempotency_key, :method, :path, :query, :request_id
|
attr_accessor :body, :account, :api_key, :authenticator, :api_version, :idempotency_key, :method, :path, :query,
|
||||||
|
:request_id
|
||||||
|
|
||||||
# The idea with this method is that we might want to update some of
|
# The idea with this method is that we might want to update some of
|
||||||
# context information because a response that we've received from the API
|
# context information because a response that we've received from the API
|
||||||
|
@ -25,7 +25,7 @@ module Stripe
|
|||||||
# If `.logger` is set, the value of `.log_level` is ignored. The decision on
|
# If `.logger` is set, the value of `.log_level` is ignored. The decision on
|
||||||
# what levels to print is entirely deferred to the logger.
|
# what levels to print is entirely deferred to the logger.
|
||||||
class StripeConfiguration
|
class StripeConfiguration
|
||||||
attr_accessor :api_key, :api_version, :client_id, :enable_telemetry, :logger, :stripe_account
|
attr_accessor :api_key, :api_version, :authenticator, :client_id, :enable_telemetry, :logger, :stripe_account
|
||||||
|
|
||||||
attr_reader :api_base, :uploads_base, :connect_base, :ca_bundle_path, :log_level, :initial_network_retry_delay,
|
attr_reader :api_base, :uploads_base, :connect_base, :ca_bundle_path, :log_level, :initial_network_retry_delay,
|
||||||
# rubocop:todo Layout/LineLength
|
# rubocop:todo Layout/LineLength
|
||||||
@ -50,6 +50,7 @@ module Stripe
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@api_version = ApiVersion::CURRENT
|
@api_version = ApiVersion::CURRENT
|
||||||
|
|
||||||
@ca_bundle_path = Stripe::DEFAULT_CA_BUNDLE_PATH
|
@ca_bundle_path = Stripe::DEFAULT_CA_BUNDLE_PATH
|
||||||
@enable_telemetry = true
|
@enable_telemetry = true
|
||||||
@verify_ssl_certs = true
|
@verify_ssl_certs = true
|
||||||
|
@ -7,6 +7,7 @@ module Stripe
|
|||||||
# Options that a user is allowed to specify.
|
# Options that a user is allowed to specify.
|
||||||
OPTS_USER_SPECIFIED = Set[
|
OPTS_USER_SPECIFIED = Set[
|
||||||
:api_key,
|
:api_key,
|
||||||
|
:authenticator,
|
||||||
:idempotency_key,
|
:idempotency_key,
|
||||||
:stripe_account,
|
:stripe_account,
|
||||||
:stripe_version
|
:stripe_version
|
||||||
@ -279,7 +280,13 @@ module Stripe
|
|||||||
when String
|
when String
|
||||||
{ api_key: opts }
|
{ api_key: opts }
|
||||||
when Hash
|
when Hash
|
||||||
check_api_key!(opts.fetch(:api_key)) if opts.key?(:api_key)
|
# If the user is using request signing for authentication,
|
||||||
|
# no need to check the api_key per request.
|
||||||
|
if !(opts.key?(:client) &&
|
||||||
|
opts.fetch(:client).config.authenticator) &&
|
||||||
|
opts.key?(:api_key)
|
||||||
|
check_api_key!(opts.fetch(:api_key))
|
||||||
|
end
|
||||||
# Explicitly use dup here instead of clone to avoid preserving freeze
|
# Explicitly use dup here instead of clone to avoid preserving freeze
|
||||||
# state on input params.
|
# state on input params.
|
||||||
opts.dup
|
opts.dup
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Stripe
|
module Stripe
|
||||||
VERSION = "10.5.0"
|
VERSION = "10.6.0-beta.1"
|
||||||
end
|
end
|
||||||
|
@ -80,6 +80,19 @@ module Stripe
|
|||||||
|
|
||||||
should "not specifying api credentials should raise an exception" do
|
should "not specifying api credentials should raise an exception" do
|
||||||
Stripe.api_key = nil
|
Stripe.api_key = nil
|
||||||
|
Stripe.authenticator = nil
|
||||||
|
assert_raises Stripe::AuthenticationError do
|
||||||
|
Stripe::Customer.new("cus_123").refresh
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "specifying both api_key and authenticator should raise an exception" do
|
||||||
|
Stripe.api_key = "sk_123"
|
||||||
|
|
||||||
|
def no_op; end
|
||||||
|
|
||||||
|
Stripe.authenticator = method(:no_op)
|
||||||
|
|
||||||
assert_raises Stripe::AuthenticationError do
|
assert_raises Stripe::AuthenticationError do
|
||||||
Stripe::Customer.new("cus_123").refresh
|
Stripe::Customer.new("cus_123").refresh
|
||||||
end
|
end
|
||||||
|
@ -1232,6 +1232,10 @@ module Stripe
|
|||||||
Stripe::Quote.update("qt_xxxxxxxxxxxxx", { metadata: { order_id: "6735" } })
|
Stripe::Quote.update("qt_xxxxxxxxxxxxx", { metadata: { order_id: "6735" } })
|
||||||
assert_requested :post, "#{Stripe.api_base}/v1/quotes/qt_xxxxxxxxxxxxx"
|
assert_requested :post, "#{Stripe.api_base}/v1/quotes/qt_xxxxxxxxxxxxx"
|
||||||
end
|
end
|
||||||
|
should "Test quotes preview invoices lines get" do
|
||||||
|
Stripe::Quote.list_preview_invoice_lines("qt_xyz", "in_xyz")
|
||||||
|
assert_requested :get, "#{Stripe.api_base}/v1/quotes/qt_xyz/preview_invoices/in_xyz/lines?"
|
||||||
|
end
|
||||||
should "Test radar early fraud warnings get" do
|
should "Test radar early fraud warnings get" do
|
||||||
Stripe::Radar::EarlyFraudWarning.list({ limit: 3 })
|
Stripe::Radar::EarlyFraudWarning.list({ limit: 3 })
|
||||||
assert_requested :get, "#{Stripe.api_base}/v1/radar/early_fraud_warnings?limit=3"
|
assert_requested :get, "#{Stripe.api_base}/v1/radar/early_fraud_warnings?limit=3"
|
||||||
@ -1565,6 +1569,11 @@ module Stripe
|
|||||||
Stripe::TaxCode.retrieve("txcd_xxxxxxxxxxxxx")
|
Stripe::TaxCode.retrieve("txcd_xxxxxxxxxxxxx")
|
||||||
assert_requested :get, "#{Stripe.api_base}/v1/tax_codes/txcd_xxxxxxxxxxxxx?"
|
assert_requested :get, "#{Stripe.api_base}/v1/tax_codes/txcd_xxxxxxxxxxxxx?"
|
||||||
end
|
end
|
||||||
|
should "Test tax forms pdf get" do
|
||||||
|
block_handler = {}
|
||||||
|
Stripe::Tax::Form.pdf("form_xxxxxxxxxxxxx", &block_handler)
|
||||||
|
assert_requested :get, "#{Stripe.api_base}/v1/tax/forms/form_xxxxxxxxxxxxx/pdf?"
|
||||||
|
end
|
||||||
should "Test tax rates get" do
|
should "Test tax rates get" do
|
||||||
Stripe::TaxRate.list({ limit: 3 })
|
Stripe::TaxRate.list({ limit: 3 })
|
||||||
assert_requested :get, "#{Stripe.api_base}/v1/tax_rates?limit=3"
|
assert_requested :get, "#{Stripe.api_base}/v1/tax_rates?limit=3"
|
||||||
|
84
test/stripe/preview_test.rb
Normal file
84
test/stripe/preview_test.rb
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require File.expand_path("../test_helper", __dir__)
|
||||||
|
|
||||||
|
class PreviewTest < Test::Unit::TestCase
|
||||||
|
context "preview raw requests" do
|
||||||
|
should "send preview get request with correct default options" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:get, "#{Stripe.api_base}/v2/accounts/acc_123")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe::Preview.get("/v2/accounts/acc_123")
|
||||||
|
|
||||||
|
assert_equal nil, req.headers["Content-Type"]
|
||||||
|
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
end
|
||||||
|
|
||||||
|
should "send preview post request with correct default options" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:post, "#{Stripe.api_base}/v2/accounts")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe::Preview.post("/v2/accounts", { p1: 1, p2: "string" })
|
||||||
|
|
||||||
|
assert_equal "application/json", req.headers["Content-Type"]
|
||||||
|
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
|
||||||
|
assert_equal "{\"p1\":1,\"p2\":\"string\"}", req.body
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
end
|
||||||
|
|
||||||
|
should "send preview delete request with correct default options" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:delete, "#{Stripe.api_base}/v2/accounts/acc_123")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe::Preview.delete("/v2/accounts/acc_123")
|
||||||
|
|
||||||
|
assert_equal nil, req.headers["Content-Type"]
|
||||||
|
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
end
|
||||||
|
|
||||||
|
should "allow overriding default options for preview requests" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
stripe_version_override = "2022-11-15"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:post, "#{Stripe.api_base}/v2/accounts")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe::Preview.post("/v2/accounts", {}, { stripe_version: stripe_version_override })
|
||||||
|
|
||||||
|
assert_equal "application/json", req.headers["Content-Type"]
|
||||||
|
assert_equal stripe_version_override, req.headers["Stripe-Version"]
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
end
|
||||||
|
|
||||||
|
should "allow setting stripe_context for preview requests" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
stripe_context = "acc_123"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:post, "#{Stripe.api_base}/v2/accounts")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
Stripe::Preview.post("/v2/accounts", {}, { stripe_context: stripe_context })
|
||||||
|
|
||||||
|
assert_equal "application/json", req.headers["Content-Type"]
|
||||||
|
assert_equal stripe_context, req.headers["Stripe-Context"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
112
test/stripe/raw_request_test.rb
Normal file
112
test/stripe/raw_request_test.rb
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require File.expand_path("../test_helper", __dir__)
|
||||||
|
|
||||||
|
class RawRequestTest < Test::Unit::TestCase
|
||||||
|
context "raw_request" do
|
||||||
|
should "send get request and return a response" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:get, "#{Stripe.api_base}/v1/accounts/acc_123")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe.raw_request(:get, "/v1/accounts/acc_123")
|
||||||
|
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
assert_equal "application/x-www-form-urlencoded", req.headers["Content-Type"]
|
||||||
|
assert_equal Stripe::ApiVersion::CURRENT, req.headers["Stripe-Version"]
|
||||||
|
end
|
||||||
|
|
||||||
|
should "send post request with body and return a response" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:post, "#{Stripe.api_base}/v1/accounts/acc_123")
|
||||||
|
.with(body: "p1=1&p2=string")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe.raw_request(:post, "/v1/accounts/acc_123", { p1: 1, p2: "string" })
|
||||||
|
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
assert_equal "application/x-www-form-urlencoded", req.headers["Content-Type"]
|
||||||
|
assert_equal Stripe::ApiVersion::CURRENT, req.headers["Stripe-Version"]
|
||||||
|
end
|
||||||
|
|
||||||
|
should "send post request with json body and return a response" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:post, "#{Stripe.api_base}/v1/accounts/acc_123")
|
||||||
|
.with(body: "{\"p1\":1,\"p2\":\"string\"}")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe.raw_request(:post, "/v1/accounts/acc_123", { p1: 1, p2: "string" }, { api_mode: :preview })
|
||||||
|
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
assert_equal "application/json", req.headers["Content-Type"]
|
||||||
|
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
|
||||||
|
end
|
||||||
|
|
||||||
|
should "send post request with json body and headers and return a response" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:post, "#{Stripe.api_base}/v1/accounts/acc_123")
|
||||||
|
.with(body: "{\"p1\":1,\"p2\":\"string\"}")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe.raw_request(:post, "/v1/accounts/acc_123", { p1: 1, p2: "string" }, { api_mode: :preview, "Stripe-Context": "bar" })
|
||||||
|
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
assert_equal "application/json", req.headers["Content-Type"]
|
||||||
|
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
|
||||||
|
assert_equal "bar", req.headers["Stripe-Context"]
|
||||||
|
end
|
||||||
|
|
||||||
|
should "send get request with json body and headers and return a response" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:get, "#{Stripe.api_base}/v1/accounts/acc_123")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
resp = Stripe.raw_request(:get, "/v1/accounts/acc_123", {}, { api_mode: :preview, "Stripe-Account": "bar" })
|
||||||
|
|
||||||
|
assert_not_equal "application/x-www-form-urlencoded", req.headers["Content-Type"]
|
||||||
|
assert_equal expected_body, resp.http_body
|
||||||
|
end
|
||||||
|
|
||||||
|
should "set default preview version when api_mode is preview and stripe_version not specified" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:get, "#{Stripe.api_base}/v1/accounts/acc_123")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
Stripe.raw_request(:get, "/v1/accounts/acc_123", {}, { api_mode: :preview })
|
||||||
|
|
||||||
|
assert_equal Stripe::ApiVersion::PREVIEW, req.headers["Stripe-Version"]
|
||||||
|
end
|
||||||
|
|
||||||
|
should "allow overriding stripe version when api_mode is preview" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\"}"
|
||||||
|
req = nil
|
||||||
|
|
||||||
|
stub_request(:get, "#{Stripe.api_base}/v1/accounts/acc_123")
|
||||||
|
.with { |request| req = request }
|
||||||
|
.to_return(body: expected_body)
|
||||||
|
|
||||||
|
stripe_version_override = "2023-05-15.preview"
|
||||||
|
Stripe.raw_request(:get, "/v1/accounts/acc_123", {}, { api_mode: :preview, stripe_version: stripe_version_override })
|
||||||
|
|
||||||
|
assert_equal stripe_version_override, req.headers["Stripe-Version"]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
112
test/stripe/request_signing_authenticator_test.rb
Normal file
112
test/stripe/request_signing_authenticator_test.rb
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require File.expand_path("../test_helper", __dir__)
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class RequestSigningAuthenticatorTest < Test::Unit::TestCase
|
||||||
|
TEST_AUTH_TOKEN = "keyid"
|
||||||
|
TEST_SIGN_LAMBDA = -> {}
|
||||||
|
|
||||||
|
context "initialize" do
|
||||||
|
should "raise error if given non-String auth token" do
|
||||||
|
assert_raises ArgumentError do
|
||||||
|
Stripe::RequestSigningAuthenticator.new(123, TEST_SIGN_LAMBDA)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "raise error if given non-lambda sign function" do
|
||||||
|
assert_raises ArgumentError do
|
||||||
|
Stripe::RequestSigningAuthenticator.new(TEST_AUTH_TOKEN, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "create a new authenticator with valid arguments" do
|
||||||
|
authenticator = Stripe::RequestSigningAuthenticator.new(TEST_AUTH_TOKEN, TEST_SIGN_LAMBDA)
|
||||||
|
assert_equal(authenticator.auth_token, TEST_AUTH_TOKEN)
|
||||||
|
assert_equal(authenticator.sign_lambda, TEST_SIGN_LAMBDA)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context ".authenticate" do
|
||||||
|
setup do
|
||||||
|
RequestSigningAuthenticator.any_instance.stubs(:created_time).returns(123_456_789)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "applies signature for POST requests" do
|
||||||
|
signature_bases = []
|
||||||
|
sign = lambda { |signature_base|
|
||||||
|
signature_bases.push(signature_base)
|
||||||
|
return [1, 2, 3, 4, 5].pack("C*")
|
||||||
|
}
|
||||||
|
|
||||||
|
authenticator = RequestSigningAuthenticator.new(TEST_AUTH_TOKEN, sign)
|
||||||
|
headers = { "Content-Type" => "application/json" }
|
||||||
|
authenticator.authenticate(:post, headers, '{"string":"String!"}')
|
||||||
|
|
||||||
|
assert_equal("\"content-type\": application/json\n" \
|
||||||
|
"\"content-digest\": sha-256=:HA3i38j+04ac71IzPtG1JK8o4q9sPK0fYPmJHmci5bg=:\n" \
|
||||||
|
"\"stripe-context\": \n" \
|
||||||
|
"\"stripe-account\": \n" \
|
||||||
|
"\"authorization\": STRIPE-V2-SIG keyid\n" \
|
||||||
|
"\"@signature-params\": (\"content-type\" \"content-digest\" \"stripe-context\" \"stripe-account\" \"authorization\");created=123456789",
|
||||||
|
signature_bases[0].force_encoding(Encoding::UTF_8))
|
||||||
|
|
||||||
|
assert_equal('sig1=("content-type" "content-digest" "stripe-context" "stripe-account" "authorization");' \
|
||||||
|
"created=123456789", headers["Signature-Input"])
|
||||||
|
assert_equal("sha-256=:HA3i38j+04ac71IzPtG1JK8o4q9sPK0fYPmJHmci5bg=:", headers["Content-Digest"])
|
||||||
|
assert_equal("sig1=:AQIDBAU=:", headers["Signature"])
|
||||||
|
assert_equal("STRIPE-V2-SIG keyid", headers["Authorization"])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "applies signature for DELETE requests" do
|
||||||
|
signature_bases = []
|
||||||
|
sign = lambda { |signature_base|
|
||||||
|
signature_bases.push(signature_base)
|
||||||
|
return [1, 2, 3, 4, 5].pack("C*")
|
||||||
|
}
|
||||||
|
|
||||||
|
authenticator = RequestSigningAuthenticator.new(TEST_AUTH_TOKEN, sign)
|
||||||
|
headers = { "Content-Type" => "application/json" }
|
||||||
|
authenticator.authenticate(:delete, headers, nil)
|
||||||
|
|
||||||
|
assert_equal("\"content-type\": application/json\n" \
|
||||||
|
"\"content-digest\": sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\n" \
|
||||||
|
"\"stripe-context\": \n" \
|
||||||
|
"\"stripe-account\": \n" \
|
||||||
|
"\"authorization\": STRIPE-V2-SIG keyid\n" \
|
||||||
|
"\"@signature-params\": (\"content-type\" \"content-digest\" \"stripe-context\" \"stripe-account\" \"authorization\");created=123456789",
|
||||||
|
signature_bases[0].force_encoding(Encoding::UTF_8))
|
||||||
|
|
||||||
|
assert_equal('sig1=("content-type" "content-digest" "stripe-context" "stripe-account" "authorization");' \
|
||||||
|
"created=123456789", headers["Signature-Input"])
|
||||||
|
assert_equal("sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:", headers["Content-Digest"])
|
||||||
|
assert_equal("sig1=:AQIDBAU=:", headers["Signature"])
|
||||||
|
assert_equal("STRIPE-V2-SIG keyid", headers["Authorization"])
|
||||||
|
end
|
||||||
|
|
||||||
|
should "applies signature for GET requests" do
|
||||||
|
signature_bases = []
|
||||||
|
sign = lambda { |signature_base|
|
||||||
|
signature_bases.push(signature_base)
|
||||||
|
return [1, 2, 3, 4, 5].pack("C*")
|
||||||
|
}
|
||||||
|
|
||||||
|
authenticator = RequestSigningAuthenticator.new(TEST_AUTH_TOKEN, sign)
|
||||||
|
headers = {}
|
||||||
|
authenticator.authenticate(:get, headers, nil)
|
||||||
|
|
||||||
|
assert_equal("\"stripe-context\": \n" \
|
||||||
|
"\"stripe-account\": \n" \
|
||||||
|
"\"authorization\": STRIPE-V2-SIG keyid\n" \
|
||||||
|
"\"@signature-params\": (\"stripe-context\" \"stripe-account\" \"authorization\");created=123456789",
|
||||||
|
signature_bases[0].force_encoding(Encoding::UTF_8))
|
||||||
|
|
||||||
|
assert_equal('sig1=("stripe-context" "stripe-account" "authorization");' \
|
||||||
|
"created=123456789", headers["Signature-Input"])
|
||||||
|
assert_nil(headers["Content-Digest"])
|
||||||
|
assert_equal("sig1=:AQIDBAU=:", headers["Signature"])
|
||||||
|
assert_equal("STRIPE-V2-SIG keyid", headers["Authorization"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -476,6 +476,55 @@ module Stripe
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "signing headers" do
|
||||||
|
setup do
|
||||||
|
RequestSigningAuthenticator.any_instance.stubs(:content_digest).returns("digest")
|
||||||
|
RequestSigningAuthenticator.any_instance.stubs(:created_time).returns(1_234_567_890)
|
||||||
|
RequestSigningAuthenticator.any_instance.stubs(:encoded_signature).returns("signature")
|
||||||
|
|
||||||
|
Stripe.api_key = nil
|
||||||
|
Stripe.authenticator = RequestSigningAuthenticator.new("keyinfo_test_123", -> {})
|
||||||
|
end
|
||||||
|
|
||||||
|
should "apply valid signing headers for get requests" do
|
||||||
|
stub_request(:get, "#{Stripe.api_base}/v1/charges/ch_123")
|
||||||
|
.to_return(body: JSON.generate(object: "charge"))
|
||||||
|
|
||||||
|
client = StripeClient.new
|
||||||
|
client.send(request_method, :get, "/v1/charges/ch_123",
|
||||||
|
&@read_body_chunk_block)
|
||||||
|
assert_requested(
|
||||||
|
:get,
|
||||||
|
"#{Stripe.api_base}/v1/charges/ch_123",
|
||||||
|
headers: {
|
||||||
|
"Authorization" => "STRIPE-V2-SIG keyinfo_test_123",
|
||||||
|
"Signature" => "sig1=:signature:",
|
||||||
|
"Signature-Input" => 'sig1=("stripe-context" "stripe-account" "authorization");created=1234567890',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "apply valid signing headers for post requests" do
|
||||||
|
stub_request(:post, "#{Stripe.api_base}/v1/charges")
|
||||||
|
.to_return(body: JSON.generate(object: "charge"))
|
||||||
|
|
||||||
|
client = StripeClient.new
|
||||||
|
client.send(request_method, :post, "/v1/charges",
|
||||||
|
&@read_body_chunk_block)
|
||||||
|
|
||||||
|
assert_requested(
|
||||||
|
:post,
|
||||||
|
"#{Stripe.api_base}/v1/charges",
|
||||||
|
headers: {
|
||||||
|
"Authorization" => "STRIPE-V2-SIG keyinfo_test_123",
|
||||||
|
"Content-Digest" => "sha-256=:digest:",
|
||||||
|
"Signature" => "sig1=:signature:",
|
||||||
|
"Signature-Input" => 'sig1=("content-type" "content-digest" "stripe-context" "stripe-account" "authorization");created=1234567890',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "logging" do
|
context "logging" do
|
||||||
setup do
|
setup do
|
||||||
# Freeze time for the purposes of the `elapsed` parameter that we
|
# Freeze time for the purposes of the `elapsed` parameter that we
|
||||||
|
@ -134,4 +134,42 @@ class StripeTest < Test::Unit::TestCase
|
|||||||
assert_equal "client", Stripe.client_id
|
assert_equal "client", Stripe.client_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "deserialize" do
|
||||||
|
should "deserializes string into known object" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\", \"object\": \"account\"}"
|
||||||
|
|
||||||
|
obj = Stripe.deserialize(expected_body)
|
||||||
|
|
||||||
|
assert_equal obj.class, Stripe::Account
|
||||||
|
assert_equal obj.id, "acc_123"
|
||||||
|
end
|
||||||
|
|
||||||
|
should "deserializes string into unknown object" do
|
||||||
|
expected_body = "{\"id\": \"acc_123\", \"object\": \"unknown\"}"
|
||||||
|
|
||||||
|
obj = Stripe.deserialize(expected_body)
|
||||||
|
|
||||||
|
assert_equal obj.class, Stripe::StripeObject
|
||||||
|
assert_equal obj.id, "acc_123"
|
||||||
|
end
|
||||||
|
|
||||||
|
should "deserializes hash into known object" do
|
||||||
|
expected_body = { "id" => "acc_123", "object" => "account" }
|
||||||
|
|
||||||
|
obj = Stripe.deserialize(expected_body)
|
||||||
|
|
||||||
|
assert_equal obj.class, Stripe::Account
|
||||||
|
assert_equal obj.id, "acc_123"
|
||||||
|
end
|
||||||
|
|
||||||
|
should "deserializes hash into unknown object" do
|
||||||
|
expected_body = { "id" => "acc_123", "object" => "unknown" }
|
||||||
|
|
||||||
|
obj = Stripe.deserialize(expected_body)
|
||||||
|
|
||||||
|
assert_equal obj.class, Stripe::StripeObject
|
||||||
|
assert_equal obj.id, "acc_123"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -67,6 +67,8 @@ module Test
|
|||||||
Stripe.api_base = "http://localhost:#{MOCK_PORT}"
|
Stripe.api_base = "http://localhost:#{MOCK_PORT}"
|
||||||
Stripe.uploads_base = "http://localhost:#{MOCK_PORT}"
|
Stripe.uploads_base = "http://localhost:#{MOCK_PORT}"
|
||||||
|
|
||||||
|
Stripe.authenticator = nil
|
||||||
|
|
||||||
stub_connect
|
stub_connect
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user