mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-06-23 00:00:29 -04:00
Compare commits
480 Commits
master
...
v13.1.0-be
Author | SHA1 | Date | |
---|---|---|---|
|
5e3db6ff02 | ||
|
41f5d0a594 | ||
|
be974ad4a2 | ||
|
d28d37fe3e | ||
|
910162ef12 | ||
|
6a1332d803 | ||
|
8b34c0f101 | ||
|
9cc7023598 | ||
|
79daac7bcf | ||
|
b1dc11f8c0 | ||
|
1d21518d1f | ||
|
2a6f80ab14 | ||
|
7616bf9e25 | ||
|
bee43846c7 | ||
|
c9d24fd3ed | ||
|
e0f699be5d | ||
|
d1d589ddde | ||
|
961c39195d | ||
|
b4f0f7a47a | ||
|
7ea397e89a | ||
|
9c4b2ba949 | ||
|
174a13d131 | ||
|
fa6fe2c58e | ||
|
731bf9f3ac | ||
|
ae6f89d29a | ||
|
bef2a670dd | ||
|
3a3f21eb6e | ||
|
1d25994ec2 | ||
|
36d12fd7a4 | ||
|
da3439f464 | ||
|
87190ffac5 | ||
|
10babebbf6 | ||
|
6e65602f6e | ||
|
1e6e4c2c84 | ||
|
f4ced072fd | ||
|
006dd567fc | ||
|
4151971cc2 | ||
|
787d71ed67 | ||
|
f9cf82d23f | ||
|
83404d14f9 | ||
|
7b693ab18c | ||
|
dbed1a3a59 | ||
|
28f0ff6120 | ||
|
d402193c93 | ||
|
4427ba0f2a | ||
|
f8aa5a4fa6 | ||
|
8be3c30e4a | ||
|
8ee88fefc7 | ||
|
b3a7a47917 | ||
|
4659c14672 | ||
|
3e340c4153 | ||
|
0229ed0e95 | ||
|
1e5edb7386 | ||
|
478d6888aa | ||
|
349acd2adf | ||
|
3871745743 | ||
|
59c82e3d4b | ||
|
6a4d2d1570 | ||
|
5669ab4d5c | ||
|
78e3166e20 | ||
|
318bed2067 | ||
|
0c44569639 | ||
|
65c85f45b3 | ||
|
f858c6a959 | ||
|
1fadafb39c | ||
|
4ce9e74bf5 | ||
|
b7d691bafd | ||
|
ee9ea1595a | ||
|
a802c007b2 | ||
|
d8701e8749 | ||
|
c83c27da74 | ||
|
fa02db50ab | ||
|
663d1460ef | ||
|
9716565a2d | ||
|
99c81c7074 | ||
|
16c779cdea | ||
|
f832bff64a | ||
|
d9f19ec10f | ||
|
20ae76545b | ||
|
59863ea3aa | ||
|
a49aa2d18c | ||
|
61aba5d027 | ||
|
3d2ad3d61c | ||
|
ab7d3a61d1 | ||
|
e5ec8c1ebf | ||
|
8558e0ee2e | ||
|
8c3b51769f | ||
|
4c4485185c | ||
|
df7f3fad50 | ||
|
b9597e5eac | ||
|
83463f167e | ||
|
abcc296f24 | ||
|
7eea258347 | ||
|
b66f178666 | ||
|
4ffefec536 | ||
|
7f957926c0 | ||
|
9f5e950493 | ||
|
c4f115226f | ||
|
c9c0acf980 | ||
|
3822030694 | ||
|
287b1fab65 | ||
|
6a0feb8f7d | ||
|
3f60df3581 | ||
|
c2f09bc395 | ||
|
626b576a34 | ||
|
27987ef78e | ||
|
4888991c70 | ||
|
4f0f1ee5f9 | ||
|
f825a94c1c | ||
|
9bfea77b37 | ||
|
929b50a836 | ||
|
e14fff4431 | ||
|
bc3e460aae | ||
|
3ed806c90b | ||
|
c4dd22825e | ||
|
b594bd5c21 | ||
|
7ddec7d6d8 | ||
|
f6a388be06 | ||
|
a8aac472ec | ||
|
0b3c0f3244 | ||
|
cece539ed7 | ||
|
22693301eb | ||
|
c36c240108 | ||
|
ec694bbd05 | ||
|
56039702e9 | ||
|
5edc3708fc | ||
|
0d0cead582 | ||
|
b7a9871e6a | ||
|
e511e2fb8b | ||
|
e37031ef1f | ||
|
d699593ea5 | ||
|
4632b7c9da | ||
|
418d79de1b | ||
|
b1e351f235 | ||
|
2c260289f2 | ||
|
d249b5f78b | ||
|
816f8ad435 | ||
|
02a733676e | ||
|
0e96318130 | ||
|
2e0b17a3dc | ||
|
8c91e40f29 | ||
|
4617b3fbd1 | ||
|
da70f0cfc8 | ||
|
a00f541a93 | ||
|
cbe61d7d38 | ||
|
3fe63202e3 | ||
|
3921d9b812 | ||
|
b39af8a58b | ||
|
6e62bca84a | ||
|
a7d998ab2d | ||
|
479d17b26a | ||
|
1bcb4bc058 | ||
|
b399f87064 | ||
|
a1ce673f62 | ||
|
4ccbe90069 | ||
|
5da74143e8 | ||
|
41ba199775 | ||
|
6897561e00 | ||
|
33e217ba15 | ||
|
dfa7994d04 | ||
|
34ff3ed2ca | ||
|
fe66019c7d | ||
|
f84e1154b1 | ||
|
afa13a53b0 | ||
|
a1deb162d0 | ||
|
499d0605d0 | ||
|
1705995709 | ||
|
452f8ca43d | ||
|
4902b4c49d | ||
|
ad26ff3fca | ||
|
86ac5fd329 | ||
|
ee9b5c7ead | ||
|
083c3a104e | ||
|
354b6a92a3 | ||
|
c48a5e30cf | ||
|
71b8f84574 | ||
|
d353c130bc | ||
|
8bda0900f3 | ||
|
3cecb75d46 | ||
|
18fef16be2 | ||
|
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 |
26
.rubocop.yml
26
.rubocop.yml
@ -16,9 +16,14 @@ Layout/FirstHashElementIndentation:
|
|||||||
Layout/LineLength:
|
Layout/LineLength:
|
||||||
Exclude:
|
Exclude:
|
||||||
- "lib/stripe/object_types.rb"
|
- "lib/stripe/object_types.rb"
|
||||||
|
- "lib/stripe/stripe_client.rb"
|
||||||
- "lib/stripe/resources/**/*.rb"
|
- "lib/stripe/resources/**/*.rb"
|
||||||
|
- "lib/stripe/services/**/*.rb"
|
||||||
- "test/**/*.rb"
|
- "test/**/*.rb"
|
||||||
|
|
||||||
|
Metrics/AbcSize:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Metrics/BlockLength:
|
Metrics/BlockLength:
|
||||||
Max: 40
|
Max: 40
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -29,11 +34,25 @@ Metrics/BlockLength:
|
|||||||
Metrics/ClassLength:
|
Metrics/ClassLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
# There are several methods with many branches in api_requestor due to
|
||||||
|
# request logic.
|
||||||
|
Metrics/CyclomaticComplexity:
|
||||||
|
Exclude:
|
||||||
|
- "lib/stripe/api_requestor.rb"
|
||||||
|
- "lib/stripe/util.rb"
|
||||||
|
|
||||||
|
Metrics/PerceivedComplexity:
|
||||||
|
Exclude:
|
||||||
|
- "lib/stripe/api_requestor.rb"
|
||||||
|
- "lib/stripe/util.rb"
|
||||||
|
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
# There's ~2 long methods in `StripeClient` and one in `NestedResource`. If
|
# There's ~2 long methods in `APIRequestor` and one in `NestedResource`. If
|
||||||
# we want to truncate those a little, we could move this to be closer to ~30
|
# we want to truncate those a little, we could move this to be closer to ~30
|
||||||
# (but the default of 10 is probably too short).
|
# (but the default of 10 is probably too short).
|
||||||
Max: 55
|
Max: 55
|
||||||
|
Exclude:
|
||||||
|
- "lib/stripe/services/v1_services.rb"
|
||||||
|
|
||||||
Metrics/ModuleLength:
|
Metrics/ModuleLength:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
@ -41,6 +60,11 @@ Metrics/ModuleLength:
|
|||||||
Metrics/ParameterLists:
|
Metrics/ParameterLists:
|
||||||
# There's 2 methods in `StripeClient` that have long parameter lists.
|
# There's 2 methods in `StripeClient` that have long parameter lists.
|
||||||
Max: 8
|
Max: 8
|
||||||
|
# Optional parameters should be consistent across libraries, we need not be
|
||||||
|
# concerned about this. Was introduced with adding `base_address`
|
||||||
|
Exclude:
|
||||||
|
- "lib/stripe/api_operations/request.rb"
|
||||||
|
- "lib/stripe/stripe_object.rb"
|
||||||
|
|
||||||
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
|
||||||
@ -9,17 +9,17 @@
|
|||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
Lint/HashCompareByIdentity:
|
Lint/HashCompareByIdentity:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/stripe/stripe_client.rb'
|
- 'lib/stripe/api_requestor.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).
|
||||||
@ -47,9 +42,9 @@ Style/CaseLikeIf:
|
|||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
Style/CombinableLoops:
|
Style/CombinableLoops:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/stripe/stripe_client.rb'
|
- 'lib/stripe/api_requestor.rb'
|
||||||
|
|
||||||
# Offense count: 39
|
# Offense count: 44
|
||||||
# Configuration parameters: AllowedConstants.
|
# Configuration parameters: AllowedConstants.
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
@ -59,7 +54,7 @@ Style/Documentation:
|
|||||||
# Configuration parameters: AllowSplatArgument.
|
# Configuration parameters: AllowSplatArgument.
|
||||||
Style/HashConversion:
|
Style/HashConversion:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/stripe/stripe_client.rb'
|
- 'lib/stripe/api_requestor.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
@ -81,7 +76,7 @@ Style/StringConcatenation:
|
|||||||
- 'lib/stripe/oauth.rb'
|
- 'lib/stripe/oauth.rb'
|
||||||
- 'lib/stripe/resources/bank_account.rb'
|
- 'lib/stripe/resources/bank_account.rb'
|
||||||
- 'lib/stripe/resources/source.rb'
|
- 'lib/stripe/resources/source.rb'
|
||||||
- 'lib/stripe/stripe_client.rb'
|
- 'lib/stripe/api_requestor.rb'
|
||||||
- 'test/stripe/api_resource_test.rb'
|
- 'test/stripe/api_resource_test.rb'
|
||||||
- 'test/stripe/stripe_client_test.rb'
|
- 'test/stripe/stripe_client_test.rb'
|
||||||
- 'test/stripe/webhook_test.rb'
|
- 'test/stripe/webhook_test.rb'
|
||||||
|
2094
CHANGELOG.md
2094
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
|||||||
v1255
|
v1268
|
||||||
|
@ -346,13 +346,14 @@ If you:
|
|||||||
- prefer to bypass the method definitions in the library and specify your request details directly,
|
- prefer to bypass the method definitions in the library and specify your request details directly,
|
||||||
- used the method `Stripe::APIResource.request(...)` to specify your own requests, which will soon be broken
|
- used the method `Stripe::APIResource.request(...)` to specify your own requests, which will soon be broken
|
||||||
|
|
||||||
you can now use the `raw_request` method on `Stripe`.
|
you can now use the `raw_request` method on `StripeClient`.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
resp = Stripe.raw_request(:post, "/v1/beta_endpoint", {param: 123}, {stripe_version: "2022-11-15; feature_beta=v3"})
|
client = Stripe::StripeClient.new(...)
|
||||||
|
resp = client.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.
|
# (Optional) resp is a StripeResponse. You can use `Stripe.deserialize` to get a StripeObject.
|
||||||
deserialized_resp = Stripe.deserialize(resp.http_body)
|
deserialized_resp = client.deserialize(resp.http_body)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
11
examples/README.md
Normal file
11
examples/README.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
## Running an example
|
||||||
|
|
||||||
|
From the examples folder, run:
|
||||||
|
`RUBYLIB=../lib ruby your_example.rb`
|
||||||
|
|
||||||
|
## Adding a new example
|
||||||
|
|
||||||
|
1. Clone new_example.rb
|
||||||
|
2. Implement your example
|
||||||
|
3. Run it (as per above)
|
||||||
|
4. 👍
|
47
examples/meter_event_stream.rb
Normal file
47
examples/meter_event_stream.rb
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "stripe"
|
||||||
|
require "date"
|
||||||
|
|
||||||
|
class MeterEventManager
|
||||||
|
attr_accessor :api_key, :meter_event_session
|
||||||
|
|
||||||
|
def initialize(api_key)
|
||||||
|
@api_key = api_key
|
||||||
|
@meter_event_session = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def refresh_meter_event_session
|
||||||
|
return unless @meter_event_session.nil? || DateTime.parse(@meter_event_session.expires_at) <= DateTime.now
|
||||||
|
|
||||||
|
# Create a new meter event session in case the existing session expired
|
||||||
|
client = Stripe::StripeClient.new(api_key)
|
||||||
|
@meter_event_session = client.v2.billing.meter_event_session.create
|
||||||
|
end
|
||||||
|
|
||||||
|
def send_meter_event(meter_event)
|
||||||
|
# Refresh the meter event session if necessary
|
||||||
|
refresh_meter_event_session
|
||||||
|
|
||||||
|
# Create a meter event with the current session's authentication token
|
||||||
|
client = Stripe::StripeClient.new(meter_event_session.authentication_token)
|
||||||
|
client.v2.billing.meter_event_stream.create(
|
||||||
|
events: [meter_event]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Send meter events
|
||||||
|
api_key = "{{API_KEY}}"
|
||||||
|
customer_id = "{{CUSTOMER_ID}}"
|
||||||
|
|
||||||
|
manager = MeterEventManager.new(api_key)
|
||||||
|
manager.send_meter_event(
|
||||||
|
{
|
||||||
|
event_name: "alpaca_ai_tokens",
|
||||||
|
payload: {
|
||||||
|
"stripe_customer_id" => customer_id,
|
||||||
|
"value" => "25",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
24
examples/new_example.rb
Normal file
24
examples/new_example.rb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "stripe"
|
||||||
|
require "date"
|
||||||
|
|
||||||
|
class NewExample
|
||||||
|
attr_accessor :api_key
|
||||||
|
|
||||||
|
def initialize(api_key)
|
||||||
|
@api_key = api_key
|
||||||
|
end
|
||||||
|
|
||||||
|
def do_something_great
|
||||||
|
puts "Hello World"
|
||||||
|
# client = Stripe::StripeClient.new(api_key)
|
||||||
|
# client.v1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Send meter events
|
||||||
|
api_key = "{{API_KEY}}"
|
||||||
|
|
||||||
|
example = NewExample.new(api_key)
|
||||||
|
example.do_something_great
|
28
examples/stripe_webhook_handler.rb
Normal file
28
examples/stripe_webhook_handler.rb
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
# typed: false
|
||||||
|
|
||||||
|
require "stripe"
|
||||||
|
require "sinatra"
|
||||||
|
|
||||||
|
api_key = ENV.fetch("STRIPE_API_KEY", nil)
|
||||||
|
# Retrieve the webhook secret from the environment variable
|
||||||
|
webhook_secret = ENV.fetch("WEBHOOK_SECRET", nil)
|
||||||
|
|
||||||
|
client = Stripe::StripeClient.new(api_key)
|
||||||
|
|
||||||
|
post "/webhook" do
|
||||||
|
webhook_body = request.body.read
|
||||||
|
sig_header = request.env["HTTP_STRIPE_SIGNATURE"]
|
||||||
|
thin_event = client.parse_thin_event(webhook_body, sig_header, webhook_secret)
|
||||||
|
|
||||||
|
# Fetch the event data to understand the failure
|
||||||
|
event = client.v2.core.events.retrieve(thin_event.id)
|
||||||
|
if event.instance_of? Stripe::V1BillingMeterErrorReportTriggeredEvent
|
||||||
|
meter = event.fetch_related_object
|
||||||
|
meter_id = meter.id
|
||||||
|
puts "Success!", meter_id
|
||||||
|
end
|
||||||
|
|
||||||
|
# Record the failures and alert your team
|
||||||
|
status 200
|
||||||
|
end
|
@ -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"
|
||||||
@ -31,13 +32,18 @@ require "stripe/api_operations/search"
|
|||||||
# API resource support classes
|
# API resource support classes
|
||||||
require "stripe/errors"
|
require "stripe/errors"
|
||||||
require "stripe/object_types"
|
require "stripe/object_types"
|
||||||
|
require "stripe/event_types"
|
||||||
|
require "stripe/request_options"
|
||||||
require "stripe/util"
|
require "stripe/util"
|
||||||
require "stripe/connection_manager"
|
require "stripe/connection_manager"
|
||||||
require "stripe/multipart_encoder"
|
require "stripe/multipart_encoder"
|
||||||
|
require "stripe/api_requestor"
|
||||||
|
require "stripe/stripe_service"
|
||||||
require "stripe/stripe_client"
|
require "stripe/stripe_client"
|
||||||
require "stripe/stripe_object"
|
require "stripe/stripe_object"
|
||||||
require "stripe/stripe_response"
|
require "stripe/stripe_response"
|
||||||
require "stripe/list_object"
|
require "stripe/list_object"
|
||||||
|
require "stripe/v2_list_object"
|
||||||
require "stripe/search_result_object"
|
require "stripe/search_result_object"
|
||||||
require "stripe/error_object"
|
require "stripe/error_object"
|
||||||
require "stripe/api_resource"
|
require "stripe/api_resource"
|
||||||
@ -45,12 +51,16 @@ 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"
|
||||||
|
require "stripe/thin_event"
|
||||||
|
|
||||||
# Named API resources
|
# Named API resources
|
||||||
require "stripe/resources"
|
require "stripe/resources"
|
||||||
|
require "stripe/services"
|
||||||
|
|
||||||
# OAuth
|
# OAuth
|
||||||
require "stripe/oauth"
|
require "stripe/oauth"
|
||||||
|
require "stripe/services/oauth_service"
|
||||||
|
|
||||||
module Stripe
|
module Stripe
|
||||||
DEFAULT_CA_BUNDLE_PATH = __dir__ + "/data/ca-certificates.crt"
|
DEFAULT_CA_BUNDLE_PATH = __dir__ + "/data/ca-certificates.crt"
|
||||||
@ -60,6 +70,12 @@ module Stripe
|
|||||||
LEVEL_ERROR = Logger::ERROR
|
LEVEL_ERROR = Logger::ERROR
|
||||||
LEVEL_INFO = Logger::INFO
|
LEVEL_INFO = Logger::INFO
|
||||||
|
|
||||||
|
# API base constants
|
||||||
|
DEFAULT_API_BASE = "https://api.stripe.com"
|
||||||
|
DEFAULT_CONNECT_BASE = "https://connect.stripe.com"
|
||||||
|
DEFAULT_UPLOAD_BASE = "https://files.stripe.com"
|
||||||
|
DEFAULT_METER_EVENTS_BASE = "https://meter-events.stripe.com"
|
||||||
|
|
||||||
@app_info = nil
|
@app_info = nil
|
||||||
|
|
||||||
@config = Stripe::StripeConfiguration.setup
|
@config = Stripe::StripeConfiguration.setup
|
||||||
@ -71,11 +87,13 @@ 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=
|
||||||
def_delegators :@config, :uploads_base, :uploads_base=
|
def_delegators :@config, :uploads_base, :uploads_base=
|
||||||
def_delegators :@config, :connect_base, :connect_base=
|
def_delegators :@config, :connect_base, :connect_base=
|
||||||
|
def_delegators :@config, :meter_events_base, :meter_events_base=
|
||||||
def_delegators :@config, :open_timeout, :open_timeout=
|
def_delegators :@config, :open_timeout, :open_timeout=
|
||||||
def_delegators :@config, :read_timeout, :read_timeout=
|
def_delegators :@config, :read_timeout, :read_timeout=
|
||||||
def_delegators :@config, :write_timeout, :write_timeout=
|
def_delegators :@config, :write_timeout, :write_timeout=
|
||||||
@ -118,29 +136,46 @@ module Stripe
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
class RawRequest
|
def self.add_beta_version(beta_name, version)
|
||||||
include Stripe::APIOperations::Request
|
if api_version.include?("; #{beta_name}=")
|
||||||
|
raise "Stripe version header #{api_version} already contains entry for beta #{beta_name}"
|
||||||
|
end
|
||||||
|
|
||||||
|
self.api_version = "#{api_version}; #{beta_name}=#{version}"
|
||||||
|
end
|
||||||
|
|
||||||
|
class RawRequest
|
||||||
def initialize
|
def initialize
|
||||||
@opts = {}
|
@opts = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute(method, url, params = {}, opts = {}, usage = [])
|
def execute(method, url, base_address: :api, params: {}, opts: {}, usage: [])
|
||||||
resp, = execute_resource_request(method, url, params, opts, usage)
|
opts = Util.normalize_opts(opts)
|
||||||
|
req_opts = RequestOptions.extract_opts_from_hash(opts)
|
||||||
|
|
||||||
resp
|
requestor = APIRequestor.active_requestor
|
||||||
|
resp, = requestor.send(:execute_request_internal, method, url, base_address, params, req_opts,
|
||||||
|
usage)
|
||||||
|
|
||||||
|
requestor.interpret_response(resp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sends a request to Stripe REST API
|
# Sends a request to Stripe REST API
|
||||||
def self.raw_request(method, url, params = {}, opts = {})
|
def self.raw_request(method, url, params = {}, opts = {}, base_address: :api)
|
||||||
req = RawRequest.new
|
req = RawRequest.new
|
||||||
req.execute(method, url, params, opts, ["raw_request"])
|
req.execute(method, url, base_address: base_address, params: params, opts: opts,
|
||||||
|
usage: ["raw_request"])
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.deserialize(data)
|
def self.deserialize(data, api_mode: :v1)
|
||||||
data = JSON.parse(data) if data.is_a?(String)
|
data = JSON.parse(data) if data.is_a?(String)
|
||||||
Util.convert_to_stripe_object(data, {})
|
Util.convert_to_stripe_object(data, {}, api_mode: api_mode)
|
||||||
|
end
|
||||||
|
class << self
|
||||||
|
extend Gem::Deprecate
|
||||||
|
deprecate :raw_request, "StripeClient#raw_request", 2024, 9
|
||||||
|
deprecate :deserialize, "StripeClient#deserialize", 2024, 9
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ module Stripe
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
|
||||||
private def define_operation(
|
private def define_operation(
|
||||||
resource,
|
resource,
|
||||||
operation,
|
operation,
|
||||||
@ -54,26 +53,8 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
when :retrieve
|
when :retrieve
|
||||||
# TODO: (Major) Split params_or_opts to params and opts and get rid of the complicated way to add params
|
|
||||||
define_singleton_method(:"retrieve_#{resource}") \
|
define_singleton_method(:"retrieve_#{resource}") \
|
||||||
do |id, nested_id, params_or_opts = {}, definitely_opts = nil|
|
do |id, nested_id, params = {}, opts = {}|
|
||||||
opts = nil
|
|
||||||
params = nil
|
|
||||||
if definitely_opts.nil?
|
|
||||||
unrecognized_key = params_or_opts.keys.find { |k| !Util::OPTS_USER_SPECIFIED.include?(k) }
|
|
||||||
if unrecognized_key
|
|
||||||
raise ArgumentError,
|
|
||||||
"Unrecognized request option: #{unrecognized_key}. Did you mean to specify this as " \
|
|
||||||
"retrieve params? " \
|
|
||||||
"If so, you must explicitly pass an opts hash as a fourth argument. " \
|
|
||||||
"For example: .retrieve(#{id}, #{nested_id}, {#{unrecognized_key}: 'foo'}, {})"
|
|
||||||
end
|
|
||||||
|
|
||||||
opts = params_or_opts
|
|
||||||
else
|
|
||||||
opts = definitely_opts
|
|
||||||
params = params_or_opts
|
|
||||||
end
|
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
method: :get,
|
method: :get,
|
||||||
path: send(resource_url_method, id, nested_id),
|
path: send(resource_url_method, id, nested_id),
|
||||||
@ -115,7 +96,6 @@ module Stripe
|
|||||||
raise ArgumentError, "Unknown operation: #{operation.inspect}"
|
raise ArgumentError, "Unknown operation: #{operation.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/MethodLength
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,20 +4,21 @@ module Stripe
|
|||||||
module APIOperations
|
module APIOperations
|
||||||
module Request
|
module Request
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def execute_resource_request(method, url,
|
def execute_resource_request(method, url, base_address = :api,
|
||||||
params = {}, opts = {}, usage = [])
|
params = {}, opts = {}, usage = [])
|
||||||
execute_resource_request_internal(
|
execute_resource_request_internal(
|
||||||
:execute_request, method, url, params, opts, usage
|
:execute_request, method, url, base_address, params, opts, usage
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute_resource_request_stream(method, url,
|
def execute_resource_request_stream(method, url, base_address = :api,
|
||||||
params = {}, opts = {}, usage = [],
|
params = {}, opts = {}, usage = [],
|
||||||
&read_body_chunk_block)
|
&read_body_chunk_block)
|
||||||
execute_resource_request_internal(
|
execute_resource_request_internal(
|
||||||
:execute_request_stream,
|
:execute_request_stream,
|
||||||
method,
|
method,
|
||||||
url,
|
url,
|
||||||
|
base_address,
|
||||||
params,
|
params,
|
||||||
opts,
|
opts,
|
||||||
usage,
|
usage,
|
||||||
@ -25,13 +26,12 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
private def request_stripe_object(method:, path:, params:, opts: {}, usage: [])
|
private def request_stripe_object(method:, path:, base_address: :api, params: {}, opts: {}, usage: [])
|
||||||
resp, opts = execute_resource_request(method, path, params, opts, usage)
|
execute_resource_request(method, path, base_address, params, opts, usage)
|
||||||
Util.convert_to_stripe_object_with_params(resp.data, params, opts, resp)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private def execute_resource_request_internal(client_request_method_sym,
|
private def execute_resource_request_internal(client_request_method_sym,
|
||||||
method, url,
|
method, url, base_address,
|
||||||
params, opts, usage,
|
params, opts, usage,
|
||||||
&read_body_chunk_block)
|
&read_body_chunk_block)
|
||||||
params ||= {}
|
params ||= {}
|
||||||
@ -40,59 +40,15 @@ module Stripe
|
|||||||
warn_on_opts_in_params(params)
|
warn_on_opts_in_params(params)
|
||||||
|
|
||||||
opts = Util.normalize_opts(opts)
|
opts = Util.normalize_opts(opts)
|
||||||
error_on_non_string_user_opts(opts)
|
req_opts = RequestOptions.extract_opts_from_hash(opts)
|
||||||
|
|
||||||
opts[:client] ||= StripeClient.active_client
|
APIRequestor.active_requestor.send(
|
||||||
|
|
||||||
headers = opts.clone
|
|
||||||
api_key = headers.delete(:api_key)
|
|
||||||
api_base = headers.delete(:api_base)
|
|
||||||
client = headers.delete(:client)
|
|
||||||
# Assume all remaining opts must be headers
|
|
||||||
|
|
||||||
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,
|
base_address,
|
||||||
headers: headers, params: params, usage: usage,
|
params: params, opts: req_opts, usage: usage,
|
||||||
&read_body_chunk_block
|
&read_body_chunk_block
|
||||||
)
|
)
|
||||||
|
|
||||||
# Hash#select returns an array before 1.9
|
|
||||||
opts_to_persist = {}
|
|
||||||
opts.each do |k, v|
|
|
||||||
opts_to_persist[k] = v if Util::OPTS_PERSISTABLE.include?(k)
|
|
||||||
end
|
|
||||||
|
|
||||||
[resp, opts_to_persist]
|
|
||||||
end
|
|
||||||
|
|
||||||
# TODO: (major)
|
|
||||||
# This method used to be called `request`, but it's such a short name
|
|
||||||
# that it eventually conflicted with the name of a field on an API
|
|
||||||
# resource (specifically, `Event#request`), so it was renamed to
|
|
||||||
# something more unique.
|
|
||||||
#
|
|
||||||
# The former name had been around for just about forever though, and
|
|
||||||
# although all internal uses have been renamed, I've left this alias in
|
|
||||||
# place for backwards compatibility. Consider removing it on the next
|
|
||||||
# major.
|
|
||||||
alias request execute_resource_request
|
|
||||||
extend Gem::Deprecate
|
|
||||||
deprecate :request, "Stripe.raw_request", 2024, 7
|
|
||||||
|
|
||||||
private def error_on_non_string_user_opts(opts)
|
|
||||||
Util::OPTS_USER_SPECIFIED.each do |opt|
|
|
||||||
next unless opts.key?(opt)
|
|
||||||
|
|
||||||
val = opts[opt]
|
|
||||||
next if val.nil?
|
|
||||||
next if val.is_a?(String)
|
|
||||||
|
|
||||||
raise ArgumentError,
|
|
||||||
"request option '#{opt}' should be a string value " \
|
|
||||||
"(was a #{val.class})"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private def error_on_invalid_params(params)
|
private def error_on_invalid_params(params)
|
||||||
@ -104,7 +60,7 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
private def warn_on_opts_in_params(params)
|
private def warn_on_opts_in_params(params)
|
||||||
Util::OPTS_USER_SPECIFIED.each do |opt|
|
RequestOptions::OPTS_USER_SPECIFIED.each do |opt|
|
||||||
warn("WARNING: '#{opt}' should be in opts instead of params.") if params.key?(opt)
|
warn("WARNING: '#{opt}' should be in opts instead of params.") if params.key?(opt)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -114,30 +70,24 @@ module Stripe
|
|||||||
base.extend(ClassMethods)
|
base.extend(ClassMethods)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected def execute_resource_request(method, url,
|
protected def execute_resource_request(method, url, base_address = :api,
|
||||||
params = {}, opts = {}, usage = [])
|
params = {}, opts = {}, usage = [])
|
||||||
opts = @opts.merge(Util.normalize_opts(opts))
|
opts = @opts.merge(Util.normalize_opts(opts))
|
||||||
self.class.execute_resource_request(method, url, params, opts, usage)
|
self.class.execute_resource_request(method, url, base_address, params, opts, usage)
|
||||||
end
|
end
|
||||||
|
|
||||||
protected def execute_resource_request_stream(method, url,
|
protected def execute_resource_request_stream(method, url, base_address = :api,
|
||||||
params = {}, opts = {},
|
params = {}, opts = {}, usage = [],
|
||||||
&read_body_chunk_block)
|
&read_body_chunk_block)
|
||||||
opts = @opts.merge(Util.normalize_opts(opts))
|
opts = @opts.merge(Util.normalize_opts(opts))
|
||||||
self.class.execute_resource_request_stream(
|
self.class.execute_resource_request_stream(
|
||||||
method, url, params, opts, &read_body_chunk_block
|
method, url, base_address, params, opts, usage, &read_body_chunk_block
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
private def request_stripe_object(method:, path:, params:, opts: {}, usage: [])
|
private def request_stripe_object(method:, path:, params:, base_address: :api, opts: {}, usage: [])
|
||||||
resp, opts = execute_resource_request(method, path, params, opts, usage)
|
execute_resource_request(method, path, base_address, params, opts, usage)
|
||||||
Util.convert_to_stripe_object_with_params(resp.data, params, opts, resp)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# See notes on `alias` above.
|
|
||||||
alias request execute_resource_request
|
|
||||||
extend Gem::Deprecate
|
|
||||||
deprecate :request, "Stripe.raw_request", 2024, 7
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -65,9 +65,10 @@ module Stripe
|
|||||||
# Please note that id gets removed here our call to #url above has already
|
# Please note that id gets removed here our call to #url above has already
|
||||||
# generated a uri for this object with an identifier baked in
|
# generated a uri for this object with an identifier baked in
|
||||||
values.delete(:id)
|
values.delete(:id)
|
||||||
|
opts = Util.normalize_opts(opts)
|
||||||
resp, opts = execute_resource_request(:post, save_url, values, opts, ["save"])
|
APIRequestor.active_requestor.execute_request_initialize_from(:post, save_url, :api, self,
|
||||||
initialize_from(resp.data, opts, resp)
|
params: values, opts: opts,
|
||||||
|
usage: ["save"])
|
||||||
end
|
end
|
||||||
extend Gem::Deprecate
|
extend Gem::Deprecate
|
||||||
deprecate :save, "the `update` class method (for examples " \
|
deprecate :save, "the `update` class method (for examples " \
|
||||||
|
@ -61,8 +61,11 @@ module Stripe
|
|||||||
|
|
||||||
values = serialize_params(self).merge(params)
|
values = serialize_params(self).merge(params)
|
||||||
|
|
||||||
resp, opts = execute_resource_request(:post, resource_url, values, opts, ["save"])
|
opts = Util.normalize_opts(opts)
|
||||||
initialize_from(resp.data, opts, resp)
|
|
||||||
|
APIRequestor.active_requestor.execute_request_initialize_from(:post, resource_url, :api, self,
|
||||||
|
params: values, opts: opts,
|
||||||
|
usage: ["save"])
|
||||||
end
|
end
|
||||||
extend Gem::Deprecate
|
extend Gem::Deprecate
|
||||||
deprecate :save, "the `update` class method (for examples " \
|
deprecate :save, "the `update` class method (for examples " \
|
||||||
|
1131
lib/stripe/api_requestor.rb
Normal file
1131
lib/stripe/api_requestor.rb
Normal file
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,12 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.resource_url
|
def self.resource_url
|
||||||
|
if name.include?("Stripe::V2")
|
||||||
|
raise NotImplementedError,
|
||||||
|
"V2 resources do not have a defined URL. Please use the StripeClient " \
|
||||||
|
"to make V2 requests"
|
||||||
|
end
|
||||||
|
|
||||||
if self == APIResource
|
if self == APIResource
|
||||||
raise NotImplementedError,
|
raise NotImplementedError,
|
||||||
"APIResource is an abstract class. You should perform actions " \
|
"APIResource is an abstract class. You should perform actions " \
|
||||||
@ -87,33 +93,35 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
def refresh
|
def refresh
|
||||||
resp, opts = execute_resource_request(:get, resource_url,
|
if self.class.name.include?("Stripe::V2")
|
||||||
@retrieve_params)
|
raise NotImplementedError,
|
||||||
initialize_from(resp.data, opts, resp)
|
"It is not possible to refresh v2 objects. Please retrieve the object using the StripeClient instead."
|
||||||
|
end
|
||||||
|
|
||||||
|
@requestor.execute_request_initialize_from(:get, resource_url, :api, self, params: @retrieve_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.retrieve(id, opts = {})
|
def self.retrieve(id, opts = {})
|
||||||
|
if name.include?("Stripe::V2")
|
||||||
|
raise NotImplementedError,
|
||||||
|
"It is not possible to retrieve v2 objects on the resource. Please use the StripeClient instead."
|
||||||
|
end
|
||||||
|
|
||||||
opts = Util.normalize_opts(opts)
|
opts = Util.normalize_opts(opts)
|
||||||
instance = new(id, opts)
|
instance = new(id, opts)
|
||||||
instance.refresh
|
instance.refresh
|
||||||
instance
|
instance
|
||||||
end
|
end
|
||||||
|
|
||||||
def request_stripe_object(method:, path:, params:, opts: {})
|
def request_stripe_object(method:, path:, params:, base_address: :api, opts: {})
|
||||||
resp, opts = execute_resource_request(method, path, params, opts)
|
APIRequestor.active_requestor.execute_request_initialize_from(method, path, base_address, self,
|
||||||
|
params: params, opts: opts)
|
||||||
# If we're getting back this thing, update; otherwise, instantiate.
|
|
||||||
if Util.object_name_matches_class?(resp.data[:object], self.class)
|
|
||||||
initialize_from(resp.data, opts, resp)
|
|
||||||
else
|
|
||||||
Util.convert_to_stripe_object_with_params(resp.data, params, opts, resp)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
protected def request_stream(method:, path:, params:, opts: {},
|
protected def request_stream(method:, path:, params:, base_address: :api, opts: {},
|
||||||
&read_body_chunk_block)
|
&read_body_chunk_block)
|
||||||
resp, = execute_resource_request_stream(
|
resp, = execute_resource_request_stream(
|
||||||
method, path, params, opts, &read_body_chunk_block
|
method, path, base_address, params, opts, &read_body_chunk_block
|
||||||
)
|
)
|
||||||
resp
|
resp
|
||||||
end
|
end
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
|
|
||||||
module Stripe
|
module Stripe
|
||||||
module ApiVersion
|
module ApiVersion
|
||||||
CURRENT = "2024-06-20"
|
CURRENT = "2024-09-30.acacia"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,7 +12,7 @@ module Stripe
|
|||||||
class ConnectionManager
|
class ConnectionManager
|
||||||
# Timestamp (in seconds procured from the system's monotonic clock)
|
# Timestamp (in seconds procured from the system's monotonic clock)
|
||||||
# indicating when the connection manager last made a request. This is used
|
# indicating when the connection manager last made a request. This is used
|
||||||
# by `StripeClient` to determine whether a connection manager should be
|
# by `APIRequestor` to determine whether a connection manager should be
|
||||||
# garbage collected or not.
|
# garbage collected or not.
|
||||||
attr_reader :last_used
|
attr_reader :last_used
|
||||||
attr_reader :config
|
attr_reader :config
|
||||||
|
@ -27,7 +27,8 @@ module Stripe
|
|||||||
def construct_error_object
|
def construct_error_object
|
||||||
return nil if @json_body.nil? || !@json_body.key?(:error)
|
return nil if @json_body.nil? || !@json_body.key?(:error)
|
||||||
|
|
||||||
ErrorObject.construct_from(@json_body[:error])
|
# ErrorObject is shared between v1 and v2, so use original object_classes to find
|
||||||
|
ErrorObject.construct_from(@json_body[:error], {}, nil, :v1)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether the error was the result of an idempotent replay, meaning that it
|
# Whether the error was the result of an idempotent replay, meaning that it
|
||||||
@ -130,7 +131,7 @@ module Stripe
|
|||||||
def construct_error_object
|
def construct_error_object
|
||||||
return nil if @json_body.nil?
|
return nil if @json_body.nil?
|
||||||
|
|
||||||
OAuthErrorObject.construct_from(@json_body)
|
OAuthErrorObject.construct_from(@json_body, {}, nil, :v1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -166,4 +167,9 @@ module Stripe
|
|||||||
class UnsupportedResponseTypeError < OAuthError
|
class UnsupportedResponseTypeError < OAuthError
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# class definitions: The beginning of the section generated from our OpenAPI spec
|
||||||
|
class TemporarySessionExpiredError < StripeError
|
||||||
|
end
|
||||||
|
# class definitions: The end of the section generated from our OpenAPI spec
|
||||||
end
|
end
|
||||||
|
14
lib/stripe/event_types.rb
Normal file
14
lib/stripe/event_types.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module EventTypes
|
||||||
|
def self.thin_event_names_to_classes
|
||||||
|
{
|
||||||
|
# The beginning of the section generated from our OpenAPI spec
|
||||||
|
V1BillingMeterErrorReportTriggeredEvent.lookup_type => V1BillingMeterErrorReportTriggeredEvent,
|
||||||
|
V1BillingMeterNoMeterFoundEvent.lookup_type => V1BillingMeterNoMeterFoundEvent,
|
||||||
|
# The end of the section generated from our OpenAPI spec
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,23 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# This event occurs when there are invalid async usage events for a given meter.
|
||||||
|
class V1BillingMeterErrorReportTriggeredEvent < Stripe::V2::Event
|
||||||
|
def self.lookup_type
|
||||||
|
"v1.billing.meter.error_report_triggered"
|
||||||
|
end
|
||||||
|
# There is additional data present for this event, accessible with the `data` property.
|
||||||
|
# See the Stripe API docs for more information.
|
||||||
|
|
||||||
|
# Retrieves the related object from the API. Make an API request on every call.
|
||||||
|
def fetch_related_object
|
||||||
|
_request(
|
||||||
|
method: :get,
|
||||||
|
path: related_object.url,
|
||||||
|
base_address: :api,
|
||||||
|
opts: { stripe_account: context }
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/stripe/events/v1_billing_meter_no_meter_found_event.rb
Normal file
13
lib/stripe/events/v1_billing_meter_no_meter_found_event.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# This event occurs when async usage events have missing or invalid meter ids.
|
||||||
|
class V1BillingMeterNoMeterFoundEvent < Stripe::V2::Event
|
||||||
|
def self.lookup_type
|
||||||
|
"v1.billing.meter.no_meter_found"
|
||||||
|
end
|
||||||
|
# There is additional data present for this event, accessible with the `data` property.
|
||||||
|
# See the Stripe API docs for more information.
|
||||||
|
end
|
||||||
|
end
|
@ -21,7 +21,7 @@ module Stripe
|
|||||||
# there isn't a next page in order to replicate the behavior of the API
|
# there isn't a next page in order to replicate the behavior of the API
|
||||||
# when it attempts to return a page beyond the last.
|
# when it attempts to return a page beyond the last.
|
||||||
def self.empty_list(opts = {})
|
def self.empty_list(opts = {})
|
||||||
ListObject.construct_from({ data: [] }, opts)
|
ListObject.construct_from({ data: [] }, opts, nil, :v1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
@ -96,8 +96,7 @@ module Stripe
|
|||||||
def retrieve(id, opts = {})
|
def retrieve(id, opts = {})
|
||||||
id, retrieve_params = Util.normalize_id(id)
|
id, retrieve_params = Util.normalize_id(id)
|
||||||
url = "#{resource_url}/#{CGI.escape(id)}"
|
url = "#{resource_url}/#{CGI.escape(id)}"
|
||||||
resp, opts = execute_resource_request(:get, url, retrieve_params, opts)
|
execute_resource_request(:get, url, :api, retrieve_params, opts)
|
||||||
Util.convert_to_stripe_object(resp.data, opts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Fetches the next page in the resource list (if there is one).
|
# Fetches the next page in the resource list (if there is one).
|
||||||
|
@ -5,12 +5,10 @@ module Stripe
|
|||||||
module OAuthOperations
|
module OAuthOperations
|
||||||
extend APIOperations::Request::ClassMethods
|
extend APIOperations::Request::ClassMethods
|
||||||
|
|
||||||
def self.execute_resource_request(method, url, params, opts)
|
def self.execute_resource_request(method, url, base_address, params, opts)
|
||||||
opts = Util.normalize_opts(opts)
|
opts = Util.normalize_opts(opts)
|
||||||
opts[:client] ||= opts[:client] || StripeClient.active_client
|
|
||||||
opts[:api_base] ||= opts[:client].config.connect_base
|
|
||||||
|
|
||||||
super(method, url, params, opts)
|
super(method, url, base_address, params, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -29,15 +27,14 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.authorize_url(params = {}, opts = {})
|
def self.authorize_url(params = {}, opts = {})
|
||||||
client = opts[:client] || StripeClient.active_client
|
base = opts[:connect_base] || APIRequestor.active_requestor.config.connect_base
|
||||||
base = opts[:connect_base] || client.config.connect_base
|
|
||||||
|
|
||||||
path = "/oauth/authorize"
|
path = "/oauth/authorize"
|
||||||
path = "/express" + path if opts[:express]
|
path = "/express" + path if opts[:express]
|
||||||
|
|
||||||
params[:client_id] = get_client_id(params)
|
params[:client_id] = get_client_id(params)
|
||||||
params[:response_type] ||= "code"
|
params[:response_type] ||= "code"
|
||||||
query = Util.encode_parameters(params)
|
query = Util.encode_parameters(params, :v1)
|
||||||
|
|
||||||
"#{base}#{path}?#{query}"
|
"#{base}#{path}?#{query}"
|
||||||
end
|
end
|
||||||
@ -45,21 +42,17 @@ module Stripe
|
|||||||
def self.token(params = {}, opts = {})
|
def self.token(params = {}, opts = {})
|
||||||
opts = Util.normalize_opts(opts)
|
opts = Util.normalize_opts(opts)
|
||||||
opts[:api_key] = params[:client_secret] if params[:client_secret]
|
opts[:api_key] = params[:client_secret] if params[:client_secret]
|
||||||
resp, opts = OAuthOperations.execute_resource_request(
|
OAuthOperations.execute_resource_request(
|
||||||
:post, "/oauth/token", params, opts
|
:post, "/oauth/token", :connect, params, opts
|
||||||
)
|
)
|
||||||
# This is just going to return a generic StripeObject, but that's okay
|
|
||||||
Util.convert_to_stripe_object(resp.data, opts)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.deauthorize(params = {}, opts = {})
|
def self.deauthorize(params = {}, opts = {})
|
||||||
opts = Util.normalize_opts(opts)
|
opts = Util.normalize_opts(opts)
|
||||||
params[:client_id] = get_client_id(params)
|
params[:client_id] = get_client_id(params)
|
||||||
resp, opts = OAuthOperations.execute_resource_request(
|
OAuthOperations.execute_resource_request(
|
||||||
:post, "/oauth/deauthorize", params, opts
|
:post, "/oauth/deauthorize", :connect, params, opts
|
||||||
)
|
)
|
||||||
# This is just going to return a generic StripeObject, but that's okay
|
|
||||||
Util.convert_to_stripe_object(resp.data, opts)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
# rubocop:disable Metrics/MethodLength
|
||||||
# rubocop:disable Metrics/AbcSize
|
|
||||||
|
|
||||||
module Stripe
|
module Stripe
|
||||||
module ObjectTypes
|
module ObjectTypes
|
||||||
@ -15,6 +14,7 @@ module Stripe
|
|||||||
# object classes: The beginning of the section generated from our OpenAPI spec
|
# object classes: The beginning of the section generated from our OpenAPI spec
|
||||||
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,
|
||||||
@ -24,6 +24,9 @@ module Stripe
|
|||||||
BalanceTransaction.object_name => BalanceTransaction,
|
BalanceTransaction.object_name => BalanceTransaction,
|
||||||
BankAccount.object_name => BankAccount,
|
BankAccount.object_name => BankAccount,
|
||||||
Billing::Alert.object_name => Billing::Alert,
|
Billing::Alert.object_name => Billing::Alert,
|
||||||
|
Billing::CreditBalanceSummary.object_name => Billing::CreditBalanceSummary,
|
||||||
|
Billing::CreditBalanceTransaction.object_name => Billing::CreditBalanceTransaction,
|
||||||
|
Billing::CreditGrant.object_name => Billing::CreditGrant,
|
||||||
Billing::Meter.object_name => Billing::Meter,
|
Billing::Meter.object_name => Billing::Meter,
|
||||||
Billing::MeterEvent.object_name => Billing::MeterEvent,
|
Billing::MeterEvent.object_name => Billing::MeterEvent,
|
||||||
Billing::MeterEventAdjustment.object_name => Billing::MeterEventAdjustment,
|
Billing::MeterEventAdjustment.object_name => Billing::MeterEventAdjustment,
|
||||||
@ -31,6 +34,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,
|
||||||
@ -57,22 +63,30 @@ module Stripe
|
|||||||
File.object_name => File,
|
File.object_name => 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,
|
FinancialConnections::AccountOwnership.object_name => FinancialConnections::AccountOwnership,
|
||||||
|
FinancialConnections::Institution.object_name => FinancialConnections::Institution,
|
||||||
FinancialConnections::Session.object_name => FinancialConnections::Session,
|
FinancialConnections::Session.object_name => FinancialConnections::Session,
|
||||||
FinancialConnections::Transaction.object_name => FinancialConnections::Transaction,
|
FinancialConnections::Transaction.object_name => FinancialConnections::Transaction,
|
||||||
Forwarding::Request.object_name => Forwarding::Request,
|
Forwarding::Request.object_name => Forwarding::Request,
|
||||||
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,
|
||||||
InvoiceRenderingTemplate.object_name => InvoiceRenderingTemplate,
|
InvoiceRenderingTemplate.object_name => InvoiceRenderingTemplate,
|
||||||
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::DisputeSettlementDetail.object_name => Issuing::DisputeSettlementDetail,
|
||||||
Issuing::PersonalizationDesign.object_name => Issuing::PersonalizationDesign,
|
Issuing::PersonalizationDesign.object_name => Issuing::PersonalizationDesign,
|
||||||
Issuing::PhysicalBundle.object_name => Issuing::PhysicalBundle,
|
Issuing::PhysicalBundle.object_name => Issuing::PhysicalBundle,
|
||||||
Issuing::Token.object_name => Issuing::Token,
|
Issuing::Token.object_name => Issuing::Token,
|
||||||
@ -80,6 +94,8 @@ module Stripe
|
|||||||
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,
|
||||||
@ -93,6 +109,8 @@ module Stripe
|
|||||||
ProductFeature.object_name => ProductFeature,
|
ProductFeature.object_name => ProductFeature,
|
||||||
PromotionCode.object_name => PromotionCode,
|
PromotionCode.object_name => PromotionCode,
|
||||||
Quote.object_name => Quote,
|
Quote.object_name => Quote,
|
||||||
|
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,
|
||||||
@ -110,8 +128,10 @@ module Stripe
|
|||||||
Subscription.object_name => Subscription,
|
Subscription.object_name => Subscription,
|
||||||
SubscriptionItem.object_name => SubscriptionItem,
|
SubscriptionItem.object_name => SubscriptionItem,
|
||||||
SubscriptionSchedule.object_name => SubscriptionSchedule,
|
SubscriptionSchedule.object_name => SubscriptionSchedule,
|
||||||
|
Tax::Association.object_name => Tax::Association,
|
||||||
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,
|
||||||
@ -123,6 +143,7 @@ module Stripe
|
|||||||
Terminal::ConnectionToken.object_name => Terminal::ConnectionToken,
|
Terminal::ConnectionToken.object_name => Terminal::ConnectionToken,
|
||||||
Terminal::Location.object_name => Terminal::Location,
|
Terminal::Location.object_name => Terminal::Location,
|
||||||
Terminal::Reader.object_name => Terminal::Reader,
|
Terminal::Reader.object_name => Terminal::Reader,
|
||||||
|
Terminal::ReaderCollectedData.object_name => Terminal::ReaderCollectedData,
|
||||||
TestHelpers::TestClock.object_name => TestHelpers::TestClock,
|
TestHelpers::TestClock.object_name => TestHelpers::TestClock,
|
||||||
Token.object_name => Token,
|
Token.object_name => Token,
|
||||||
Topup.object_name => Topup,
|
Topup.object_name => Topup,
|
||||||
@ -144,6 +165,19 @@ module Stripe
|
|||||||
# object classes: The end of the section generated from our OpenAPI spec
|
# object classes: The end of the section generated from our OpenAPI spec
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.v2_object_names_to_classes
|
||||||
|
{
|
||||||
|
V2::ListObject.object_name => V2::ListObject,
|
||||||
|
|
||||||
|
# v2 object classes: The beginning of the section generated from our OpenAPI spec
|
||||||
|
V2::Billing::MeterEvent.object_name => V2::Billing::MeterEvent,
|
||||||
|
V2::Billing::MeterEventAdjustment.object_name => V2::Billing::MeterEventAdjustment,
|
||||||
|
V2::Billing::MeterEventSession.object_name => V2::Billing::MeterEventSession,
|
||||||
|
V2::Event.object_name => V2::Event,
|
||||||
|
# v2 object classes: The end of the section generated from our OpenAPI spec
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
128
lib/stripe/request_options.rb
Normal file
128
lib/stripe/request_options.rb
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
# typed: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# RequestOptions is a class that encapsulates configurable options
|
||||||
|
# for requests made to the Stripe API. It is used by the APIRequestor
|
||||||
|
# to set per-request options.
|
||||||
|
#
|
||||||
|
# For internal use only. Does not provide a stable API and may be broken
|
||||||
|
# with future non-major changes.
|
||||||
|
module RequestOptions
|
||||||
|
# Options that a user is allowed to specify.
|
||||||
|
OPTS_USER_SPECIFIED = Set[
|
||||||
|
:api_key,
|
||||||
|
:idempotency_key,
|
||||||
|
:stripe_account,
|
||||||
|
:stripe_context,
|
||||||
|
:stripe_version
|
||||||
|
].freeze
|
||||||
|
|
||||||
|
# Options that should be copyable from one StripeObject to another
|
||||||
|
# including options that may be internal.
|
||||||
|
OPTS_COPYABLE = (
|
||||||
|
OPTS_USER_SPECIFIED + Set[:api_base]
|
||||||
|
).freeze
|
||||||
|
|
||||||
|
# Options that should be persisted between API requests.
|
||||||
|
OPTS_PERSISTABLE = (
|
||||||
|
OPTS_USER_SPECIFIED - Set[:idempotency_key, :stripe_context]
|
||||||
|
).freeze
|
||||||
|
|
||||||
|
# Merges requestor options on a StripeConfiguration object
|
||||||
|
# with a per-request options hash, giving precedence
|
||||||
|
# to the per-request options. Expects StripeConfiguration and hash.
|
||||||
|
def self.merge_config_and_opts(config, req_opts)
|
||||||
|
# Raise an error if config is not a StripeConfiguration object
|
||||||
|
unless config.is_a?(StripeConfiguration)
|
||||||
|
raise ArgumentError, "config must be a Stripe::StripeConfiguration object"
|
||||||
|
end
|
||||||
|
|
||||||
|
merged_opts = {
|
||||||
|
api_key: req_opts[:api_key] || config.api_key,
|
||||||
|
idempotency_key: req_opts[:idempotency_key],
|
||||||
|
stripe_account: req_opts[:stripe_account] || config.stripe_account,
|
||||||
|
stripe_context: req_opts[:stripe_context] || config.stripe_context,
|
||||||
|
stripe_version: req_opts[:stripe_version] || config.api_version,
|
||||||
|
headers: req_opts[:headers] || {},
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove nil values from headers
|
||||||
|
merged_opts.delete_if { |_, v| v.nil? }
|
||||||
|
|
||||||
|
merged_opts
|
||||||
|
end
|
||||||
|
|
||||||
|
# Merges requestor options hash on a StripeObject
|
||||||
|
# with a per-request options hash, giving precedence
|
||||||
|
# to the per-request options. Returns the merged request options.
|
||||||
|
# Expects two hashes.
|
||||||
|
def self.combine_opts(object_opts, req_opts)
|
||||||
|
merged_opts = {
|
||||||
|
api_key: req_opts[:api_key] || object_opts[:api_key],
|
||||||
|
idempotency_key: req_opts[:idempotency_key],
|
||||||
|
stripe_account: req_opts[:stripe_account] || object_opts[:stripe_account],
|
||||||
|
stripe_context: req_opts[:stripe_context] || object_opts[:stripe_context],
|
||||||
|
stripe_version: req_opts[:stripe_version] || object_opts[:api_version],
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove nil values from headers
|
||||||
|
merged_opts.delete_if { |_, v| v.nil? }
|
||||||
|
|
||||||
|
merged_opts
|
||||||
|
end
|
||||||
|
|
||||||
|
# Extracts options from a user-provided hash, returning a new request options hash
|
||||||
|
# containing the recognized request options and a `headers` entry for the remaining options.
|
||||||
|
def self.extract_opts_from_hash(opts)
|
||||||
|
req_opts = {}
|
||||||
|
normalized_opts = Util.normalize_opts(opts.clone)
|
||||||
|
|
||||||
|
RequestOptions.error_on_non_string_user_opts(normalized_opts)
|
||||||
|
|
||||||
|
OPTS_USER_SPECIFIED.each do |opt|
|
||||||
|
req_opts[opt] = normalized_opts[opt] if normalized_opts.key?(opt)
|
||||||
|
normalized_opts.delete(opt)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Remaining user-provided opts should be treated as headers
|
||||||
|
req_opts[:headers] = Util.normalize_headers(normalized_opts) if normalized_opts.any?
|
||||||
|
|
||||||
|
req_opts
|
||||||
|
end
|
||||||
|
|
||||||
|
# Validates a normalized opts hash.
|
||||||
|
def self.error_on_non_string_user_opts(normalized_opts)
|
||||||
|
OPTS_USER_SPECIFIED.each do |opt|
|
||||||
|
next unless normalized_opts.key?(opt)
|
||||||
|
|
||||||
|
val = normalized_opts[opt]
|
||||||
|
next if val.nil?
|
||||||
|
next if val.is_a?(String)
|
||||||
|
|
||||||
|
raise ArgumentError,
|
||||||
|
"request option '#{opt}' should be a string value " \
|
||||||
|
"(was a #{val.class})"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get options that persist between requests
|
||||||
|
def self.persistable(req_opts)
|
||||||
|
opts_to_persist = {}
|
||||||
|
|
||||||
|
# Hash#select returns an array before 1.9
|
||||||
|
req_opts.each do |k, v|
|
||||||
|
opts_to_persist[k] = v if RequestOptions::OPTS_PERSISTABLE.include?(k)
|
||||||
|
end
|
||||||
|
|
||||||
|
opts_to_persist
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get options that are copyable from StripeObject to StripeObject
|
||||||
|
def self.copyable(req_opts)
|
||||||
|
req_opts.select do |k, _v|
|
||||||
|
RequestOptions::OPTS_COPYABLE.include?(k)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
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"
|
||||||
@ -12,6 +13,9 @@ require "stripe/resources/balance"
|
|||||||
require "stripe/resources/balance_transaction"
|
require "stripe/resources/balance_transaction"
|
||||||
require "stripe/resources/bank_account"
|
require "stripe/resources/bank_account"
|
||||||
require "stripe/resources/billing/alert"
|
require "stripe/resources/billing/alert"
|
||||||
|
require "stripe/resources/billing/credit_balance_summary"
|
||||||
|
require "stripe/resources/billing/credit_balance_transaction"
|
||||||
|
require "stripe/resources/billing/credit_grant"
|
||||||
require "stripe/resources/billing/meter"
|
require "stripe/resources/billing/meter"
|
||||||
require "stripe/resources/billing/meter_event"
|
require "stripe/resources/billing/meter_event"
|
||||||
require "stripe/resources/billing/meter_event_adjustment"
|
require "stripe/resources/billing/meter_event_adjustment"
|
||||||
@ -19,6 +23,9 @@ require "stripe/resources/billing/meter_event_summary"
|
|||||||
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"
|
||||||
@ -45,22 +52,29 @@ 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/institution"
|
||||||
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/forwarding/request"
|
require "stripe/resources/forwarding/request"
|
||||||
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/invoice_rendering_template"
|
require "stripe/resources/invoice_rendering_template"
|
||||||
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/dispute_settlement_detail"
|
||||||
require "stripe/resources/issuing/personalization_design"
|
require "stripe/resources/issuing/personalization_design"
|
||||||
require "stripe/resources/issuing/physical_bundle"
|
require "stripe/resources/issuing/physical_bundle"
|
||||||
require "stripe/resources/issuing/token"
|
require "stripe/resources/issuing/token"
|
||||||
@ -68,6 +82,8 @@ 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"
|
||||||
@ -81,6 +97,8 @@ require "stripe/resources/product"
|
|||||||
require "stripe/resources/product_feature"
|
require "stripe/resources/product_feature"
|
||||||
require "stripe/resources/promotion_code"
|
require "stripe/resources/promotion_code"
|
||||||
require "stripe/resources/quote"
|
require "stripe/resources/quote"
|
||||||
|
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"
|
||||||
@ -98,8 +116,10 @@ require "stripe/resources/source_transaction"
|
|||||||
require "stripe/resources/subscription"
|
require "stripe/resources/subscription"
|
||||||
require "stripe/resources/subscription_item"
|
require "stripe/resources/subscription_item"
|
||||||
require "stripe/resources/subscription_schedule"
|
require "stripe/resources/subscription_schedule"
|
||||||
|
require "stripe/resources/tax/association"
|
||||||
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"
|
||||||
@ -111,6 +131,7 @@ require "stripe/resources/terminal/configuration"
|
|||||||
require "stripe/resources/terminal/connection_token"
|
require "stripe/resources/terminal/connection_token"
|
||||||
require "stripe/resources/terminal/location"
|
require "stripe/resources/terminal/location"
|
||||||
require "stripe/resources/terminal/reader"
|
require "stripe/resources/terminal/reader"
|
||||||
|
require "stripe/resources/terminal/reader_collected_data"
|
||||||
require "stripe/resources/test_helpers/test_clock"
|
require "stripe/resources/test_helpers/test_clock"
|
||||||
require "stripe/resources/token"
|
require "stripe/resources/token"
|
||||||
require "stripe/resources/topup"
|
require "stripe/resources/topup"
|
||||||
@ -128,4 +149,10 @@ require "stripe/resources/treasury/transaction"
|
|||||||
require "stripe/resources/treasury/transaction_entry"
|
require "stripe/resources/treasury/transaction_entry"
|
||||||
require "stripe/resources/usage_record"
|
require "stripe/resources/usage_record"
|
||||||
require "stripe/resources/usage_record_summary"
|
require "stripe/resources/usage_record_summary"
|
||||||
|
require "stripe/resources/v2/billing/meter_event"
|
||||||
|
require "stripe/resources/v2/billing/meter_event_adjustment"
|
||||||
|
require "stripe/resources/v2/billing/meter_event_session"
|
||||||
|
require "stripe/resources/v2/event"
|
||||||
require "stripe/resources/webhook_endpoint"
|
require "stripe/resources/webhook_endpoint"
|
||||||
|
require "stripe/events/v1_billing_meter_error_report_triggered_event"
|
||||||
|
require "stripe/events/v1_billing_meter_no_meter_found_event"
|
||||||
|
32
lib/stripe/resources/account_notice.rb
Normal file
32
lib/stripe/resources/account_notice.rb
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"account_notice"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves a list of AccountNotice objects. The objects are sorted in descending order by creation date, with the most-recently-created object appearing first.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(method: :get, path: "/v1/account_notices", params: filters, opts: opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates an AccountNotice object.
|
||||||
|
def self.update(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/account_notices/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
14
lib/stripe/resources/billing/credit_balance_summary.rb
Normal file
14
lib/stripe/resources/billing/credit_balance_summary.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
# Indicates the credit balance for credits granted to a customer.
|
||||||
|
class CreditBalanceSummary < SingletonAPIResource
|
||||||
|
OBJECT_NAME = "billing.credit_balance_summary"
|
||||||
|
def self.object_name
|
||||||
|
"billing.credit_balance_summary"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
26
lib/stripe/resources/billing/credit_balance_transaction.rb
Normal file
26
lib/stripe/resources/billing/credit_balance_transaction.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
# A credit balance transaction is a resource representing a transaction (either a credit or a debit) against an existing credit grant.
|
||||||
|
class CreditBalanceTransaction < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "billing.credit_balance_transaction"
|
||||||
|
def self.object_name
|
||||||
|
"billing.credit_balance_transaction"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieve a list of credit balance transactions
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/billing/credit_balance_transactions",
|
||||||
|
params: filters,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
88
lib/stripe/resources/billing/credit_grant.rb
Normal file
88
lib/stripe/resources/billing/credit_grant.rb
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
# A credit grant is a resource that records a grant of some credit to a customer.
|
||||||
|
class CreditGrant < APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
include Stripe::APIOperations::Save
|
||||||
|
|
||||||
|
OBJECT_NAME = "billing.credit_grant"
|
||||||
|
def self.object_name
|
||||||
|
"billing.credit_grant"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Creates a credit grant
|
||||||
|
def self.create(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/billing/credit_grants",
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Expires a credit grant
|
||||||
|
def expire(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Expires a credit grant
|
||||||
|
def self.expire(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieve a list of credit grants
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/billing/credit_grants",
|
||||||
|
params: filters,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates a credit grant
|
||||||
|
def self.update(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Voids a credit grant
|
||||||
|
def void_grant(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Voids a credit grant
|
||||||
|
def self.void_grant(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
49
lib/stripe/resources/capital/financing_offer.rb
Normal file
49
lib/stripe/resources/capital/financing_offer.rb
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"capital.financing_offer"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves the financing offers available for Connected accounts that belong to your platform.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/capital/financing_offers",
|
||||||
|
params: filters,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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
|
15
lib/stripe/resources/capital/financing_summary.rb
Normal file
15
lib/stripe/resources/capital/financing_summary.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"capital.financing_summary"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
27
lib/stripe/resources/capital/financing_transaction.rb
Normal file
27
lib/stripe/resources/capital/financing_transaction.rb
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"capital.financing_transaction"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of financing transactions. The transactions are returned in sorted order,
|
||||||
|
# with the most recent transactions appearing first.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/capital/financing_transactions",
|
||||||
|
params: filters,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -2,9 +2,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Stripe
|
module Stripe
|
||||||
# This object represents a customer of your business. Use it to create recurring charges and track payments that belong to the same customer.
|
# This object represents a customer of your business. Use it to [create recurring charges](https://stripe.com/docs/invoicing/customer), [save payment](https://stripe.com/docs/payments/save-during-payment) and contact information,
|
||||||
#
|
# and track payments that belong to the same customer.
|
||||||
# Related guide: [Save a card during payment](https://stripe.com/docs/payments/save-during-payment)
|
|
||||||
class Customer < APIResource
|
class Customer < APIResource
|
||||||
extend Stripe::APIOperations::Create
|
extend Stripe::APIOperations::Create
|
||||||
include Stripe::APIOperations::Delete
|
include Stripe::APIOperations::Delete
|
||||||
|
@ -22,17 +22,19 @@ module Stripe
|
|||||||
#
|
#
|
||||||
# All of Stripe's officially supported Client libraries support sending multipart/form-data.
|
# All of Stripe's officially supported Client libraries support sending multipart/form-data.
|
||||||
def self.create(params = {}, opts = {})
|
def self.create(params = {}, opts = {})
|
||||||
config = opts[:client]&.config || Stripe.config
|
|
||||||
upload_base = config.uploads_base
|
|
||||||
opts = { api_base: upload_base }.merge(Util.normalize_opts(opts))
|
|
||||||
|
|
||||||
if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
|
if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read)
|
||||||
raise ArgumentError, "file must respond to `#read`"
|
raise ArgumentError, "file must respond to `#read`"
|
||||||
end
|
end
|
||||||
|
|
||||||
opts = { content_type: MultipartEncoder::MULTIPART_FORM_DATA }.merge(Util.normalize_opts(opts))
|
opts = { content_type: MultipartEncoder::MULTIPART_FORM_DATA }.merge(Util.normalize_opts(opts))
|
||||||
|
|
||||||
request_stripe_object(method: :post, path: "/v1/files", params: params, opts: opts)
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/files",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :files
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
|
# Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top.
|
||||||
|
@ -6,12 +6,15 @@ 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"
|
||||||
def self.object_name
|
def self.object_name
|
||||||
"financial_connections.account"
|
"financial_connections.account"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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,14 @@
|
|||||||
|
# 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
|
||||||
|
OBJECT_NAME = "financial_connections.account_inferred_balance"
|
||||||
|
def self.object_name
|
||||||
|
"financial_connections.account_inferred_balance"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
26
lib/stripe/resources/financial_connections/institution.rb
Normal file
26
lib/stripe/resources/financial_connections/institution.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module FinancialConnections
|
||||||
|
# An institution represents a financial institution to which an end user can connect using the Financial Connections authentication flow.
|
||||||
|
class Institution < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "financial_connections.institution"
|
||||||
|
def self.object_name
|
||||||
|
"financial_connections.institution"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of Financial Connections Institution objects.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/financial_connections/institutions",
|
||||||
|
params: filters,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
59
lib/stripe/resources/gift_cards/card.rb
Normal file
59
lib/stripe/resources/gift_cards/card.rb
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"gift_cards.card"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Creates a new gift card object.
|
||||||
|
def self.create(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/gift_cards/cards",
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# List gift cards for an account
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/gift_cards/cards",
|
||||||
|
params: filters,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update a gift card
|
||||||
|
def self.update(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/gift_cards/cards/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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
|
93
lib/stripe/resources/gift_cards/transaction.rb
Normal file
93
lib/stripe/resources/gift_cards/transaction.rb
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"gift_cards.transaction"
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Create a gift card transaction
|
||||||
|
def self.create(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/gift_cards/transactions",
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# List gift card transactions for a gift card
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/gift_cards/transactions",
|
||||||
|
params: filters,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update a gift card transaction
|
||||||
|
def self.update(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/gift_cards/transactions/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -48,6 +48,7 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
nested_resource_class_methods :line, operations: %i[list]
|
nested_resource_class_methods :line, operations: %i[list]
|
||||||
|
nested_resource_class_methods :payment, operations: %i[retrieve list]
|
||||||
|
|
||||||
# Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
|
# Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
|
||||||
def add_lines(params = {}, opts = {})
|
def add_lines(params = {}, opts = {})
|
||||||
@ -69,6 +70,86 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
|
||||||
|
#
|
||||||
|
# For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid
|
||||||
|
# of the invoice and subsequently transitioning the status of the invoice to paid if necessary.
|
||||||
|
#
|
||||||
|
# For the PaymentIntent, 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's attached, it's
|
||||||
|
# credited to the invoice immediately.
|
||||||
|
#
|
||||||
|
# See: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create) to learn more.
|
||||||
|
def attach_payment(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/invoices/%<invoice>s/attach_payment", { invoice: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
|
||||||
|
#
|
||||||
|
# For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid
|
||||||
|
# of the invoice and subsequently transitioning the status of the invoice to paid if necessary.
|
||||||
|
#
|
||||||
|
# For the PaymentIntent, 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's attached, it's
|
||||||
|
# credited to the invoice immediately.
|
||||||
|
#
|
||||||
|
# See: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create) to learn more.
|
||||||
|
def self.attach_payment(invoice, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/invoices/%<invoice>s/attach_payment", { invoice: CGI.escape(invoice) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
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 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
# This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
|
# This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or <a href="#send_invoice">send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers.
|
||||||
def self.create(params = {}, opts = {})
|
def self.create(params = {}, opts = {})
|
||||||
request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
|
request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts)
|
||||||
|
12
lib/stripe/resources/invoice_payment.rb
Normal file
12
lib/stripe/resources/invoice_payment.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
# The invoice payment object
|
||||||
|
class InvoicePayment < APIResource
|
||||||
|
OBJECT_NAME = "invoice_payment"
|
||||||
|
def self.object_name
|
||||||
|
"invoice_payment"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -2,6 +2,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Stripe
|
module Stripe
|
||||||
|
# Invoice Rendering Templates are used to configure how invoices are rendered on surfaces like the PDF. Invoice Rendering Templates
|
||||||
|
# can be created from within the Dashboard, and they can be used over the API when creating invoices.
|
||||||
class InvoiceRenderingTemplate < APIResource
|
class InvoiceRenderingTemplate < APIResource
|
||||||
extend Stripe::APIOperations::List
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
88
lib/stripe/resources/issuing/credit_underwriting_record.rb
Normal file
88
lib/stripe/resources/issuing/credit_underwriting_record.rb
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"issuing.credit_underwriting_record"
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# Retrieves a list of CreditUnderwritingRecord objects. The objects are sorted in descending order by creation date, with the most-recently-created object appearing first.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/issuing/credit_underwriting_records",
|
||||||
|
params: filters,
|
||||||
|
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 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
|
26
lib/stripe/resources/issuing/dispute_settlement_detail.rb
Normal file
26
lib/stripe/resources/issuing/dispute_settlement_detail.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Issuing
|
||||||
|
# Represents a record from the card network of a money movement or change in state for an Issuing dispute. These records are included in the settlement reports that we receive from networks and expose to users as Settlement objects.
|
||||||
|
class DisputeSettlementDetail < APIResource
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "issuing.dispute_settlement_detail"
|
||||||
|
def self.object_name
|
||||||
|
"issuing.dispute_settlement_detail"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of Issuing DisputeSettlementDetail objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/issuing/dispute_settlement_details",
|
||||||
|
params: filters,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
37
lib/stripe/resources/margin.rb
Normal file
37
lib/stripe/resources/margin.rb
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"margin"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount. A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
|
||||||
|
def self.create(params = {}, opts = {})
|
||||||
|
request_stripe_object(method: :post, path: "/v1/billing/margins", params: params, opts: opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieve a list of your margins.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(method: :get, path: "/v1/billing/margins", params: filters, opts: opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update the specified margin object. Certain fields of the margin object are not editable.
|
||||||
|
def self.update(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/margins/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
120
lib/stripe/resources/order.rb
Normal file
120
lib/stripe/resources/order.rb
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"order"
|
||||||
|
end
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Creates a new open order object.
|
||||||
|
def self.create(params = {}, opts = {})
|
||||||
|
request_stripe_object(method: :post, path: "/v1/orders", params: params, opts: opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of your orders. The orders are returned sorted by creation date, with the most recently created orders appearing first.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(method: :get, path: "/v1/orders", params: filters, 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
|
||||||
|
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Updates the specific order by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
||||||
|
def self.update(id, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/orders/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -182,6 +182,56 @@ module Stripe
|
|||||||
request_stripe_object(method: :post, path: "/v1/payment_intents", params: params, opts: opts)
|
request_stripe_object(method: :post, path: "/v1/payment_intents", params: params, opts: opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Perform a decremental authorization on an eligible
|
||||||
|
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
|
||||||
|
# PaymentIntent's status must be requires_capture and
|
||||||
|
# [decremental_authorization.status](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization)
|
||||||
|
# must be available.
|
||||||
|
#
|
||||||
|
# Decremental authorizations decrease the authorized amount on your customer's card
|
||||||
|
# to the new, lower amount provided. A single PaymentIntent can call this endpoint multiple times to further decrease the authorized amount.
|
||||||
|
#
|
||||||
|
# After decrement, the PaymentIntent object
|
||||||
|
# returns with the updated
|
||||||
|
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
|
||||||
|
# The PaymentIntent will now be capturable up to the new authorized amount.
|
||||||
|
#
|
||||||
|
# Each PaymentIntent can have a maximum of 10 decremental or incremental authorization attempts, including declines.
|
||||||
|
# After it's fully captured, a PaymentIntent can no longer be decremented.
|
||||||
|
def decrement_authorization(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/payment_intents/%<intent>s/decrement_authorization", { intent: CGI.escape(self["id"]) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Perform a decremental authorization on an eligible
|
||||||
|
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
|
||||||
|
# PaymentIntent's status must be requires_capture and
|
||||||
|
# [decremental_authorization.status](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization)
|
||||||
|
# must be available.
|
||||||
|
#
|
||||||
|
# Decremental authorizations decrease the authorized amount on your customer's card
|
||||||
|
# to the new, lower amount provided. A single PaymentIntent can call this endpoint multiple times to further decrease the authorized amount.
|
||||||
|
#
|
||||||
|
# After decrement, the PaymentIntent object
|
||||||
|
# returns with the updated
|
||||||
|
# [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
|
||||||
|
# The PaymentIntent will now be capturable up to the new authorized amount.
|
||||||
|
#
|
||||||
|
# Each PaymentIntent can have a maximum of 10 decremental or incremental authorization attempts, including declines.
|
||||||
|
# After it's fully captured, a PaymentIntent can no longer be decremented.
|
||||||
|
def self.decrement_authorization(intent, params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/payment_intents/%<intent>s/decrement_authorization", { intent: CGI.escape(intent) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
# Perform an incremental authorization on an eligible
|
# Perform an incremental authorization on an eligible
|
||||||
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
|
# [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
|
||||||
# PaymentIntent's status must be requires_capture and
|
# PaymentIntent's status must be requires_capture and
|
||||||
|
@ -7,6 +7,7 @@ module Stripe
|
|||||||
class Quote < APIResource
|
class Quote < APIResource
|
||||||
extend Stripe::APIOperations::Create
|
extend Stripe::APIOperations::Create
|
||||||
extend Stripe::APIOperations::List
|
extend Stripe::APIOperations::List
|
||||||
|
extend Stripe::APIOperations::NestedResource
|
||||||
include Stripe::APIOperations::Save
|
include Stripe::APIOperations::Save
|
||||||
|
|
||||||
OBJECT_NAME = "quote"
|
OBJECT_NAME = "quote"
|
||||||
@ -14,6 +15,9 @@ module Stripe
|
|||||||
"quote"
|
"quote"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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(
|
||||||
@ -124,32 +128,132 @@ 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
|
||||||
|
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# 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 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 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 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
|
||||||
|
|
||||||
|
# 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. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
|
# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
|
||||||
def pdf(params = {}, opts = {}, &read_body_chunk_block)
|
def pdf(params = {}, opts = {}, &read_body_chunk_block)
|
||||||
config = opts[:client]&.config || Stripe.config
|
opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts)
|
||||||
opts = { api_base: config.uploads_base }.merge(opts)
|
|
||||||
request_stream(
|
request_stream(
|
||||||
method: :get,
|
method: :get,
|
||||||
path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }),
|
path: format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(self["id"]) }),
|
||||||
params: params,
|
params: params,
|
||||||
opts: opts,
|
opts: opts,
|
||||||
|
base_address: :files,
|
||||||
&read_body_chunk_block
|
&read_body_chunk_block
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
|
# Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf)
|
||||||
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
|
opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts)
|
||||||
opts = { api_base: config.uploads_base }.merge(opts)
|
|
||||||
execute_resource_request_stream(
|
execute_resource_request_stream(
|
||||||
:get,
|
:get,
|
||||||
format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(quote) }),
|
format("/v1/quotes/%<quote>s/pdf", { quote: CGI.escape(quote) }),
|
||||||
|
:files,
|
||||||
params,
|
params,
|
||||||
opts,
|
opts,
|
||||||
&read_body_chunk_block
|
&read_body_chunk_block
|
||||||
)
|
)
|
||||||
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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
# A quote models prices and services for a customer.
|
# A quote models prices and services for a customer.
|
||||||
def self.update(id, params = {}, opts = {})
|
def self.update(id, params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
|
43
lib/stripe/resources/quote_preview_invoice.rb
Normal file
43
lib/stripe/resources/quote_preview_invoice.rb
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# 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
|
||||||
|
OBJECT_NAME = "quote_preview_invoice"
|
||||||
|
def self.object_name
|
||||||
|
"quote_preview_invoice"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
11
lib/stripe/resources/quote_preview_subscription_schedule.rb
Normal file
11
lib/stripe/resources/quote_preview_subscription_schedule.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class QuotePreviewSubscriptionSchedule < APIResource
|
||||||
|
OBJECT_NAME = "quote_preview_subscription_schedule"
|
||||||
|
def self.object_name
|
||||||
|
"quote_preview_subscription_schedule"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -70,8 +70,9 @@ module Stripe
|
|||||||
|
|
||||||
url = "#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
|
url = "#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
|
||||||
"/#{CGI.escape(id)}"
|
"/#{CGI.escape(id)}"
|
||||||
resp, opts = execute_resource_request(:delete, url, params, opts)
|
opts = Util.normalize_opts(opts)
|
||||||
initialize_from(resp.data, opts)
|
APIRequestor.active_requestor.execute_request_initialize_from(:delete, url, :api, self,
|
||||||
|
params: params, opts: opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_transactions(params = {}, opts = {})
|
def source_transactions(params = {}, opts = {})
|
||||||
|
@ -16,11 +16,11 @@ module Stripe
|
|||||||
"subscription"
|
"subscription"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Cancels a customer's subscription immediately. The customer will not be charged again for the subscription.
|
# Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata).
|
||||||
#
|
#
|
||||||
# Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
|
# Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed.
|
||||||
#
|
#
|
||||||
# By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
|
# By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
|
||||||
def cancel(params = {}, opts = {})
|
def cancel(params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
method: :delete,
|
method: :delete,
|
||||||
@ -30,11 +30,11 @@ module Stripe
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Cancels a customer's subscription immediately. The customer will not be charged again for the subscription.
|
# Cancels a customer's subscription immediately. The customer won't be charged again for the subscription. After it's canceled, you can no longer update the subscription or its [metadata](https://stripe.com/metadata).
|
||||||
#
|
#
|
||||||
# Note, however, that any pending invoice items that you've created will still be charged for at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations will also be left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations will be removed.
|
# Any pending invoice items that you've created are still charged at the end of the period, unless manually [deleted](https://stripe.com/docs/api#delete_invoiceitem). If you've set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period. But if the subscription is set to cancel immediately, pending prorations are removed.
|
||||||
#
|
#
|
||||||
# By default, upon subscription cancellation, Stripe will stop automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
|
# By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
|
||||||
def self.cancel(subscription_exposed_id, params = {}, opts = {})
|
def self.cancel(subscription_exposed_id, params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
method: :delete,
|
method: :delete,
|
||||||
|
@ -15,6 +15,26 @@ module Stripe
|
|||||||
"subscription_schedule"
|
"subscription_schedule"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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 cancel(params = {}, opts = {})
|
def cancel(params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
|
24
lib/stripe/resources/tax/association.rb
Normal file
24
lib/stripe/resources/tax/association.rb
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Tax
|
||||||
|
# A Tax Association exposes the Tax Transactions that Stripe attempted to create on your behalf based on the PaymentIntent input
|
||||||
|
class Association < APIResource
|
||||||
|
OBJECT_NAME = "tax.association"
|
||||||
|
def self.object_name
|
||||||
|
"tax.association"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Finds a tax association object by PaymentIntent id.
|
||||||
|
def self.find(params = {}, opts = {})
|
||||||
|
request_stripe_object(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/tax/associations/find",
|
||||||
|
params: params,
|
||||||
|
opts: opts
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
49
lib/stripe/resources/tax/form.rb
Normal file
49
lib/stripe/resources/tax/form.rb
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# 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"
|
||||||
|
def self.object_name
|
||||||
|
"tax.form"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of tax forms which were previously created. The tax forms are returned in sorted order, with the oldest tax forms appearing first.
|
||||||
|
def self.list(filters = {}, opts = {})
|
||||||
|
request_stripe_object(method: :get, path: "/v1/tax/forms", params: filters, opts: opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Download the PDF for a tax form.
|
||||||
|
def pdf(params = {}, opts = {}, &read_body_chunk_block)
|
||||||
|
opts = { api_base: APIRequestor.active_requestor.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,
|
||||||
|
base_address: :files,
|
||||||
|
&read_body_chunk_block
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Download the PDF for a tax form.
|
||||||
|
def self.pdf(id, params = {}, opts = {}, &read_body_chunk_block)
|
||||||
|
opts = { api_base: APIRequestor.active_requestor.config.uploads_base }.merge(opts)
|
||||||
|
execute_resource_request_stream(
|
||||||
|
:get,
|
||||||
|
format("/v1/tax/forms/%<id>s/pdf", { id: CGI.escape(id) }),
|
||||||
|
:files,
|
||||||
|
params,
|
||||||
|
opts,
|
||||||
|
&read_body_chunk_block
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -37,6 +37,66 @@ 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 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 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
|
||||||
|
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
# Creates a new Reader object.
|
# Creates a new Reader object.
|
||||||
def self.create(params = {}, opts = {})
|
def self.create(params = {}, opts = {})
|
||||||
request_stripe_object(
|
request_stripe_object(
|
||||||
|
14
lib/stripe/resources/terminal/reader_collected_data.rb
Normal file
14
lib/stripe/resources/terminal/reader_collected_data.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Terminal
|
||||||
|
# Returns data collected by Terminal readers. This data is only stored for 24 hours.
|
||||||
|
class ReaderCollectedData < APIResource
|
||||||
|
OBJECT_NAME = "terminal.reader_collected_data"
|
||||||
|
def self.object_name
|
||||||
|
"terminal.reader_collected_data"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
lib/stripe/resources/v2/billing/meter_event.rb
Normal file
16
lib/stripe/resources/v2/billing/meter_event.rb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module V2
|
||||||
|
module Billing
|
||||||
|
# Fix me empty_doc_string.
|
||||||
|
class MeterEvent < APIResource
|
||||||
|
OBJECT_NAME = "billing.meter_event"
|
||||||
|
def self.object_name
|
||||||
|
"billing.meter_event"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
15
lib/stripe/resources/v2/billing/meter_event_adjustment.rb
Normal file
15
lib/stripe/resources/v2/billing/meter_event_adjustment.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module V2
|
||||||
|
module Billing
|
||||||
|
class MeterEventAdjustment < APIResource
|
||||||
|
OBJECT_NAME = "billing.meter_event_adjustment"
|
||||||
|
def self.object_name
|
||||||
|
"billing.meter_event_adjustment"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
15
lib/stripe/resources/v2/billing/meter_event_session.rb
Normal file
15
lib/stripe/resources/v2/billing/meter_event_session.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module V2
|
||||||
|
module Billing
|
||||||
|
class MeterEventSession < APIResource
|
||||||
|
OBJECT_NAME = "billing.meter_event_session"
|
||||||
|
def self.object_name
|
||||||
|
"billing.meter_event_session"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/stripe/resources/v2/event.rb
Normal file
13
lib/stripe/resources/v2/event.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module V2
|
||||||
|
class Event < APIResource
|
||||||
|
OBJECT_NAME = "v2.core.event"
|
||||||
|
def self.object_name
|
||||||
|
"v2.core.event"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -20,7 +20,7 @@ module Stripe
|
|||||||
# that there isn't a next page in order to replicate the behavior of the API
|
# that there isn't a next page in order to replicate the behavior of the API
|
||||||
# when it attempts to return a page beyond the last.
|
# when it attempts to return a page beyond the last.
|
||||||
def self.empty_search_result(opts = {})
|
def self.empty_search_result(opts = {})
|
||||||
SearchResultObject.construct_from({ data: [] }, opts)
|
SearchResultObject.construct_from({ data: [] }, opts, :v1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
|
203
lib/stripe/services.rb
Normal file
203
lib/stripe/services.rb
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "stripe/services/account_capability_service"
|
||||||
|
require "stripe/services/account_external_account_service"
|
||||||
|
require "stripe/services/account_link_service"
|
||||||
|
require "stripe/services/account_login_link_service"
|
||||||
|
require "stripe/services/account_notice_service"
|
||||||
|
require "stripe/services/account_person_service"
|
||||||
|
require "stripe/services/account_service"
|
||||||
|
require "stripe/services/account_session_service"
|
||||||
|
require "stripe/services/apple_pay_domain_service"
|
||||||
|
require "stripe/services/application_fee_refund_service"
|
||||||
|
require "stripe/services/application_fee_service"
|
||||||
|
require "stripe/services/apps/secret_service"
|
||||||
|
require "stripe/services/apps_service"
|
||||||
|
require "stripe/services/balance_service"
|
||||||
|
require "stripe/services/balance_transaction_service"
|
||||||
|
require "stripe/services/billing/alert_service"
|
||||||
|
require "stripe/services/billing/credit_balance_summary_service"
|
||||||
|
require "stripe/services/billing/credit_balance_transaction_service"
|
||||||
|
require "stripe/services/billing/credit_grant_service"
|
||||||
|
require "stripe/services/billing/meter_event_adjustment_service"
|
||||||
|
require "stripe/services/billing/meter_event_service"
|
||||||
|
require "stripe/services/billing/meter_event_summary_service"
|
||||||
|
require "stripe/services/billing/meter_service"
|
||||||
|
require "stripe/services/billing_portal/configuration_service"
|
||||||
|
require "stripe/services/billing_portal/session_service"
|
||||||
|
require "stripe/services/billing_portal_service"
|
||||||
|
require "stripe/services/billing_service"
|
||||||
|
require "stripe/services/capital/financing_offer_service"
|
||||||
|
require "stripe/services/capital/financing_summary_service"
|
||||||
|
require "stripe/services/capital/financing_transaction_service"
|
||||||
|
require "stripe/services/capital_service"
|
||||||
|
require "stripe/services/charge_service"
|
||||||
|
require "stripe/services/checkout/session_line_item_service"
|
||||||
|
require "stripe/services/checkout/session_service"
|
||||||
|
require "stripe/services/checkout_service"
|
||||||
|
require "stripe/services/climate/order_service"
|
||||||
|
require "stripe/services/climate/product_service"
|
||||||
|
require "stripe/services/climate/supplier_service"
|
||||||
|
require "stripe/services/climate_service"
|
||||||
|
require "stripe/services/confirmation_token_service"
|
||||||
|
require "stripe/services/country_spec_service"
|
||||||
|
require "stripe/services/coupon_service"
|
||||||
|
require "stripe/services/credit_note_line_item_service"
|
||||||
|
require "stripe/services/credit_note_preview_lines_service"
|
||||||
|
require "stripe/services/credit_note_service"
|
||||||
|
require "stripe/services/customer_balance_transaction_service"
|
||||||
|
require "stripe/services/customer_cash_balance_service"
|
||||||
|
require "stripe/services/customer_cash_balance_transaction_service"
|
||||||
|
require "stripe/services/customer_funding_instructions_service"
|
||||||
|
require "stripe/services/customer_payment_method_service"
|
||||||
|
require "stripe/services/customer_payment_source_service"
|
||||||
|
require "stripe/services/customer_service"
|
||||||
|
require "stripe/services/customer_session_service"
|
||||||
|
require "stripe/services/customer_tax_id_service"
|
||||||
|
require "stripe/services/dispute_service"
|
||||||
|
require "stripe/services/entitlements/active_entitlement_service"
|
||||||
|
require "stripe/services/entitlements/feature_service"
|
||||||
|
require "stripe/services/entitlements_service"
|
||||||
|
require "stripe/services/ephemeral_key_service"
|
||||||
|
require "stripe/services/event_service"
|
||||||
|
require "stripe/services/exchange_rate_service"
|
||||||
|
require "stripe/services/file_link_service"
|
||||||
|
require "stripe/services/file_service"
|
||||||
|
require "stripe/services/financial_connections/account_inferred_balance_service"
|
||||||
|
require "stripe/services/financial_connections/account_owner_service"
|
||||||
|
require "stripe/services/financial_connections/account_service"
|
||||||
|
require "stripe/services/financial_connections/institution_service"
|
||||||
|
require "stripe/services/financial_connections/session_service"
|
||||||
|
require "stripe/services/financial_connections/transaction_service"
|
||||||
|
require "stripe/services/financial_connections_service"
|
||||||
|
require "stripe/services/forwarding/request_service"
|
||||||
|
require "stripe/services/forwarding_service"
|
||||||
|
require "stripe/services/gift_cards/card_service"
|
||||||
|
require "stripe/services/gift_cards/transaction_service"
|
||||||
|
require "stripe/services/gift_cards_service"
|
||||||
|
require "stripe/services/identity/verification_report_service"
|
||||||
|
require "stripe/services/identity/verification_session_service"
|
||||||
|
require "stripe/services/identity_service"
|
||||||
|
require "stripe/services/invoice_item_service"
|
||||||
|
require "stripe/services/invoice_line_item_service"
|
||||||
|
require "stripe/services/invoice_payment_service"
|
||||||
|
require "stripe/services/invoice_rendering_template_service"
|
||||||
|
require "stripe/services/invoice_service"
|
||||||
|
require "stripe/services/invoice_upcoming_lines_service"
|
||||||
|
require "stripe/services/issuing/authorization_service"
|
||||||
|
require "stripe/services/issuing/card_service"
|
||||||
|
require "stripe/services/issuing/cardholder_service"
|
||||||
|
require "stripe/services/issuing/credit_underwriting_record_service"
|
||||||
|
require "stripe/services/issuing/dispute_service"
|
||||||
|
require "stripe/services/issuing/dispute_settlement_detail_service"
|
||||||
|
require "stripe/services/issuing/personalization_design_service"
|
||||||
|
require "stripe/services/issuing/physical_bundle_service"
|
||||||
|
require "stripe/services/issuing/token_service"
|
||||||
|
require "stripe/services/issuing/transaction_service"
|
||||||
|
require "stripe/services/issuing_service"
|
||||||
|
require "stripe/services/mandate_service"
|
||||||
|
require "stripe/services/margin_service"
|
||||||
|
require "stripe/services/order_line_item_service"
|
||||||
|
require "stripe/services/order_service"
|
||||||
|
require "stripe/services/payment_intent_service"
|
||||||
|
require "stripe/services/payment_link_line_item_service"
|
||||||
|
require "stripe/services/payment_link_service"
|
||||||
|
require "stripe/services/payment_method_configuration_service"
|
||||||
|
require "stripe/services/payment_method_domain_service"
|
||||||
|
require "stripe/services/payment_method_service"
|
||||||
|
require "stripe/services/payout_service"
|
||||||
|
require "stripe/services/plan_service"
|
||||||
|
require "stripe/services/price_service"
|
||||||
|
require "stripe/services/product_feature_service"
|
||||||
|
require "stripe/services/product_service"
|
||||||
|
require "stripe/services/promotion_code_service"
|
||||||
|
require "stripe/services/quote_computed_upfront_line_items_service"
|
||||||
|
require "stripe/services/quote_line_item_service"
|
||||||
|
require "stripe/services/quote_line_service"
|
||||||
|
require "stripe/services/quote_preview_invoice_service"
|
||||||
|
require "stripe/services/quote_preview_subscription_schedule_service"
|
||||||
|
require "stripe/services/quote_service"
|
||||||
|
require "stripe/services/radar/early_fraud_warning_service"
|
||||||
|
require "stripe/services/radar/value_list_item_service"
|
||||||
|
require "stripe/services/radar/value_list_service"
|
||||||
|
require "stripe/services/radar_service"
|
||||||
|
require "stripe/services/refund_service"
|
||||||
|
require "stripe/services/reporting/report_run_service"
|
||||||
|
require "stripe/services/reporting/report_type_service"
|
||||||
|
require "stripe/services/reporting_service"
|
||||||
|
require "stripe/services/review_service"
|
||||||
|
require "stripe/services/setup_attempt_service"
|
||||||
|
require "stripe/services/setup_intent_service"
|
||||||
|
require "stripe/services/shipping_rate_service"
|
||||||
|
require "stripe/services/sigma/scheduled_query_run_service"
|
||||||
|
require "stripe/services/sigma_service"
|
||||||
|
require "stripe/services/source_service"
|
||||||
|
require "stripe/services/source_transaction_service"
|
||||||
|
require "stripe/services/subscription_item_service"
|
||||||
|
require "stripe/services/subscription_item_usage_record_service"
|
||||||
|
require "stripe/services/subscription_item_usage_record_summary_service"
|
||||||
|
require "stripe/services/subscription_schedule_service"
|
||||||
|
require "stripe/services/subscription_service"
|
||||||
|
require "stripe/services/tax/association_service"
|
||||||
|
require "stripe/services/tax/calculation_line_item_service"
|
||||||
|
require "stripe/services/tax/calculation_service"
|
||||||
|
require "stripe/services/tax/form_service"
|
||||||
|
require "stripe/services/tax/registration_service"
|
||||||
|
require "stripe/services/tax/settings_service"
|
||||||
|
require "stripe/services/tax/transaction_line_item_service"
|
||||||
|
require "stripe/services/tax/transaction_service"
|
||||||
|
require "stripe/services/tax_code_service"
|
||||||
|
require "stripe/services/tax_id_service"
|
||||||
|
require "stripe/services/tax_rate_service"
|
||||||
|
require "stripe/services/tax_service"
|
||||||
|
require "stripe/services/terminal/configuration_service"
|
||||||
|
require "stripe/services/terminal/connection_token_service"
|
||||||
|
require "stripe/services/terminal/location_service"
|
||||||
|
require "stripe/services/terminal/reader_collected_data_service"
|
||||||
|
require "stripe/services/terminal/reader_service"
|
||||||
|
require "stripe/services/terminal_service"
|
||||||
|
require "stripe/services/test_helpers/confirmation_token_service"
|
||||||
|
require "stripe/services/test_helpers/customer_service"
|
||||||
|
require "stripe/services/test_helpers/issuing/authorization_service"
|
||||||
|
require "stripe/services/test_helpers/issuing/card_service"
|
||||||
|
require "stripe/services/test_helpers/issuing/personalization_design_service"
|
||||||
|
require "stripe/services/test_helpers/issuing/transaction_service"
|
||||||
|
require "stripe/services/test_helpers/issuing_service"
|
||||||
|
require "stripe/services/test_helpers/refund_service"
|
||||||
|
require "stripe/services/test_helpers/terminal/reader_service"
|
||||||
|
require "stripe/services/test_helpers/terminal_service"
|
||||||
|
require "stripe/services/test_helpers/test_clock_service"
|
||||||
|
require "stripe/services/test_helpers/treasury/inbound_transfer_service"
|
||||||
|
require "stripe/services/test_helpers/treasury/outbound_payment_service"
|
||||||
|
require "stripe/services/test_helpers/treasury/outbound_transfer_service"
|
||||||
|
require "stripe/services/test_helpers/treasury/received_credit_service"
|
||||||
|
require "stripe/services/test_helpers/treasury/received_debit_service"
|
||||||
|
require "stripe/services/test_helpers/treasury_service"
|
||||||
|
require "stripe/services/test_helpers_service"
|
||||||
|
require "stripe/services/token_service"
|
||||||
|
require "stripe/services/topup_service"
|
||||||
|
require "stripe/services/transfer_reversal_service"
|
||||||
|
require "stripe/services/transfer_service"
|
||||||
|
require "stripe/services/treasury/credit_reversal_service"
|
||||||
|
require "stripe/services/treasury/debit_reversal_service"
|
||||||
|
require "stripe/services/treasury/financial_account_features_service"
|
||||||
|
require "stripe/services/treasury/financial_account_service"
|
||||||
|
require "stripe/services/treasury/inbound_transfer_service"
|
||||||
|
require "stripe/services/treasury/outbound_payment_service"
|
||||||
|
require "stripe/services/treasury/outbound_transfer_service"
|
||||||
|
require "stripe/services/treasury/received_credit_service"
|
||||||
|
require "stripe/services/treasury/received_debit_service"
|
||||||
|
require "stripe/services/treasury/transaction_entry_service"
|
||||||
|
require "stripe/services/treasury/transaction_service"
|
||||||
|
require "stripe/services/treasury_service"
|
||||||
|
require "stripe/services/v1_services"
|
||||||
|
require "stripe/services/v2/billing/meter_event_adjustment_service"
|
||||||
|
require "stripe/services/v2/billing/meter_event_service"
|
||||||
|
require "stripe/services/v2/billing/meter_event_session_service"
|
||||||
|
require "stripe/services/v2/billing/meter_event_stream_service"
|
||||||
|
require "stripe/services/v2/billing_service"
|
||||||
|
require "stripe/services/v2/core/event_service"
|
||||||
|
require "stripe/services/v2/core_service"
|
||||||
|
require "stripe/services/v2_services"
|
||||||
|
require "stripe/services/webhook_endpoint_service"
|
39
lib/stripe/services/account_capability_service.rb
Normal file
39
lib/stripe/services/account_capability_service.rb
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AccountCapabilityService < StripeService
|
||||||
|
# Returns a list of capabilities associated with the account. The capabilities are returned sorted by creation date, with the most recent capability appearing first.
|
||||||
|
def list(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/accounts/%<account>s/capabilities", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves information about the specified Account Capability.
|
||||||
|
def retrieve(account, capability, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/accounts/%<account>s/capabilities/%<capability>s", { account: CGI.escape(account), capability: CGI.escape(capability) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates an existing Account Capability. Request or remove a capability by updating its requested parameter.
|
||||||
|
def update(account, capability, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/accounts/%<account>s/capabilities/%<capability>s", { account: CGI.escape(account), capability: CGI.escape(capability) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
68
lib/stripe/services/account_external_account_service.rb
Normal file
68
lib/stripe/services/account_external_account_service.rb
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AccountExternalAccountService < StripeService
|
||||||
|
# Create an external account for a given account.
|
||||||
|
def create(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/accounts/%<account>s/external_accounts", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Delete a specified external account for a given account.
|
||||||
|
def delete(account, id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :delete,
|
||||||
|
path: format("/v1/accounts/%<account>s/external_accounts/%<id>s", { account: CGI.escape(account), id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# List external accounts for an account.
|
||||||
|
def list(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/accounts/%<account>s/external_accounts", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieve a specified external account for a given account.
|
||||||
|
def retrieve(account, id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/accounts/%<account>s/external_accounts/%<id>s", { account: CGI.escape(account), id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates the metadata, account holder name, account holder type of a bank account belonging to
|
||||||
|
# a connected account and optionally sets it as the default for its currency. Other bank account
|
||||||
|
# details are not editable by design.
|
||||||
|
#
|
||||||
|
# You can only update bank accounts when [account.controller.requirement_collection is application, which includes <a href="/connect/custom-accounts">Custom accounts](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection).
|
||||||
|
#
|
||||||
|
# You can re-enable a disabled bank account by performing an update call without providing any
|
||||||
|
# arguments or changes.
|
||||||
|
def update(account, id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/accounts/%<account>s/external_accounts/%<id>s", { account: CGI.escape(account), id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
17
lib/stripe/services/account_link_service.rb
Normal file
17
lib/stripe/services/account_link_service.rb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AccountLinkService < StripeService
|
||||||
|
# Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow.
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/account_links",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
19
lib/stripe/services/account_login_link_service.rb
Normal file
19
lib/stripe/services/account_login_link_service.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AccountLoginLinkService < StripeService
|
||||||
|
# Creates a single-use login link for a connected account to access the Express Dashboard.
|
||||||
|
#
|
||||||
|
# You can only create login links for accounts that use the [Express Dashboard](https://stripe.com/connect/express-dashboard) and are connected to your platform.
|
||||||
|
def create(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/accounts/%<account>s/login_links", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
39
lib/stripe/services/account_notice_service.rb
Normal file
39
lib/stripe/services/account_notice_service.rb
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AccountNoticeService < StripeService
|
||||||
|
# Retrieves a list of AccountNotice objects. The objects are sorted in descending order by creation date, with the most-recently-created object appearing first.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/account_notices",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves an AccountNotice object.
|
||||||
|
def retrieve(account_notice, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/account_notices/%<account_notice>s", { account_notice: CGI.escape(account_notice) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates an AccountNotice object.
|
||||||
|
def update(account_notice, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/account_notices/%<account_notice>s", { account_notice: CGI.escape(account_notice) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
61
lib/stripe/services/account_person_service.rb
Normal file
61
lib/stripe/services/account_person_service.rb
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AccountPersonService < StripeService
|
||||||
|
# Creates a new person.
|
||||||
|
def create(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deletes an existing person's relationship to the account's legal entity. Any person with a relationship for an account can be deleted through the API, except if the person is the account_opener. If your integration is using the executive parameter, you cannot delete the only verified executive on file.
|
||||||
|
def delete(account, person, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :delete,
|
||||||
|
path: format("/v1/accounts/%<account>s/persons/%<person>s", { account: CGI.escape(account), person: CGI.escape(person) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
|
||||||
|
def list(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves an existing person.
|
||||||
|
def retrieve(account, person, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/accounts/%<account>s/persons/%<person>s", { account: CGI.escape(account), person: CGI.escape(person) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates an existing person.
|
||||||
|
def update(account, person, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/accounts/%<account>s/persons/%<person>s", { account: CGI.escape(account), person: CGI.escape(person) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
100
lib/stripe/services/account_service.rb
Normal file
100
lib/stripe/services/account_service.rb
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AccountService < StripeService
|
||||||
|
attr_reader :capabilities, :external_accounts, :login_links, :persons
|
||||||
|
|
||||||
|
def initialize(requestor)
|
||||||
|
super(requestor)
|
||||||
|
@capabilities = Stripe::AccountCapabilityService.new(@requestor)
|
||||||
|
@external_accounts = Stripe::AccountExternalAccountService.new(@requestor)
|
||||||
|
@login_links = Stripe::AccountLoginLinkService.new(@requestor)
|
||||||
|
@persons = Stripe::AccountPersonService.new(@requestor)
|
||||||
|
end
|
||||||
|
|
||||||
|
# With [Connect](https://stripe.com/docs/connect), you can create Stripe accounts for your users.
|
||||||
|
# To do this, you'll first need to [register your platform](https://dashboard.stripe.com/account/applications/settings).
|
||||||
|
#
|
||||||
|
# If you've already collected information for your connected accounts, you [can prefill that information](https://stripe.com/docs/connect/best-practices#onboarding) when
|
||||||
|
# creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding.
|
||||||
|
# You can prefill any information on the account.
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(method: :post, path: "/v1/accounts", params: params, opts: opts, base_address: :api)
|
||||||
|
end
|
||||||
|
|
||||||
|
# With [Connect](https://stripe.com/connect), you can delete accounts you manage.
|
||||||
|
#
|
||||||
|
# Test-mode accounts can be deleted at any time.
|
||||||
|
#
|
||||||
|
# Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balance_object) are zero.
|
||||||
|
#
|
||||||
|
# If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead.
|
||||||
|
def delete(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :delete,
|
||||||
|
path: format("/v1/accounts/%<account>s", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). If you're not a platform, the list is empty.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(method: :get, path: "/v1/accounts", params: params, opts: opts, base_address: :api)
|
||||||
|
end
|
||||||
|
|
||||||
|
# With [Connect](https://stripe.com/connect), you can reject accounts that you have flagged as suspicious.
|
||||||
|
#
|
||||||
|
# Only accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be rejected. Test-mode accounts can be rejected at any time. Live-mode accounts can only be rejected after all balances are zero.
|
||||||
|
def reject(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves the details of an account.
|
||||||
|
def retrieve(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/accounts/%<account>s", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves the details of an account.
|
||||||
|
def retrieve_current(params = {}, opts = {})
|
||||||
|
request(method: :get, path: "/v1/account", params: params, opts: opts, base_address: :api)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates a [connected account](https://stripe.com/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are
|
||||||
|
# left unchanged.
|
||||||
|
#
|
||||||
|
# For accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
||||||
|
# is application, which includes Custom accounts, you can update any information on the account.
|
||||||
|
#
|
||||||
|
# For accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection)
|
||||||
|
# is stripe, which includes Standard and Express accounts, you can update all information until you create
|
||||||
|
# an [Account Link or <a href="/api/account_sessions">Account Session](https://stripe.com/api/account_links) to start Connect onboarding,
|
||||||
|
# after which some properties can no longer be updated.
|
||||||
|
#
|
||||||
|
# To update your own account, use the [Dashboard](https://dashboard.stripe.com/settings/account). Refer to our
|
||||||
|
# [Connect](https://stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.
|
||||||
|
def update(account, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/accounts/%<account>s", { account: CGI.escape(account) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
17
lib/stripe/services/account_session_service.rb
Normal file
17
lib/stripe/services/account_session_service.rb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AccountSessionService < StripeService
|
||||||
|
# Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/account_sessions",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
50
lib/stripe/services/apple_pay_domain_service.rb
Normal file
50
lib/stripe/services/apple_pay_domain_service.rb
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class ApplePayDomainService < StripeService
|
||||||
|
# Create an apple pay domain.
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/apple_pay/domains",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Delete an apple pay domain.
|
||||||
|
def delete(domain, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :delete,
|
||||||
|
path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(domain) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# List apple pay domains.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/apple_pay/domains",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieve an apple pay domain.
|
||||||
|
def retrieve(domain, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(domain) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
60
lib/stripe/services/application_fee_refund_service.rb
Normal file
60
lib/stripe/services/application_fee_refund_service.rb
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class ApplicationFeeRefundService < StripeService
|
||||||
|
# Refunds an application fee that has previously been collected but not yet refunded.
|
||||||
|
# Funds will be refunded to the Stripe account from which the fee was originally collected.
|
||||||
|
#
|
||||||
|
# You can optionally refund only part of an application fee.
|
||||||
|
# You can do so multiple times, until the entire fee has been refunded.
|
||||||
|
#
|
||||||
|
# Once entirely refunded, an application fee can't be refunded again.
|
||||||
|
# This method will raise an error when called on an already-refunded application fee,
|
||||||
|
# or when trying to refund more money than is left on an application fee.
|
||||||
|
def create(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/application_fees/%<id>s/refunds", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds.
|
||||||
|
def list(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/application_fees/%<id>s/refunds", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# By default, you can see the 10 most recent refunds stored directly on the application fee object, but you can also retrieve details about a specific refund stored on the application fee.
|
||||||
|
def retrieve(fee, id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/application_fees/%<fee>s/refunds/%<id>s", { fee: CGI.escape(fee), id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates the specified application fee refund by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
||||||
|
#
|
||||||
|
# This request only accepts metadata as an argument.
|
||||||
|
def update(fee, id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/application_fees/%<fee>s/refunds/%<id>s", { fee: CGI.escape(fee), id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
35
lib/stripe/services/application_fee_service.rb
Normal file
35
lib/stripe/services/application_fee_service.rb
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class ApplicationFeeService < StripeService
|
||||||
|
attr_reader :refunds
|
||||||
|
|
||||||
|
def initialize(requestor)
|
||||||
|
super(requestor)
|
||||||
|
@refunds = Stripe::ApplicationFeeRefundService.new(@requestor)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of application fees you've previously collected. The application fees are returned in sorted order, with the most recent fees appearing first.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/application_fees",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves the details of an application fee that your account has collected. The same information is returned when refunding the application fee.
|
||||||
|
def retrieve(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/application_fees/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
52
lib/stripe/services/apps/secret_service.rb
Normal file
52
lib/stripe/services/apps/secret_service.rb
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Apps
|
||||||
|
class SecretService < StripeService
|
||||||
|
# Create or replace a secret in the secret store.
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/apps/secrets",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deletes a secret from the secret store by name and scope.
|
||||||
|
def delete_where(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/apps/secrets/delete",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Finds a secret in the secret store by name and scope.
|
||||||
|
def find(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/apps/secrets/find",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# List all secrets stored on the given scope.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/apps/secrets",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/stripe/services/apps_service.rb
Normal file
13
lib/stripe/services/apps_service.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class AppsService < StripeService
|
||||||
|
attr_reader :secrets
|
||||||
|
|
||||||
|
def initialize(requestor)
|
||||||
|
super(requestor)
|
||||||
|
@secrets = Stripe::Apps::SecretService.new(@requestor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
lib/stripe/services/balance_service.rb
Normal file
12
lib/stripe/services/balance_service.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class BalanceService < StripeService
|
||||||
|
# Retrieves the current account balance, based on the authentication that was used to make the request.
|
||||||
|
# For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances).
|
||||||
|
def retrieve(params = {}, opts = {})
|
||||||
|
request(method: :get, path: "/v1/balance", params: params, opts: opts, base_address: :api)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
32
lib/stripe/services/balance_transaction_service.rb
Normal file
32
lib/stripe/services/balance_transaction_service.rb
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class BalanceTransactionService < StripeService
|
||||||
|
# Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first.
|
||||||
|
#
|
||||||
|
# Note that this endpoint was previously called “Balance history” and used the path /v1/balance/history.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/balance_transactions",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves the balance transaction with the given ID.
|
||||||
|
#
|
||||||
|
# Note that this endpoint previously used the path /v1/balance/history/:id.
|
||||||
|
def retrieve(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/balance_transactions/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
74
lib/stripe/services/billing/alert_service.rb
Normal file
74
lib/stripe/services/billing/alert_service.rb
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
class AlertService < StripeService
|
||||||
|
# Reactivates this alert, allowing it to trigger again.
|
||||||
|
def activate(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Archives this alert, removing it from the list view and APIs. This is non-reversible.
|
||||||
|
def archive(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Creates a billing alert
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/billing/alerts",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deactivates this alert, preventing it from triggering.
|
||||||
|
def deactivate(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Lists billing active and inactive alerts
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/billing/alerts",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves a billing alert given an ID
|
||||||
|
def retrieve(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/billing/alerts/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,19 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
class CreditBalanceSummaryService < StripeService
|
||||||
|
# Retrieves the credit balance summary for a customer
|
||||||
|
def retrieve(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/billing/credit_balance_summary",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,30 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
class CreditBalanceTransactionService < StripeService
|
||||||
|
# Retrieve a list of credit balance transactions
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/billing/credit_balance_transactions",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves a credit balance transaction
|
||||||
|
def retrieve(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/billing/credit_balance_transactions/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
74
lib/stripe/services/billing/credit_grant_service.rb
Normal file
74
lib/stripe/services/billing/credit_grant_service.rb
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
class CreditGrantService < StripeService
|
||||||
|
# Creates a credit grant
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/billing/credit_grants",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Expires a credit grant
|
||||||
|
def expire(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieve a list of credit grants
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/billing/credit_grants",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves a credit grant
|
||||||
|
def retrieve(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates a credit grant
|
||||||
|
def update(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Voids a credit grant
|
||||||
|
def void_grant(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,19 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
class MeterEventAdjustmentService < StripeService
|
||||||
|
# Creates a billing meter event adjustment
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/billing/meter_event_adjustments",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
19
lib/stripe/services/billing/meter_event_service.rb
Normal file
19
lib/stripe/services/billing/meter_event_service.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
class MeterEventService < StripeService
|
||||||
|
# Creates a billing meter event
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/billing/meter_events",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
19
lib/stripe/services/billing/meter_event_summary_service.rb
Normal file
19
lib/stripe/services/billing/meter_event_summary_service.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
class MeterEventSummaryService < StripeService
|
||||||
|
# Retrieve a list of billing meter event summaries.
|
||||||
|
def list(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/billing/meters/%<id>s/event_summaries", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
81
lib/stripe/services/billing/meter_service.rb
Normal file
81
lib/stripe/services/billing/meter_service.rb
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Billing
|
||||||
|
class MeterService < StripeService
|
||||||
|
attr_reader :event_summaries
|
||||||
|
|
||||||
|
def initialize(requestor)
|
||||||
|
super(requestor)
|
||||||
|
@event_summaries = Stripe::Billing::MeterEventSummaryService.new(@requestor)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Creates a billing meter
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/billing/meters",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Deactivates a billing meter
|
||||||
|
def deactivate(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/meters/%<id>s/deactivate", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieve a list of billing meters.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/billing/meters",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Reactivates a billing meter
|
||||||
|
def reactivate(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/meters/%<id>s/reactivate", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves a billing meter given an ID
|
||||||
|
def retrieve(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/billing/meters/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates a billing meter
|
||||||
|
def update(id, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing/meters/%<id>s", { id: CGI.escape(id) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
52
lib/stripe/services/billing_portal/configuration_service.rb
Normal file
52
lib/stripe/services/billing_portal/configuration_service.rb
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module BillingPortal
|
||||||
|
class ConfigurationService < StripeService
|
||||||
|
# Creates a configuration that describes the functionality and behavior of a PortalSession
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/billing_portal/configurations",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of configurations that describe the functionality of the customer portal.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/billing_portal/configurations",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves a configuration that describes the functionality of the customer portal.
|
||||||
|
def retrieve(configuration, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/billing_portal/configurations/%<configuration>s", { configuration: CGI.escape(configuration) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates a configuration that describes the functionality of the customer portal.
|
||||||
|
def update(configuration, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/billing_portal/configurations/%<configuration>s", { configuration: CGI.escape(configuration) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
19
lib/stripe/services/billing_portal/session_service.rb
Normal file
19
lib/stripe/services/billing_portal/session_service.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module BillingPortal
|
||||||
|
class SessionService < StripeService
|
||||||
|
# Creates a session of the customer portal.
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: "/v1/billing_portal/sessions",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
14
lib/stripe/services/billing_portal_service.rb
Normal file
14
lib/stripe/services/billing_portal_service.rb
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class BillingPortalService < StripeService
|
||||||
|
attr_reader :configurations, :sessions
|
||||||
|
|
||||||
|
def initialize(requestor)
|
||||||
|
super(requestor)
|
||||||
|
@configurations = Stripe::BillingPortal::ConfigurationService.new(@requestor)
|
||||||
|
@sessions = Stripe::BillingPortal::SessionService.new(@requestor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
20
lib/stripe/services/billing_service.rb
Normal file
20
lib/stripe/services/billing_service.rb
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class BillingService < StripeService
|
||||||
|
attr_reader :alerts, :credit_balance_summary, :credit_balance_transactions, :credit_grants, :meters, :meter_events, :meter_event_adjustments
|
||||||
|
|
||||||
|
def initialize(requestor)
|
||||||
|
super(requestor)
|
||||||
|
@alerts = Stripe::Billing::AlertService.new(@requestor)
|
||||||
|
@credit_balance_summary = Stripe::Billing::CreditBalanceSummaryService.new(@requestor)
|
||||||
|
@credit_balance_transactions = Stripe::Billing::CreditBalanceTransactionService
|
||||||
|
.new(@requestor)
|
||||||
|
@credit_grants = Stripe::Billing::CreditGrantService.new(@requestor)
|
||||||
|
@meters = Stripe::Billing::MeterService.new(@requestor)
|
||||||
|
@meter_events = Stripe::Billing::MeterEventService.new(@requestor)
|
||||||
|
@meter_event_adjustments = Stripe::Billing::MeterEventAdjustmentService.new(@requestor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
42
lib/stripe/services/capital/financing_offer_service.rb
Normal file
42
lib/stripe/services/capital/financing_offer_service.rb
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Capital
|
||||||
|
class FinancingOfferService < StripeService
|
||||||
|
# Retrieves the financing offers available for Connected accounts that belong to your platform.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/capital/financing_offers",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Acknowledges that platform has received and delivered the financing_offer to
|
||||||
|
# the intended merchant recipient.
|
||||||
|
def mark_delivered(financing_offer, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/capital/financing_offers/%<financing_offer>s/mark_delivered", { financing_offer: CGI.escape(financing_offer) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get the details of the financing offer
|
||||||
|
def retrieve(financing_offer, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/capital/financing_offers/%<financing_offer>s", { financing_offer: CGI.escape(financing_offer) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
19
lib/stripe/services/capital/financing_summary_service.rb
Normal file
19
lib/stripe/services/capital/financing_summary_service.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Capital
|
||||||
|
class FinancingSummaryService < StripeService
|
||||||
|
# Retrieve the financing state for the account that was authenticated in the request.
|
||||||
|
def retrieve(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/capital/financing_summary",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
31
lib/stripe/services/capital/financing_transaction_service.rb
Normal file
31
lib/stripe/services/capital/financing_transaction_service.rb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Capital
|
||||||
|
class FinancingTransactionService < StripeService
|
||||||
|
# Returns a list of financing transactions. The transactions are returned in sorted order,
|
||||||
|
# with the most recent transactions appearing first.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/capital/financing_transactions",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves a financing transaction for a financing offer.
|
||||||
|
def retrieve(financing_transaction, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/capital/financing_transactions/%<financing_transaction>s", { financing_transaction: CGI.escape(financing_transaction) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
15
lib/stripe/services/capital_service.rb
Normal file
15
lib/stripe/services/capital_service.rb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class CapitalService < StripeService
|
||||||
|
attr_reader :financing_offers, :financing_summary, :financing_transactions
|
||||||
|
|
||||||
|
def initialize(requestor)
|
||||||
|
super(requestor)
|
||||||
|
@financing_offers = Stripe::Capital::FinancingOfferService.new(@requestor)
|
||||||
|
@financing_summary = Stripe::Capital::FinancingSummaryService.new(@requestor)
|
||||||
|
@financing_transactions = Stripe::Capital::FinancingTransactionService.new(@requestor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
69
lib/stripe/services/charge_service.rb
Normal file
69
lib/stripe/services/charge_service.rb
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
class ChargeService < StripeService
|
||||||
|
# Capture the payment of an existing, uncaptured charge that was created with the capture option set to false.
|
||||||
|
#
|
||||||
|
# Uncaptured payments expire a set number of days after they are created ([7 by default](https://stripe.com/docs/charges/placing-a-hold)), after which they are marked as refunded and capture attempts will fail.
|
||||||
|
#
|
||||||
|
# Don't use this method to capture a PaymentIntent-initiated charge. Use [Capture a PaymentIntent](https://stripe.com/docs/api/payment_intents/capture).
|
||||||
|
def capture(charge, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/charges/%<charge>s/capture", { charge: CGI.escape(charge) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# This method is no longer recommended—use the [Payment Intents API](https://stripe.com/docs/api/payment_intents)
|
||||||
|
# to initiate a new payment instead. Confirmation of the PaymentIntent creates the Charge
|
||||||
|
# object used to request payment.
|
||||||
|
def create(params = {}, opts = {})
|
||||||
|
request(method: :post, path: "/v1/charges", params: params, opts: opts, base_address: :api)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns a list of charges you've previously created. The charges are returned in sorted order, with the most recent charges appearing first.
|
||||||
|
def list(params = {}, opts = {})
|
||||||
|
request(method: :get, path: "/v1/charges", params: params, opts: opts, base_address: :api)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Retrieves the details of a charge that has previously been created. Supply the unique charge ID that was returned from your previous request, and Stripe will return the corresponding charge information. The same information is returned when creating or refunding the charge.
|
||||||
|
def retrieve(charge, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/charges/%<charge>s", { charge: CGI.escape(charge) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Search for charges you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
|
||||||
|
# Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
|
||||||
|
# conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
|
||||||
|
# to an hour behind during outages. Search functionality is not available to merchants in India.
|
||||||
|
def search(params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: "/v1/charges/search",
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Updates the specified charge by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
|
||||||
|
def update(charge, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :post,
|
||||||
|
path: format("/v1/charges/%<charge>s", { charge: CGI.escape(charge) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
19
lib/stripe/services/checkout/session_line_item_service.rb
Normal file
19
lib/stripe/services/checkout/session_line_item_service.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# File generated from our OpenAPI spec
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Checkout
|
||||||
|
class SessionLineItemService < StripeService
|
||||||
|
# When retrieving a Checkout Session, 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(session, params = {}, opts = {})
|
||||||
|
request(
|
||||||
|
method: :get,
|
||||||
|
path: format("/v1/checkout/sessions/%<session>s/line_items", { session: CGI.escape(session) }),
|
||||||
|
params: params,
|
||||||
|
opts: opts,
|
||||||
|
base_address: :api
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user