mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-06-23 00:00:29 -04:00
Compare commits
1926 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
da9f0e07e4 | ||
|
4367ac9511 | ||
|
d911399f81 | ||
|
51e8e3264f | ||
|
655385565f | ||
|
c3f9f45509 | ||
|
6a2a9dca26 | ||
|
a89df859de | ||
|
74a5d1d5b9 | ||
|
ff7e4451a4 | ||
|
22ba74e4a6 | ||
|
6c90c710d8 | ||
|
cdce6c3f56 | ||
|
1a0c78f112 | ||
|
88c8720712 | ||
|
b9d00e2ffa | ||
|
ca00b676f0 | ||
|
36547afd0f | ||
|
b8587ac65a | ||
|
25b6974852 | ||
|
10006bf668 | ||
|
6d34376960 | ||
|
5b68a44889 | ||
|
fdb39ed488 | ||
|
04f8d1b43a | ||
|
182d4dc838 | ||
|
5ce725ae22 | ||
|
72476176b1 | ||
|
dc5174725f | ||
|
91626d37e8 | ||
|
80fb92246d | ||
|
cdbade3e57 | ||
|
72c36f9500 | ||
|
a27751d19f | ||
|
0c4238708f | ||
|
88f3e698e3 | ||
|
2a81d44236 | ||
|
d7e4457373 | ||
|
43bbf6f528 | ||
|
9d2bacd8d2 | ||
|
f2b4c22804 | ||
|
d146769ae5 | ||
|
0cb23f6540 | ||
|
5304640303 | ||
|
b03b022d70 | ||
|
08020d3207 | ||
|
ef7e6ee51e | ||
|
57dd25a8d7 | ||
|
6e3950536a | ||
|
36b1c7c8f0 | ||
|
da19166173 | ||
|
7227c8873b | ||
|
332e009a57 | ||
|
d2c09c3b50 | ||
|
8aec85f636 | ||
|
68f806e454 | ||
|
7c7f431838 | ||
|
7ddf16d170 | ||
|
56b9950250 | ||
|
c4d0746d87 | ||
|
75c8c3835c | ||
|
aa880437dc | ||
|
91c68e4165 | ||
|
e4233f0dbb | ||
|
484f9741c5 | ||
|
fb11d83248 | ||
|
4c3593e62e | ||
|
042918c5f8 | ||
|
a2e2881c7c | ||
|
95f4c9d231 | ||
|
79ebfa5c1a | ||
|
540c7f7d88 | ||
|
2a9407b085 | ||
|
39d8736525 | ||
|
07ee576036 | ||
|
37f30b85b2 | ||
|
37b9771584 | ||
|
27d87e91ae | ||
|
8fc981be69 | ||
|
9c2a7b2f44 | ||
|
431140523d | ||
|
b40dc1f264 | ||
|
0dfd04c6f2 | ||
|
cc23e71c72 | ||
|
ec36441d3d | ||
|
6225d34f82 | ||
|
5424da3fff | ||
|
aa49a46b82 | ||
|
816fe0d0c7 | ||
|
9cbc4632df | ||
|
bab5393d6a | ||
|
fa2baeba7a | ||
|
f0c40e0f79 | ||
|
8a5fca9998 | ||
|
856693e948 | ||
|
a0542ff720 | ||
|
ad4d29b4aa | ||
|
6dadabe005 | ||
|
da8d64c580 | ||
|
102b9da798 | ||
|
1994d24765 | ||
|
4bdc4e27d4 | ||
|
29d8128963 | ||
|
64ec8947d5 | ||
|
acdcecf8c5 | ||
|
03a7b9e12c | ||
|
f774da66a7 | ||
|
076a685685 | ||
|
996b7eab0e | ||
|
a42ab44a36 | ||
|
7f2bdfa718 | ||
|
f538d421d2 | ||
|
6e4f40f2a3 | ||
|
a7aadfad4d | ||
|
13ee3322ff | ||
|
da6422f0a0 | ||
|
46cc83fc8a | ||
|
1177f60ece | ||
|
47db6b0adf | ||
|
ad22bab02f | ||
|
3d7b450e5a | ||
|
75d238c563 | ||
|
4287976384 | ||
|
ca318ab00a | ||
|
5eccf34816 | ||
|
c75081f22a | ||
|
93267e38ab | ||
|
2a45f50bd6 | ||
|
ec5152c82e | ||
|
dfea3bdac5 | ||
|
a12ff9cdb8 | ||
|
5eb028cac0 | ||
|
45a650036e | ||
|
357337301c | ||
|
d478ba6679 | ||
|
d2c24ca682 | ||
|
59d3a34000 | ||
|
faa5d4546f | ||
|
3a51dfaba7 | ||
|
ad00c3e621 | ||
|
4705a5f5f9 | ||
|
e2893a274e | ||
|
74294666a2 | ||
|
bfb4e9fff5 | ||
|
0ad6440f44 | ||
|
0e77795607 | ||
|
cb15e14962 | ||
|
8654aa9065 | ||
|
00f2c02ca6 | ||
|
521ab2f97c | ||
|
3b507b4647 | ||
|
6458ba68f4 | ||
|
303d7c3256 | ||
|
425999c80b | ||
|
3e18ad6338 | ||
|
64afe4a398 | ||
|
6664641da0 | ||
|
e3f1a90e79 | ||
|
06d1bfbc9b | ||
|
ce8d7ca4cc | ||
|
bc375b791e | ||
|
0dc3414645 | ||
|
d22938897e | ||
|
b56a9b6c76 | ||
|
32681000bf | ||
|
1bde67fba3 | ||
|
ec0e71ddb0 | ||
|
d356ef6e96 | ||
|
7055e504b1 | ||
|
c7d68d5200 | ||
|
37293f6aba | ||
|
08b00636a5 | ||
|
37fa3c1228 | ||
|
faa9d58a66 | ||
|
2ac9890545 | ||
|
a685a13a67 | ||
|
bc03829f1d | ||
|
871a4c55b0 | ||
|
97bd5abc61 | ||
|
6ff3a7ad3a | ||
|
36dc37db5e | ||
|
8875698b96 | ||
|
de4e1d3b23 | ||
|
c51404d7a2 | ||
|
c46f4a6af1 | ||
|
678757fefc | ||
|
210a1eb8c9 | ||
|
9c7a649a93 | ||
|
7e23610f83 | ||
|
db16cf65c4 | ||
|
ca41fd3058 | ||
|
1af9e1a864 | ||
|
3fdaa23ae4 | ||
|
b44211190b | ||
|
1ea064ad8e | ||
|
ac814f7ad3 | ||
|
9b84f256a5 | ||
|
0455e39169 | ||
|
580a37755a | ||
|
aa26c78455 | ||
|
f0c4e79241 | ||
|
fdde37d8f0 | ||
|
e47dcb8b98 | ||
|
ddb922b924 | ||
|
be0abdf7b5 | ||
|
5cf8e62ef8 | ||
|
4925d05a35 | ||
|
41fcd5edfc | ||
|
2d6249fbd2 | ||
|
633ca27ae7 | ||
|
7feef1dd5d | ||
|
4feded59da | ||
|
3ecb678e09 | ||
|
22e10313b0 | ||
|
7a81acac44 | ||
|
fe52fcd1e7 | ||
|
625a58661e | ||
|
33eff4d1d3 | ||
|
9cb048b053 | ||
|
d40be17ff2 | ||
|
4b425a8fc6 | ||
|
76227029e7 | ||
|
46b57349da | ||
|
e0d068c909 | ||
|
04792b3ddf | ||
|
aad1a320c5 | ||
|
0f0d604ca8 | ||
|
a1c164e2d8 | ||
|
f70e9b10d3 | ||
|
405725bf9c | ||
|
5a523c07ba | ||
|
a6a02edebb | ||
|
79463b2efa | ||
|
011f3121a5 | ||
|
4af7ea944c | ||
|
31f300c16d | ||
|
d1d4b6e83c | ||
|
ee60e66936 | ||
|
e48d410162 | ||
|
83841fddcd | ||
|
8975fc1b3c | ||
|
deeed0ab79 | ||
|
62fb31d578 | ||
|
33c94cadf5 | ||
|
ded501370d | ||
|
45d7e30a61 | ||
|
9d0c0147d7 | ||
|
3ba3e10ec8 | ||
|
6dce6c1240 | ||
|
d297fdef7d | ||
|
f538aee155 | ||
|
a9d46a306b | ||
|
f1b5b73eaf | ||
|
6d95d56abb | ||
|
5ad5458bc2 | ||
|
8a996da054 | ||
|
0890e1fb0f | ||
|
f36db9462a | ||
|
ff558e713b | ||
|
4441dcbb5e | ||
|
59cf9803b6 | ||
|
5fb10bdfd3 | ||
|
8a7d5aacc7 | ||
|
aa05b84acc | ||
|
e33a1da93e | ||
|
e1080cdd1e | ||
|
57f61c09ce | ||
|
980b7b011f | ||
|
54b103eaeb | ||
|
5e3d38b675 | ||
|
414ca367af | ||
|
e4e6bb54fd | ||
|
e2e4b77a87 | ||
|
57a2806c18 | ||
|
7db585f5a4 | ||
|
45408e52b7 | ||
|
8ee13d0e30 | ||
|
8be00fef4e | ||
|
6136198da4 | ||
|
0b028811f2 | ||
|
206b707d0c | ||
|
a9a687ab61 | ||
|
990792f9c1 | ||
|
a42bdeb640 | ||
|
339d36b0a2 | ||
|
e6b167565e | ||
|
fcfeac740e | ||
|
e0a50213e7 | ||
|
c1d0ced565 | ||
|
b87cfbec98 | ||
|
a96e6f3b42 | ||
|
24312f9f49 | ||
|
a0935c246d | ||
|
6dc009579d | ||
|
c2bb4dbceb | ||
|
46eca72f79 | ||
|
2dec63e6b0 | ||
|
af6fb06cd6 | ||
|
4d87c3af1e | ||
|
dc93d96cb9 | ||
|
f647412789 | ||
|
2076cfd42e | ||
|
78863b4b0f | ||
|
53ab9bf668 | ||
|
cfeaa0ca23 | ||
|
cb53c3b14a | ||
|
73324f2ce6 | ||
|
c5af3ad4f2 | ||
|
7bb5a3582c | ||
|
77cc0b1554 | ||
|
be2efb7d25 | ||
|
0f04faab6d | ||
|
6081371b89 | ||
|
3171e4cc98 | ||
|
ec71fd87f2 | ||
|
a961665452 | ||
|
8449c2ea0a | ||
|
0aca5d2cdc | ||
|
0c30d8288d | ||
|
a447425d68 | ||
|
9092e9dbab | ||
|
33c820096f | ||
|
8ec93fb0b7 | ||
|
020328bf27 | ||
|
f2e05a20b2 | ||
|
b841931ffe | ||
|
001db8bd27 | ||
|
ad84b25e8e | ||
|
d5ec3eab06 | ||
|
f5b49fe4fd | ||
|
6ffacea45f | ||
|
df255e06b5 | ||
|
936641fd83 | ||
|
5f4227f52a | ||
|
ed991553d3 | ||
|
22f9da1565 | ||
|
629cd30e76 | ||
|
2a702cedd7 | ||
|
4acf43f9da | ||
|
94d050bb13 | ||
|
f3e270d69b | ||
|
41066a4ed1 | ||
|
2eb542205e | ||
|
e671382a94 | ||
|
d064a77ca7 | ||
|
fad1dcaa7b | ||
|
6b54fdea5f | ||
|
227bef7bd2 | ||
|
4c87a7e5a6 | ||
|
3b267c4b0b | ||
|
55d05447f5 | ||
|
582da16a7f | ||
|
2be83cf0cb | ||
|
8e649ec8d3 | ||
|
3998b689de | ||
|
1e62ccd968 | ||
|
e90312a154 | ||
|
9d8d396327 | ||
|
721a4b5660 | ||
|
3d623c9493 | ||
|
a06b1477e7 | ||
|
89f170c4c9 | ||
|
ca0ab78388 | ||
|
60d51f2c0a | ||
|
1467630a68 | ||
|
90fae49d64 | ||
|
fc480cdb6c | ||
|
be3b75265f | ||
|
208dcf5af8 | ||
|
ba38dc9d24 | ||
|
8d379bf1a7 | ||
|
1f8b6bf3e1 | ||
|
c6124dbb09 | ||
|
c641c3ab19 | ||
|
faeb0cae4e | ||
|
917e512c10 | ||
|
3e476701b4 | ||
|
9e05b8f8c1 | ||
|
ced92764ed | ||
|
234a9611a6 | ||
|
c1e4e879fb | ||
|
d4d282d14d | ||
|
59657673fc | ||
|
3db855d309 | ||
|
9774447859 | ||
|
3e2665fb11 | ||
|
d0defa6e3f | ||
|
30dd671e3e | ||
|
4c36bacd41 | ||
|
e534c876b3 | ||
|
b86671acba | ||
|
85c7f52c3a | ||
|
378c71dec7 | ||
|
ad7104adc1 | ||
|
c46e8fcaea | ||
|
cbecb42185 | ||
|
5cbd8d9af7 | ||
|
d8b3ddf595 | ||
|
01146ac6b0 | ||
|
90223fa06b | ||
|
19da5510df | ||
|
59eb8d06cf | ||
|
28e6d19a90 | ||
|
faf84198c6 | ||
|
83b0cb369e | ||
|
df7d3f58e5 | ||
|
0ba9307bdb | ||
|
ca8a36769e | ||
|
218292aa15 | ||
|
3aad27f6e4 | ||
|
6a9ca59d06 | ||
|
a415fa8aad | ||
|
410fc18fc3 | ||
|
ec31858e07 | ||
|
75e744f4a2 | ||
|
16a094cf34 | ||
|
3e26570fcd | ||
|
b9c7afd5fe | ||
|
21643f0716 | ||
|
f864e68bf7 | ||
|
5c5c0a82ba | ||
|
f59ba8cae0 | ||
|
512f5464d0 | ||
|
c28ee66a14 | ||
|
de27275ee6 | ||
|
7d460450cc | ||
|
06bcc863b0 | ||
|
9787913b35 | ||
|
085e08142d | ||
|
259cd1ce9c | ||
|
db24334b9e | ||
|
f3b83f132e | ||
|
29f321b224 | ||
|
eb84249205 | ||
|
0620436d63 | ||
|
683b10140e | ||
|
e1ae307e60 | ||
|
5d9039731b | ||
|
23a0ee2dbe | ||
|
c517a708d5 | ||
|
8710fcaddc | ||
|
3433130c5d | ||
|
5573a73337 | ||
|
cf8b2c5e84 | ||
|
f240405810 | ||
|
9cf59214f3 | ||
|
403f9b22f6 | ||
|
cfac8d7fcc | ||
|
4c5b67bce0 | ||
|
622db9d9e7 | ||
|
07f58cad01 | ||
|
58fdde1289 | ||
|
325ff57928 | ||
|
49477fa250 | ||
|
e117c9fb6d | ||
|
1b68611edc | ||
|
b8c01be32d | ||
|
0508aa92ee | ||
|
1a20c2476d | ||
|
f7923f7b47 | ||
|
de40bbf232 | ||
|
1bd015ea4a | ||
|
554f18b850 | ||
|
69e19fa6bd | ||
|
c1520fb208 | ||
|
81407b6807 | ||
|
7182ae0f8b | ||
|
dcb503dc71 | ||
|
c62344a70b | ||
|
368f534bce | ||
|
fd71c5f50f | ||
|
9afd73c16f | ||
|
8777d9d61d | ||
|
2a95b62431 | ||
|
9c49df7e7b | ||
|
ebbfb54c2d | ||
|
cddd3db2b2 | ||
|
e23ae43850 | ||
|
c5be2f492b | ||
|
28835d69b7 | ||
|
824d1f9efe | ||
|
7aeae42fdc | ||
|
da06eb2cb3 | ||
|
75b1797771 | ||
|
2ded14efe3 | ||
|
9b7bd5e9e3 | ||
|
455d1c163c | ||
|
26a0964e56 | ||
|
162e29c979 | ||
|
8d72722cc7 | ||
|
6b4a0343b3 | ||
|
93ea15fb46 | ||
|
299e9ea0ab | ||
|
4e564a1945 | ||
|
16c05468bc | ||
|
c4a0735232 | ||
|
00b60afbf5 | ||
|
15f8304e48 | ||
|
e3cc91ded2 | ||
|
c206a3cc09 | ||
|
bbb585a7c3 | ||
|
8fc0f70a2b | ||
|
7e5698e77d | ||
|
ba7ee5c5f4 | ||
|
27718e0e47 | ||
|
8bab04e2bc | ||
|
e52bb95995 | ||
|
480303c446 | ||
|
f2b1fa150c | ||
|
0544105fb8 | ||
|
e61793eea2 | ||
|
3cb9ad7fca | ||
|
cbf44035b8 | ||
|
1f80da4b7a | ||
|
52f64b2bac | ||
|
70be52cc2b | ||
|
b7495eb2e4 | ||
|
44451725e4 | ||
|
3e21fa977a | ||
|
82b5e510b9 | ||
|
5b975f66ee | ||
|
650114abca | ||
|
1f0a3d3ec8 | ||
|
b31632aec9 | ||
|
6fc69414e2 | ||
|
44766516d9 | ||
|
8b45b1d980 | ||
|
2a78934d15 | ||
|
14d470cffc | ||
|
bc77404518 | ||
|
1272a3fc94 | ||
|
8d4c744b97 | ||
|
d369e840b2 | ||
|
17d689a9a8 | ||
|
69b5e6e1c3 | ||
|
bd833fe57c | ||
|
5e8faa28ed | ||
|
bb55352658 | ||
|
43756df814 | ||
|
86da04c245 | ||
|
3b99282ea9 | ||
|
49f7201052 | ||
|
382ae0b45d | ||
|
ec015a26a1 | ||
|
d71cda7adf | ||
|
267eae5e85 | ||
|
d1ccff025e | ||
|
cb1bd30cf6 | ||
|
50748b1189 | ||
|
431124356f | ||
|
737dd5f593 | ||
|
5b5b0f5722 | ||
|
f4b874d304 | ||
|
212ca4bb0a | ||
|
a993e892b3 | ||
|
2cc77147d2 | ||
|
47686d844b | ||
|
f25d080e3b | ||
|
d10b5c84b5 | ||
|
abef09ef6e | ||
|
b6672807d2 | ||
|
54dcf73d96 | ||
|
0d7968b97b | ||
|
bc9fed3635 | ||
|
1ed21bcb57 | ||
|
d998c3342e | ||
|
64571bee75 | ||
|
58d47e96f8 | ||
|
01c5776b06 | ||
|
ea736eba1b | ||
|
0d465ce91c | ||
|
91cfc0f748 | ||
|
9a21c99966 | ||
|
bc2a5e0deb | ||
|
eff920662e | ||
|
4c95b992cf | ||
|
41538b3970 | ||
|
ec91de6849 | ||
|
7fa3585e82 | ||
|
f68fb25b83 | ||
|
f6d4910877 | ||
|
6612b5b3c6 | ||
|
ab180e7dfc | ||
|
b26d57c90e | ||
|
270e88b169 | ||
|
793a61ccfb | ||
|
b13fc8465f | ||
|
cd05d363f8 | ||
|
14d6a4e6bf | ||
|
044aa5286e | ||
|
9832c5354f | ||
|
322a8c60be | ||
|
93deaef626 | ||
|
27c4d3dc2f | ||
|
962538b149 | ||
|
b5b15f390e | ||
|
959bb706a4 | ||
|
b5cd9e3682 | ||
|
5416f020d8 | ||
|
06498dbe14 | ||
|
d915cd6284 | ||
|
c7db5de52f | ||
|
81b7cb3ca8 | ||
|
42d475b638 | ||
|
5aa63d2cc6 | ||
|
0233deb5c6 | ||
|
c3e65b2552 | ||
|
81035d401f | ||
|
796f4bd63c | ||
|
51d167aa29 | ||
|
0790bb4154 | ||
|
160028ada1 | ||
|
bb25d09052 | ||
|
d98e40697b | ||
|
6e95bf45f9 | ||
|
287a2e6979 | ||
|
39d66c00ce | ||
|
7b9b7b6aab | ||
|
26ac12679c | ||
|
f93c0075c0 | ||
|
de204dda1c | ||
|
031075c954 | ||
|
67edf85459 | ||
|
c1894e8f3e | ||
|
8702e714bc | ||
|
df8c141bb8 | ||
|
1094e894cc | ||
|
c139dc890d | ||
|
ab8704ed34 | ||
|
7af2826ad1 | ||
|
d784819901 | ||
|
c070c05237 | ||
|
65cc699832 | ||
|
cf6d79a1ca | ||
|
e0438d27a8 | ||
|
c1fa537e34 | ||
|
9dd5bdb0e6 | ||
|
3798cadfcc | ||
|
58512a90d8 | ||
|
42d4f42b12 | ||
|
07f939b46b | ||
|
94bafb451f | ||
|
3366cacd6a | ||
|
41b6968787 | ||
|
15af271408 | ||
|
a5472ed04a | ||
|
130704a09a | ||
|
bc62c80320 | ||
|
ad20248ee3 | ||
|
6b89b3b6c1 | ||
|
359a0c9cdf | ||
|
7f55cf3a9c | ||
|
dbf8a41244 | ||
|
9776f674f1 | ||
|
652047f130 | ||
|
af1c829a41 | ||
|
fe4e21c8db | ||
|
0a63716682 | ||
|
55b4d78026 | ||
|
365759e0b0 | ||
|
403be3b106 | ||
|
6f81c907e8 | ||
|
4d7f15f881 | ||
|
4081d8c5ed | ||
|
e2c352de07 | ||
|
b99ed974d4 | ||
|
0747d59752 | ||
|
98851f9ad3 | ||
|
ab17913243 | ||
|
220bac9397 | ||
|
c186e71c92 | ||
|
335c40b4d8 | ||
|
b34d527f60 | ||
|
ed10fc811d | ||
|
0383de9dc2 | ||
|
3c7995f030 | ||
|
e66705aa84 | ||
|
ceab2740c1 | ||
|
67c88f3572 | ||
|
d54ac0439e | ||
|
bea6d5dd12 | ||
|
aa611c268c | ||
|
42f4c84505 | ||
|
c80a491e03 | ||
|
63d95e1e34 | ||
|
10f235584c | ||
|
78df532c8c | ||
|
8c4813fcbf | ||
|
770a97e6f9 | ||
|
85013c9770 | ||
|
7a444d8fb0 | ||
|
d2c3a55d4e | ||
|
5e3c3a9b45 | ||
|
ba23aa5e2c | ||
|
9bc61c675a | ||
|
ab248ec691 | ||
|
e2f4fa23d0 | ||
|
a53e7d9f68 | ||
|
bbec79ccba | ||
|
d62f12f277 | ||
|
4cee6fdb1b | ||
|
da9d15df95 | ||
|
fa3dc321b7 | ||
|
23d94005d3 | ||
|
9bc6ae85a5 | ||
|
7b939cb7d8 | ||
|
cd5e3a7077 | ||
|
51f4550c2f | ||
|
b3055bfd44 | ||
|
6237a28b87 | ||
|
e20b44d5da | ||
|
9d64d31e2a | ||
|
ea09249e67 | ||
|
f3dd3ab1bf | ||
|
0b4802cdea | ||
|
b43b83cee1 | ||
|
45e807a41a | ||
|
8a53098c12 | ||
|
7c01836135 | ||
|
27f39aed85 | ||
|
856201f67e | ||
|
68cfe0fd8b | ||
|
8d01c03515 | ||
|
f8fd0d263e | ||
|
29fe27d245 | ||
|
92775b1358 | ||
|
a43296d242 | ||
|
66248ba2aa | ||
|
1bbbfd4e66 | ||
|
b19358fb80 | ||
|
54b012caa0 | ||
|
6ad182b1eb | ||
|
7331bf33de | ||
|
29d9e0d2c5 | ||
|
0632afb5be | ||
|
3a8f1d7172 | ||
|
0d7315f037 | ||
|
156145b96b | ||
|
21db64fe0e | ||
|
a2f9822de7 | ||
|
97b65985df | ||
|
f5dc3ab0c3 | ||
|
2da53af59b | ||
|
2b2c2c3cd6 | ||
|
59ef4c2758 | ||
|
c1ff8bdc4c | ||
|
24143ab7d7 | ||
|
a24b69caab | ||
|
d698bd6fc7 | ||
|
7e914bc9cb | ||
|
76a8a45eb6 | ||
|
9c357c803f | ||
|
704231a4f6 | ||
|
bec0063d07 | ||
|
4916eadafa | ||
|
ebbce668fd | ||
|
4e3f38ec09 | ||
|
42839f8c20 | ||
|
4c39c35fd8 | ||
|
ec5c51c3ba | ||
|
3b0c34d53b | ||
|
69092da48a | ||
|
04ae411754 | ||
|
7c9492b37d | ||
|
b3eb5d3e30 | ||
|
9d0cd25897 | ||
|
74b25a40dd | ||
|
87b758e3ae | ||
|
73eb3fec77 | ||
|
b4e57ea981 | ||
|
99a1d57c0a | ||
|
b206552c60 | ||
|
a097b23a0c | ||
|
1cb90b87f4 | ||
|
9e35a5e0d9 | ||
|
ab3949b8da | ||
|
32151d5a31 | ||
|
d4bd5aad5a | ||
|
201f9c29f4 | ||
|
89d1994f35 | ||
|
2230ec8b76 | ||
|
1f18f24991 | ||
|
02200e4c96 | ||
|
ed2a0f066d | ||
|
e8b272653e | ||
|
ec66c3f0f4 | ||
|
863da48398 | ||
|
40e4883ddc | ||
|
6ce45193d2 | ||
|
d07d1d37d6 | ||
|
188fef5b6e | ||
|
a44259b8f7 | ||
|
357ec528a2 | ||
|
3a2724bfcc | ||
|
b3b0f78c91 | ||
|
4518050527 | ||
|
76e6383727 | ||
|
b9a3971df8 | ||
|
21b0514d1e | ||
|
9594875bbd | ||
|
c066c9c5f8 | ||
|
0b54bf7ba2 | ||
|
93503dceb5 | ||
|
31ac109b21 | ||
|
f6e542e6ab | ||
|
676670c022 | ||
|
776d45f116 | ||
|
2f322cadb4 | ||
|
c63081e3c5 | ||
|
39b80e518b | ||
|
5cfdf35d20 | ||
|
256556efa0 | ||
|
3bc4256e25 | ||
|
4d965ac5d7 | ||
|
3805968741 | ||
|
a7ea9cf1e9 | ||
|
529b9ec417 | ||
|
0be22683a3 | ||
|
16704d9563 | ||
|
74dfbe57d6 | ||
|
0b6a45af2e | ||
|
fafd449c5f | ||
|
1abb8a574b | ||
|
5f1ddf2a96 | ||
|
f6484e3240 | ||
|
659025c7e7 | ||
|
b83a0e5583 | ||
|
be8e4ff5f4 | ||
|
56430ad405 | ||
|
bfbc4b7862 | ||
|
cf810019d6 | ||
|
8b73853b6b | ||
|
3fc5e5b351 | ||
|
c36bf00151 | ||
|
e149379b83 | ||
|
2bc471d501 | ||
|
ea426108f0 | ||
|
ee30b1f915 | ||
|
949efb017d | ||
|
ffb6ea4a31 | ||
|
85c811a18f | ||
|
44e590fdb8 | ||
|
665af07f52 | ||
|
b153b39203 | ||
|
36e6c16cc8 | ||
|
c974c0b904 | ||
|
c455be74d4 | ||
|
265d064f91 | ||
|
987bbd09c0 | ||
|
2a087595a9 | ||
|
9ade60b082 | ||
|
53c2f1a760 | ||
|
af51af2577 | ||
|
cf5354cc27 | ||
|
7699033d90 | ||
|
20f4feaec0 | ||
|
5c3b741a2c | ||
|
b4e64969cc | ||
|
6dca58937d | ||
|
e4af9ad820 | ||
|
6a87b9ce68 | ||
|
cfa6c2b8ae | ||
|
517c1f08ca | ||
|
7f866aab5c | ||
|
4406f8e258 | ||
|
de21302f4e | ||
|
c920a7c649 | ||
|
f628a1eff5 | ||
|
c59c3661c6 | ||
|
1c1e58a6eb | ||
|
f543771003 | ||
|
72e1a14552 | ||
|
a05f59edf2 | ||
|
91099f9ee5 | ||
|
2a0df29bf4 | ||
|
d41a59fc82 | ||
|
a210c5cd76 | ||
|
a579368c17 | ||
|
283e611a88 | ||
|
c251dfa952 | ||
|
a0a9c7cf22 | ||
|
92e216634c | ||
|
6bd1d6b9a0 | ||
|
e4725b8006 | ||
|
cd7e607258 | ||
|
9099b5d24d | ||
|
8ea866616b | ||
|
3f454495bf | ||
|
212a2052a4 | ||
|
80d85a522c | ||
|
cb198baaa3 | ||
|
45101b7b0d | ||
|
7f85eea3ee | ||
|
f8e28baf6b | ||
|
867bf9c4e0 | ||
|
234b0809bf | ||
|
e02ff7f849 | ||
|
56a07b1986 | ||
|
ed6d7a7cf9 | ||
|
ebeded507d | ||
|
f4412eec1b | ||
|
0b4ac62eae | ||
|
d12fcdb862 | ||
|
ab1c971e8d | ||
|
36c2ed58ad | ||
|
bc3abe663f | ||
|
465da7a997 | ||
|
aa5ef2f7ff | ||
|
a19dfed759 | ||
|
4739ece7b0 | ||
|
8e897a43b5 | ||
|
92d28b38cd | ||
|
1ca67cb954 | ||
|
cb111a8e74 | ||
|
20ec883e8b | ||
|
c0bccc8c23 | ||
|
eb3671b067 | ||
|
8264b5a82c | ||
|
441331bd82 | ||
|
aaf8391f3d | ||
|
e52c3a2aeb | ||
|
ce69d749e1 | ||
|
a24b7bcf77 | ||
|
43b78055aa | ||
|
2826bc366a | ||
|
00180c5f35 | ||
|
d326e51b0e | ||
|
bcb5c5325e | ||
|
1417cb5bd1 | ||
|
b0918b9317 | ||
|
24a1704f05 | ||
|
713d7f9fa8 | ||
|
21036261fc | ||
|
9e1e755ccd | ||
|
83444b60cd | ||
|
2394467615 | ||
|
6914178677 | ||
|
5786abcb7a | ||
|
3094199fa8 | ||
|
b4308aaa7e | ||
|
743de63894 | ||
|
8bae71f246 | ||
|
ab3b1c9dfb | ||
|
3c632d68b7 | ||
|
d90c2b8e74 | ||
|
78178f72d0 | ||
|
d0c4450e7e | ||
|
bf8638a06f | ||
|
98855853cf | ||
|
78cd1d4f3d | ||
|
94f6f4c809 | ||
|
524526c9b7 | ||
|
8139980f27 | ||
|
d69ccfc1dd | ||
|
3f01024974 | ||
|
8a4e68868d | ||
|
d08ec9895d | ||
|
358af9ffb8 | ||
|
f0b9ba7c6f | ||
|
d152f0766c | ||
|
855ce0c7d4 | ||
|
e66eac41d1 | ||
|
1d2359cfbc | ||
|
c98057fbf9 | ||
|
27dca775c7 | ||
|
330763aa02 | ||
|
f87e1ed219 | ||
|
08d24f9835 | ||
|
47aa53e3bd | ||
|
89cb224b39 | ||
|
429afa959f | ||
|
a645a78cd0 | ||
|
b27cd9b5ed | ||
|
2854e7565f | ||
|
bac96faf8e | ||
|
0376e242d9 | ||
|
b44744db39 | ||
|
5f18d3d18c | ||
|
4ca10ae845 | ||
|
24e12b1422 | ||
|
48c0067efe | ||
|
408c697847 | ||
|
8cda03a1bf | ||
|
b7c5cf96ba | ||
|
c4c38d63fc | ||
|
500dfd98a0 | ||
|
14f54018c4 | ||
|
f057ee1893 | ||
|
ed15772fd6 | ||
|
0be4b69710 | ||
|
cdccdbe4e2 | ||
|
06992ef370 | ||
|
65c5c675ed | ||
|
6acd21ac48 | ||
|
74b5f08930 | ||
|
420aac584b | ||
|
34b524547a | ||
|
44bad70987 | ||
|
d2cada1c1c | ||
|
ef512aa855 | ||
|
2c2180fc5c | ||
|
2979e5fc62 | ||
|
8684b27b54 | ||
|
8fe03b40fc | ||
|
65e8f505d5 | ||
|
f9fda0ed4c | ||
|
cb841602fa | ||
|
96e03a8443 | ||
|
0727e11a5b | ||
|
53f97b5000 | ||
|
433c660cfe | ||
|
58a965523a | ||
|
89f207f993 | ||
|
b8e6a385cf | ||
|
c9a3c7933b | ||
|
bb53b3e63f | ||
|
d3e40bb1de | ||
|
66d8ecd0d0 | ||
|
da9d8f7353 | ||
|
20553e7422 | ||
|
ae5bf8d460 | ||
|
f4e0de5974 | ||
|
90344eeaa0 | ||
|
eb0883ee75 | ||
|
effce7f181 | ||
|
4d7019bee6 | ||
|
3b193db847 | ||
|
8564d3b629 | ||
|
edac0b2c51 | ||
|
677454efe8 | ||
|
a84d8e7691 | ||
|
500ace9f7b | ||
|
8f817b8365 | ||
|
6393ea6416 | ||
|
3a0417c648 | ||
|
1bb9ac48b9 | ||
|
083038e7c0 | ||
|
77c8535fa3 | ||
|
ea90ddb6d3 | ||
|
150432183a | ||
|
5dd5d2b608 | ||
|
7d186618fc | ||
|
d8f3609f25 | ||
|
9bf2f67f0c | ||
|
d917480324 | ||
|
9f150d8b05 | ||
|
6eae453735 | ||
|
6b2e3c1eb5 | ||
|
b1adb9a1e9 | ||
|
d101b3a7a1 | ||
|
b0b219844c | ||
|
03af6d0ac8 | ||
|
02ea970f67 | ||
|
3f549fb5ad | ||
|
5f4eff7e35 | ||
|
f0579950a7 | ||
|
e9d4e27a4b | ||
|
357a99236a | ||
|
4debb6ba5d | ||
|
db72af0fdc | ||
|
d4bcfd9f78 | ||
|
6dfea0d623 | ||
|
2ade248e32 | ||
|
31020c4596 | ||
|
de08a9b986 | ||
|
41f58e3cde | ||
|
1c780e2b3f | ||
|
1886d9a625 | ||
|
593bbab53f | ||
|
b5ad0e30d7 | ||
|
1412479bf6 | ||
|
b365189ae9 | ||
|
44fbe04bb7 | ||
|
843ea88219 | ||
|
15f77a6e47 | ||
|
31b0ccfb33 | ||
|
3cf2ba3527 | ||
|
360d4e97ba | ||
|
de700d3cc8 | ||
|
d1d5b9d39d | ||
|
0019cfdc7e | ||
|
1ef1f79a16 | ||
|
7ed2abffdd | ||
|
ddaf36e00c | ||
|
32530b1ad6 | ||
|
622ea63281 | ||
|
98c42e0b69 | ||
|
c46ec2b355 | ||
|
9735255318 | ||
|
b291bce240 | ||
|
6b697ae23a | ||
|
4da4bd3ff3 | ||
|
1b15101d8d | ||
|
50a023a33b | ||
|
c3e1e82d9b | ||
|
09c4885d31 | ||
|
aab50511a1 | ||
|
da1b87f1c6 | ||
|
f957cfc088 | ||
|
83201e1a48 | ||
|
fb555a764e | ||
|
d9d28fef21 | ||
|
11a6eec5f5 | ||
|
58184c2039 | ||
|
ae3e6db268 | ||
|
4122f9bbb3 | ||
|
b3828b6736 | ||
|
1c4d43aad5 | ||
|
46d992cf0d | ||
|
c826049813 | ||
|
bf326fb243 | ||
|
e3e070785b | ||
|
f50e7a4162 | ||
|
f14bf618e5 | ||
|
747a78d4d7 | ||
|
2e7873149f | ||
|
2e1931b153 | ||
|
a80f5f0a3d | ||
|
2de99c55ce | ||
|
f44bf4def3 | ||
|
1437fa5418 | ||
|
2d4cdd95ac | ||
|
4faa7d169f | ||
|
7e17330561 | ||
|
dff2bf10dd | ||
|
876ae8e4dd | ||
|
7b9169712f | ||
|
8f8d0e9cca | ||
|
1806d9524c | ||
|
52b4203af5 | ||
|
bb6838b5a9 | ||
|
c131bcbcac | ||
|
d2f783df34 | ||
|
7637eb48bf | ||
|
bcb7b21a47 | ||
|
e2cc264c12 | ||
|
7ac03e0a88 | ||
|
4e802c9814 | ||
|
35bbb7a26b | ||
|
3b595a9e7f | ||
|
4a4b8699fb | ||
|
6ebf6ad92a | ||
|
805b65478c | ||
|
e3dd15273c | ||
|
5039d22339 | ||
|
6b46b50c1b | ||
|
aa12f7e621 | ||
|
73a1cf33de | ||
|
2da96e4798 | ||
|
22839df560 | ||
|
c796958516 | ||
|
c15e3953fe | ||
|
41f09a75a3 | ||
|
1dd5cea24d | ||
|
67b10a52ca | ||
|
d6514ef633 | ||
|
5573cc73fc | ||
|
d61c1b1211 | ||
|
ee03100891 | ||
|
6cd72a1eb4 | ||
|
7df3a4bdd6 | ||
|
a5a9eb94db | ||
|
fb9fd44dd6 | ||
|
497201aca7 | ||
|
2a9413e155 | ||
|
d9b6f08ce5 | ||
|
980fd2bd07 | ||
|
0ef5c629f9 | ||
|
8952860d8e | ||
|
adb8e5307d | ||
|
6062d27ed8 | ||
|
b2d0490a86 | ||
|
af68678895 | ||
|
e7f09c2e68 | ||
|
830e2baf42 | ||
|
4a6d70bf14 | ||
|
2026c06242 | ||
|
d7abd71071 | ||
|
5d31fc1e1b | ||
|
be8c56458f | ||
|
7ed6e48b48 | ||
|
b0f347dcf3 | ||
|
65bbee4bf8 | ||
|
d32a514393 | ||
|
d250120102 | ||
|
d6c73c2b65 | ||
|
ac49ef0b59 | ||
|
660f7725b7 | ||
|
b97e1010c0 | ||
|
bf1cc03227 | ||
|
e2499edfa3 | ||
|
3984246514 | ||
|
6a41234406 | ||
|
6560cfaf4b | ||
|
2a4a50da8e | ||
|
d0a3493144 | ||
|
be8466b47b | ||
|
1e166d9be7 | ||
|
774e885334 | ||
|
8377a9f941 | ||
|
732a494ac4 | ||
|
cb8917b7a3 | ||
|
d288be358a | ||
|
f2aa8c1e58 | ||
|
ea06b1ba67 | ||
|
f37a1f2f9f | ||
|
3b06b2c880 | ||
|
f4f8d38643 | ||
|
6fb907b322 | ||
|
6695340d50 | ||
|
531e0ff317 | ||
|
6920d9db68 | ||
|
065ad92c0e | ||
|
31c6fbe8bb | ||
|
6202d66873 | ||
|
dab45737c9 | ||
|
43c86909d7 | ||
|
2a6673a8e5 | ||
|
49382f7ac2 | ||
|
60248fbd00 | ||
|
ca7adcf8c8 | ||
|
679b2b9b19 | ||
|
75f366acb9 | ||
|
c98f555aeb | ||
|
2663e9ff85 | ||
|
8f55baa6ea | ||
|
6dfc4e8c25 | ||
|
cb734cfeac | ||
|
0046cd1e4f | ||
|
37cde9ed03 | ||
|
2c79925212 | ||
|
bebf77e099 | ||
|
7bbc6ef2e5 | ||
|
3930d9a587 | ||
|
4be5c9d23d | ||
|
9ae8a49697 | ||
|
98d06ae6df | ||
|
4947b0dfd0 | ||
|
e18823e63b | ||
|
38f3263abe | ||
|
db3059a3c0 | ||
|
b2db930f6a | ||
|
efe4deb847 | ||
|
2c0f6bc219 | ||
|
b17cf0b78b | ||
|
5c47264cc2 | ||
|
dfa0bf75a8 | ||
|
a905da2ff2 | ||
|
dd2bae2057 | ||
|
5ea3c264e3 | ||
|
c3c541363b | ||
|
5c999c3100 | ||
|
0311b4a7cd | ||
|
f612aa9057 | ||
|
e226ef2ea1 | ||
|
7849e844cd | ||
|
b452835344 | ||
|
592bc89688 | ||
|
dd11f4b297 | ||
|
27ebcbb697 | ||
|
eba117d5e8 | ||
|
06cbe6239a | ||
|
c173f802a6 | ||
|
adcb806aac | ||
|
f215827e2f | ||
|
fcfef21c77 | ||
|
f723080220 | ||
|
fa314f6166 | ||
|
127c6694e8 | ||
|
d92d084211 | ||
|
bc6cc96310 | ||
|
abbf4c6426 | ||
|
f711494f54 | ||
|
3fab2cd59f | ||
|
24632af95a | ||
|
f7717208ae | ||
|
270dfe6052 | ||
|
eda056b9f6 | ||
|
3e9cba3afd | ||
|
07a27b61b6 | ||
|
097e185042 | ||
|
c0ef16ad1d | ||
|
9b1315d08c | ||
|
85f191217b | ||
|
555341029b | ||
|
b2d74b09ff | ||
|
f8532d225e | ||
|
3a258806a2 | ||
|
d8fc785f34 | ||
|
65b92dec4b | ||
|
23c61cc867 | ||
|
687be7015d | ||
|
7aed899e1a | ||
|
31bbf02d4d | ||
|
61ba47d619 | ||
|
91f42f4bc2 | ||
|
a508688c3c | ||
|
8d8fb67aae | ||
|
03086b8086 | ||
|
89cf6071b7 | ||
|
4fe8474279 | ||
|
932ddb825a | ||
|
52a26ff08f | ||
|
13cba9f29a | ||
|
437c2dfa02 | ||
|
cd9d2bc71e | ||
|
8a20ab8972 | ||
|
0c14e6ec1f | ||
|
6fca0e63d9 | ||
|
4521bfe626 | ||
|
2255dd73a8 | ||
|
c259547dd7 | ||
|
2564990aa2 | ||
|
121a8bfee4 | ||
|
0acf314e30 | ||
|
c78b1b8337 | ||
|
d5f5efb77d | ||
|
4e01b13efc | ||
|
a31986fa6e | ||
|
53ff2ef7f4 | ||
|
c7e515ba7b | ||
|
bc66a38cd4 | ||
|
02f68e45e7 | ||
|
c7fd5b6baa | ||
|
59e7752a00 | ||
|
03b64a059d | ||
|
90c9d8efa2 | ||
|
7bf660d124 | ||
|
159335078c | ||
|
5769eb7c1e | ||
|
492b24894d | ||
|
3eca0a4be4 | ||
|
878d753ff1 | ||
|
c1c5b56762 | ||
|
7cd161dd03 | ||
|
cdc1165fc5 | ||
|
aab350e833 | ||
|
87077c5f19 | ||
|
ae4bb64c5a | ||
|
431ef3b1f2 | ||
|
1182539ae4 | ||
|
216218aeb0 | ||
|
7dabbd444a | ||
|
eac89a1af1 | ||
|
4ae867f540 | ||
|
59c21b9d72 | ||
|
fe8350e3eb | ||
|
72162f455d | ||
|
a084df78ef | ||
|
a014d505bc | ||
|
2ea5c9c1a6 | ||
|
20512b0ff7 | ||
|
452a89c02a | ||
|
77b1972a72 | ||
|
ca8b49e5fd | ||
|
395d16b8c1 | ||
|
a41691d972 | ||
|
daf2789ad7 | ||
|
cdb8599119 | ||
|
dc545752f1 | ||
|
900fa4b5dc | ||
|
b3912c1712 | ||
|
d09093fca1 | ||
|
1a96d7cf8e | ||
|
d8dcf7c6af | ||
|
925066efd4 | ||
|
11dd870900 | ||
|
3468698ce9 | ||
|
8b255c7005 | ||
|
e75fd86ae5 | ||
|
dd22228f43 | ||
|
eb8787754c | ||
|
0485de9669 | ||
|
5853fd47dd | ||
|
91262c9042 | ||
|
a48fd12c70 | ||
|
b7d714b58e | ||
|
2f09c74c01 | ||
|
d38250d717 | ||
|
a2b56178fe | ||
|
d92983c22a | ||
|
aa7e559115 | ||
|
e2692e9805 | ||
|
42ea34b969 | ||
|
60b7617624 | ||
|
8287904c00 | ||
|
84f3bd8f17 | ||
|
7d28eaab64 | ||
|
90c6eeb398 | ||
|
841a34385a | ||
|
b57cd5aca4 | ||
|
71a44f70f5 | ||
|
387edb5163 | ||
|
e23b57628f | ||
|
e451e3d3e2 | ||
|
797478786d | ||
|
df2e36287d | ||
|
a88b062beb | ||
|
c301c6c0f6 | ||
|
a6a2664746 | ||
|
180a7d849d | ||
|
1ae6ab48a6 | ||
|
af72a57c9d | ||
|
9aa13697f7 | ||
|
34ae473d6e | ||
|
cb677635e3 | ||
|
509c6c13a3 | ||
|
add851006d | ||
|
c304cee8c2 | ||
|
8c7a976ffb | ||
|
5515824fe2 | ||
|
e0354b70f7 | ||
|
0813a1fd45 | ||
|
f308bb3a52 | ||
|
f31eaa6b1e | ||
|
6f9fa3b640 | ||
|
ac7d050ecf | ||
|
0db40e43fc | ||
|
fef7f8c641 | ||
|
cf67312ba5 | ||
|
844169a744 | ||
|
30688422c4 | ||
|
2a22605618 | ||
|
e37711e947 | ||
|
be8108143b | ||
|
1a49af7f94 | ||
|
14d98a7710 | ||
|
accb624b35 | ||
|
db794d6be7 | ||
|
333613fca2 | ||
|
7a0ead3fac | ||
|
721071d224 | ||
|
51b0bff8e9 | ||
|
70ae271c9e | ||
|
6e14ca9b2a | ||
|
747dac6ea0 | ||
|
2c08524396 | ||
|
690fd18cb3 | ||
|
f56c486fa1 | ||
|
e09dab7d2e | ||
|
a705799a2c | ||
|
9a90321e9b | ||
|
467109d588 | ||
|
5e3474c70c | ||
|
81a88eced4 | ||
|
13979ce5be | ||
|
ea3a790669 | ||
|
dc8cbe5bdd | ||
|
21c7061b5e | ||
|
eb75ccd7fa | ||
|
8ce205c7e2 | ||
|
af66e5ea35 | ||
|
4c0006f130 | ||
|
2d28ab642d | ||
|
97c9249ab1 | ||
|
31ccf7c6d3 | ||
|
54efdf5405 | ||
|
bae4fc2fdf | ||
|
d6dc78d5ce | ||
|
801dd99318 | ||
|
34010d7a99 | ||
|
a37912f122 | ||
|
6be76b9754 | ||
|
8c6dc1a838 | ||
|
43870a4601 | ||
|
8b0a074cbf | ||
|
053c44f35c | ||
|
c18f237da4 | ||
|
b3610798c2 | ||
|
d072cc79fe | ||
|
37d1a0b8bf | ||
|
3106255495 | ||
|
a86bd06484 | ||
|
5883e421c1 | ||
|
abbe72f5ff | ||
|
8ba1a0e490 | ||
|
792b2b6957 | ||
|
97b3f397fc | ||
|
867acd4560 | ||
|
fd9e8dd313 | ||
|
782a596c8f | ||
|
4c9ecb245b | ||
|
32d5d3c7d9 | ||
|
05069050db | ||
|
af7efeff98 | ||
|
960fd2b422 | ||
|
3d9b9464ad | ||
|
e0981eb77a | ||
|
573f5702d7 | ||
|
743c4e3ee1 | ||
|
d046a876f9 | ||
|
cee76d05ca | ||
|
ede362588c | ||
|
a980110740 | ||
|
bc3f514c5c | ||
|
c269e9bd9b | ||
|
2f9f5d5036 | ||
|
08b7aa6358 | ||
|
52fc50797f | ||
|
16dd5856c4 | ||
|
403e92fc88 | ||
|
37494242f5 | ||
|
9b92e86ef2 | ||
|
0df1c9b176 | ||
|
6976393e9e | ||
|
33e20efb35 | ||
|
f8d5687040 | ||
|
a47a754795 | ||
|
03abd88f0c | ||
|
1bcaa10abd | ||
|
368d6806a8 | ||
|
d1a50a8918 | ||
|
2df5817192 | ||
|
d945c2f157 | ||
|
c1d5c94864 | ||
|
f76b5c7889 | ||
|
cedc3bbad5 | ||
|
9a82f7d1ba | ||
|
a85e2277d6 | ||
|
98e7a5ad62 | ||
|
8dab401efe | ||
|
9659b403c9 | ||
|
40405669e2 | ||
|
d1bceb0041 | ||
|
581e6348cc | ||
|
1ee098bd2e | ||
|
3cbc60f35c | ||
|
592e503c85 | ||
|
aeb99cb0d2 | ||
|
ff5be97ada | ||
|
b819e5de37 | ||
|
bf18ae9376 | ||
|
4d611c62f7 | ||
|
085ad6cfb3 | ||
|
b9db97c6b9 | ||
|
583f025c1f | ||
|
9f175e070f | ||
|
0e9a88f796 | ||
|
7087e38bb9 | ||
|
45bb015adc | ||
|
0d04c080ae | ||
|
a2d3ab59c0 | ||
|
0db3fc1f7a | ||
|
ad26262a2c | ||
|
dd71f80021 | ||
|
b080e9a7d1 | ||
|
001679e809 | ||
|
23aa1c8c7d | ||
|
a580e4f751 | ||
|
43d591a93e | ||
|
8be1ad0e48 | ||
|
b06d62a8af | ||
|
accbb8cf4c | ||
|
317634ede7 | ||
|
8f93cd5fac | ||
|
9a34961748 | ||
|
ef249b7ceb | ||
|
62e110a33e | ||
|
8e311b716f | ||
|
6990bbd798 | ||
|
67da7aa9a7 | ||
|
e3a68bb3b9 | ||
|
9407c932af | ||
|
7c6c8269c6 | ||
|
fd104697f3 | ||
|
4bef41192a | ||
|
100c522a32 | ||
|
bfaaae9336 | ||
|
f0c698163e | ||
|
d309437bd0 | ||
|
34a86a241b | ||
|
f3c0766a0d | ||
|
9c7ebd21c9 | ||
|
1d97c81d8b | ||
|
99cb861dbd | ||
|
5c4fa57f09 | ||
|
d6e2dae298 | ||
|
3e1e4ea240 | ||
|
cdfbfee06c | ||
|
c060ce63f0 | ||
|
7810d888c1 | ||
|
30b0e4156a | ||
|
7aee297980 | ||
|
da216fd53b | ||
|
e751a48bce | ||
|
ed873459b7 | ||
|
0fc6ee5e5b | ||
|
2c6f4caa99 | ||
|
a596138526 | ||
|
afd42ecd41 | ||
|
f7467728d7 | ||
|
5ec4c3f68f | ||
|
8d066ca608 | ||
|
4aed61af42 | ||
|
1d5da7f9ae | ||
|
d3dfa18990 | ||
|
9cf5089dc1 | ||
|
39a196541f | ||
|
8b604f630b | ||
|
1d49b4cc41 | ||
|
3c76c9f150 | ||
|
ca0d2e603d | ||
|
2827ad15d6 | ||
|
8bb6acfca9 | ||
|
660befd6c3 | ||
|
52792264ef | ||
|
238e071232 | ||
|
bb9388384f | ||
|
a2efbfa094 | ||
|
e59a494215 | ||
|
c6987ce09b | ||
|
0695960fc7 | ||
|
79cdeb0545 | ||
|
145a9df170 | ||
|
c25d4b0cbf | ||
|
f13a050935 | ||
|
56176b2539 | ||
|
5a0c97e561 | ||
|
57309a05de | ||
|
51af58c947 | ||
|
bc43fff551 | ||
|
ca07ef08fd | ||
|
48f76057f4 | ||
|
e6850316f7 | ||
|
f340d6249c | ||
|
67f90ec108 | ||
|
6944e4e97f | ||
|
5c166e09c2 | ||
|
5502c58162 | ||
|
974f5ce425 | ||
|
637d5899f6 | ||
|
5a7d69cd04 | ||
|
089090cbe3 | ||
|
ff565c1b91 | ||
|
3ba9148042 | ||
|
880e5b539c | ||
|
310c69e90d | ||
|
650179b2aa | ||
|
218178ea54 | ||
|
5029e818aa | ||
|
0fdd830975 | ||
|
c46d285b47 | ||
|
f74edde14c | ||
|
7ec8a12dff | ||
|
02b40e6637 | ||
|
c880d6a277 | ||
|
7275b9b951 | ||
|
45fe0c2591 | ||
|
413939f89f | ||
|
e1148c9f08 | ||
|
11ed3d2d32 | ||
|
9b3a3a020b | ||
|
90278f20d4 | ||
|
eeb2528a74 | ||
|
6eb9a784c0 | ||
|
d2058b3d1a | ||
|
02b1b05eef | ||
|
c4d5774170 | ||
|
06cfcc6131 | ||
|
8231fba217 | ||
|
97f8df2934 | ||
|
90b613e416 | ||
|
689c15fde2 | ||
|
56e0403158 | ||
|
5331e81f54 | ||
|
da4c93c41c | ||
|
a1dcef4b3f | ||
|
f9d8dd7d12 | ||
|
88b4afbac0 | ||
|
c5edb730cb | ||
|
fdb2423c3a | ||
|
8b5f7d038c | ||
|
ebfe240ab5 | ||
|
837461ac28 | ||
|
9ead81b352 | ||
|
e717ee711e | ||
|
8b3a00c587 | ||
|
6a7f705be3 | ||
|
a4b12fac62 | ||
|
dc10c1b344 | ||
|
42cee040e0 | ||
|
ff7595c006 | ||
|
5bfe10c031 | ||
|
b0f0c03990 | ||
|
d6ebab3310 | ||
|
ee42d9c583 | ||
|
4d5f45a222 | ||
|
d7ddf47d57 | ||
|
1e8062b83b | ||
|
f369ca16f9 | ||
|
127e906d60 | ||
|
81e46f4d6c | ||
|
28ac4ffe00 | ||
|
0149f83027 | ||
|
84bda71e62 | ||
|
30c263bc59 | ||
|
2a6c8b048a | ||
|
73919cd1d5 | ||
|
3e019adb6a | ||
|
294d6c63b3 | ||
|
a0f1856cbb | ||
|
5626199c86 | ||
|
2970a577ba | ||
|
1724f85e26 | ||
|
b52c98c9c3 | ||
|
b02b557b74 | ||
|
57656f6e89 | ||
|
f9b13dfc2a | ||
|
49724d755d | ||
|
11efb1e19e | ||
|
a5a6c19742 | ||
|
30da413efc | ||
|
06c860aeea | ||
|
0851f2a7fd | ||
|
56d8b910f7 | ||
|
ac70a81be1 | ||
|
c0ca48f848 | ||
|
d291020a43 | ||
|
f0ddfca71d | ||
|
7d2ca0dbee | ||
|
88ead09193 | ||
|
fd09e67731 | ||
|
bb9b4ecf97 | ||
|
9999a482fd | ||
|
c0b77e6fbf | ||
|
664a63a4de | ||
|
1f1ebafe36 | ||
|
87604d945e | ||
|
9b64772b7e | ||
|
66be9d48dd | ||
|
da6736478e | ||
|
616b169958 | ||
|
9ae705f845 | ||
|
1fbce5288c | ||
|
daafdb983d | ||
|
c52973e7de | ||
|
2dbc700fc3 | ||
|
2861964755 | ||
|
aecfaa818f | ||
|
a95da742d4 | ||
|
dcb407c6d7 | ||
|
3ab7c3253a | ||
|
6f664422d4 | ||
|
1b3dd625fd | ||
|
a3884060a3 | ||
|
c8fd610660 | ||
|
523cdd548b | ||
|
91c90ff43e | ||
|
6b044e90ca | ||
|
fe3eb47e60 | ||
|
56f9ba200f | ||
|
7e9407143e | ||
|
cdf09a6f75 | ||
|
a7f7df94c6 | ||
|
b081187095 | ||
|
abf5400726 | ||
|
e593b0e0df | ||
|
81ae6d7aee | ||
|
6a57264758 | ||
|
6b43da28e3 | ||
|
ae30ffff7f | ||
|
fa24c46b90 | ||
|
ce34d9ef8b | ||
|
7ddf3ea42b | ||
|
a1ab276487 | ||
|
56b792ccad | ||
|
b2aafa854e | ||
|
1b9f776f65 | ||
|
06c67e404e | ||
|
6a08f656d0 | ||
|
5ffde047d3 | ||
|
3e30d5ad78 | ||
|
16a83dcce5 | ||
|
fb29711a4f | ||
|
4dca4320d8 | ||
|
4df245996b | ||
|
0c28189194 | ||
|
f27e72cba6 | ||
|
738429a742 | ||
|
d196d8a343 | ||
|
cf3c4a11b6 | ||
|
150c69a91d | ||
|
3354d9dddd | ||
|
be31c1934f | ||
|
a841cbe0f4 | ||
|
f389031887 | ||
|
0080cfe707 | ||
|
140ef12a06 | ||
|
c0999ac5bb | ||
|
fd42cec19d | ||
|
7f87b2bc4a | ||
|
7571ab5a38 | ||
|
79516e8552 | ||
|
f7a69489af | ||
|
e776c7a3cb | ||
|
f625968bfd | ||
|
5ed29ec7be | ||
|
e8adad2c34 | ||
|
ae850157d7 | ||
|
6b58d14fc1 | ||
|
cdde220990 | ||
|
8788d7b5d3 | ||
|
3630b0df89 | ||
|
fa2cc10632 | ||
|
151c25872f | ||
|
29cd90b644 | ||
|
478ff80ac4 | ||
|
cf7054c430 | ||
|
30ff28568a | ||
|
5caf8ece54 | ||
|
22907c7046 | ||
|
6031cbf7b1 | ||
|
020177faa5 | ||
|
f21c27113d | ||
|
461026c18e | ||
|
78bf6a6260 | ||
|
35e7375ad7 | ||
|
90ef0971d9 | ||
|
e6fa8fa2f2 | ||
|
481d8110f2 | ||
|
b905b2164c | ||
|
f84ee25b03 | ||
|
5f70ea3bbd | ||
|
e69407fa3c | ||
|
065f2316c7 | ||
|
776807349f | ||
|
95b3e95691 | ||
|
c878e89898 | ||
|
eee7ab5c44 | ||
|
b3974868ac | ||
|
eba6826b05 | ||
|
69b1e4b0bd | ||
|
f1d7ab6123 | ||
|
1b2f07a9ea | ||
|
56d7c98945 | ||
|
f8073e132a | ||
|
32e619c04a | ||
|
2e9693eccf | ||
|
69a96ecc4b | ||
|
00a4be73f9 | ||
|
ba4ce6cd42 | ||
|
75fccd8275 | ||
|
a6de6e3be7 | ||
|
97c5d77154 | ||
|
1415b08fb8 | ||
|
e885c8cc64 | ||
|
9178c63f08 | ||
|
dcc1e80ea6 | ||
|
c6847c2ad2 | ||
|
6f30c7150e | ||
|
1e7c20a75d | ||
|
da996f99c3 | ||
|
5d9f3c5909 | ||
|
d328e7b407 | ||
|
a1ff66d7fc | ||
|
cfef69ac06 | ||
|
54d41ff940 | ||
|
5921076da0 | ||
|
e05c49350b | ||
|
a4765eb886 | ||
|
e3a3ff2ec9 | ||
|
81e9ab07f5 | ||
|
ad0c5b2e15 | ||
|
b1f0eaa9ec | ||
|
10b461fc75 | ||
|
332b0caaf4 | ||
|
87d3c60509 | ||
|
97c6f79736 | ||
|
3fbd4d97bf | ||
|
94d8bdf681 | ||
|
96a3233620 | ||
|
e81afe05a1 | ||
|
76b682486a | ||
|
1a709b6d51 | ||
|
0888c2361b | ||
|
c51daaca53 | ||
|
50d562ae90 | ||
|
2904c323fa | ||
|
cdc57fc763 | ||
|
0b7c0bf025 | ||
|
5fcaa49495 | ||
|
73a884f202 | ||
|
b79f4c2417 | ||
|
b2401abbab | ||
|
bdf07b4e23 | ||
|
3998ede975 | ||
|
d2975da889 | ||
|
e4a0ccab88 | ||
|
734c68721c | ||
|
6d96afa97c | ||
|
03ddddd76c | ||
|
bf8dde378e | ||
|
35f6e24c5a | ||
|
d0ec6b9408 | ||
|
9c8a708cb2 | ||
|
a871a1aeb9 | ||
|
21fd38e13e | ||
|
0c0f85fa8d | ||
|
0df30135b8 | ||
|
2473826b4c | ||
|
d21463480d | ||
|
ad974d1d18 | ||
|
42f20ff6c9 | ||
|
3d45a945a0 | ||
|
5d3ce73619 | ||
|
ad9159dc9f | ||
|
c065589076 | ||
|
cf70cc2382 | ||
|
16c3d4f3b9 | ||
|
b03a4165df | ||
|
8ec0f2778e | ||
|
a981f4910c | ||
|
243ff69086 | ||
|
e9dbb72b03 | ||
|
758c6c8aa8 | ||
|
45a27f714b | ||
|
f0764594db | ||
|
a13c37213c | ||
|
fb1f5940fd | ||
|
c1806edb94 | ||
|
eee665a0bd | ||
|
ebf4f4d017 | ||
|
bbc284a58f | ||
|
d86340531d | ||
|
98a5766381 | ||
|
e5e57bf992 |
10
.editorconfig
Normal file
10
.editorconfig
Normal file
@ -0,0 +1,10 @@
|
||||
# see http://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
insert_final_newline = true
|
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# may be useful in hiding large schema changes in pull request diffs (but not
|
||||
# using it for now)
|
||||
spec/*.json binary
|
||||
spec/*.yaml binary
|
2
.github/CODEOWNERS
vendored
Normal file
2
.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# All files should be reviewed by a member of the SDKs team
|
||||
* @stripe/api-library-reviewers
|
78
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
78
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
name: Bug report
|
||||
description: Create a report to help us improve
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: Describe the bug
|
||||
description: A clear and concise description of what the bug is.
|
||||
placeholder: Tell us what you see!
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: repro-steps
|
||||
attributes:
|
||||
label: To Reproduce
|
||||
description: Steps to reproduce the behavior
|
||||
placeholder: |
|
||||
1. Fetch a '...'
|
||||
2. Update the '....'
|
||||
3. See error
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: code-snippets
|
||||
attributes:
|
||||
label: Code snippets
|
||||
description: If applicable, add code snippets to help explain your problem.
|
||||
render: Ruby
|
||||
validations:
|
||||
required: false
|
||||
- type: input
|
||||
id: os
|
||||
attributes:
|
||||
label: OS
|
||||
placeholder: macOS
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: language-version
|
||||
attributes:
|
||||
label: Language version
|
||||
placeholder: Ruby 3.1.2
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: lib-version
|
||||
attributes:
|
||||
label: Library version
|
||||
placeholder: stripe-ruby v5.52.0
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: api-version
|
||||
attributes:
|
||||
label: API version
|
||||
description: See [Versioning](https://stripe.com/docs/api/versioning) in the API Reference to find which version you're using
|
||||
placeholder: "2020-08-27"
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context about the problem here.
|
||||
validations:
|
||||
required: false
|
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Stripe support
|
||||
url: https://support.stripe.com/
|
||||
about: |
|
||||
Please only file issues here that you believe represent actual bugs or feature requests for the Stripe Ruby library.
|
||||
|
||||
If you're having general trouble with your Stripe integration, please reach out to support.
|
28
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
28
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: Feature request
|
||||
description: Suggest an idea for this library
|
||||
labels: ["feature-request"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this feature request!
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Is your feature request related to a problem? Please describe.
|
||||
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Describe the solution you'd like
|
||||
description: A clear and concise description of what you want to happen.
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Describe alternatives you've considered
|
||||
description: A clear and concise description of any alternative solutions or features you've considered.
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: Add any other context about the feature request here.
|
11
.github/pull_request_template.md
vendored
Normal file
11
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
### Why?
|
||||
<!-- Describe why this change is being made. Briefly include history and context, high-level what this PR does, and what the world looks like afterward. -->
|
||||
|
||||
### What?
|
||||
<!--
|
||||
List out the key changes made in this PR, e.g.
|
||||
- implements the antimatter particle trace in the nitronium microfilament drive
|
||||
- updated tests -->
|
||||
|
||||
### See Also
|
||||
<!-- Include any links or additional information that help explain this change. -->
|
87
.github/workflows/ci.yml
vendored
Normal file
87
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- beta
|
||||
- sdk-release/**
|
||||
- feature/**
|
||||
tags:
|
||||
- v[0-9]+.[0-9]+.[0-9]+*
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- beta
|
||||
- sdk-release/**
|
||||
- feature/**
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: extractions/setup-just@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3.1
|
||||
- name: Lint
|
||||
run: just lint
|
||||
- name: Build
|
||||
run: gem build stripe.gemspec
|
||||
- name: 'Upload Artifact'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gems
|
||||
path: '*.gem'
|
||||
|
||||
test:
|
||||
name: Test (${{ matrix.ruby-version }})
|
||||
# this version of jruby isn't available in the new latest (24.04) so we have to pin (or update jruby)
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, 3.4, jruby-9.4.0.0, truffleruby-head]
|
||||
steps:
|
||||
- uses: extractions/setup-just@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby-version }}
|
||||
- uses: stripe/openapi/actions/stripe-mock@master
|
||||
- name: test
|
||||
run: just test typecheck
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.github_token }}
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
if: >-
|
||||
((github.event_name == 'workflow_dispatch') || (github.event_name == 'push')) &&
|
||||
startsWith(github.ref, 'refs/tags/v') &&
|
||||
endsWith(github.actor, '-stripe')
|
||||
needs: [build, test]
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Download all workflow run artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: gems
|
||||
path: gems
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3.1
|
||||
- name: Publish gems to Rubygems
|
||||
run: gem push gems/*.gem
|
||||
env:
|
||||
GEM_HOST_API_KEY: ${{secrets.GEM_HOST_API_KEY}}
|
||||
- uses: stripe/openapi/actions/notify-release@master
|
||||
if: always()
|
||||
with:
|
||||
bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
|
21
.github/workflows/rules.yml
vendored
Normal file
21
.github/workflows/rules.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
name: rules
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
types:
|
||||
- auto_merge_enabled
|
||||
|
||||
jobs:
|
||||
require_merge_commit_on_merge_script_pr:
|
||||
name: Merge script PRs must create merge commits
|
||||
if: ${{ contains(github.head_ref, '/merge-') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
if ${{ github.event.pull_request.auto_merge.merge_method != 'merge' }}; then
|
||||
echo "Auto-merge method must be 'merge' instead of '${{github.event.pull_request.auto_merge.merge_method}}'"
|
||||
exit 1
|
||||
fi
|
||||
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -1 +1,9 @@
|
||||
/stripe-*.gem
|
||||
/Gemfile.lock
|
||||
.rvmrc
|
||||
Gemfile.lock
|
||||
tags
|
||||
/.bundle/
|
||||
coverage/
|
||||
.idea/
|
||||
.ruby-version
|
||||
|
398
.rubocop.yml
Normal file
398
.rubocop.yml
Normal file
@ -0,0 +1,398 @@
|
||||
inherit_from: .rubocop_todo.yml
|
||||
|
||||
AllCops:
|
||||
DisplayCopNames: true
|
||||
TargetRubyVersion: 2.3
|
||||
|
||||
Layout/CaseIndentation:
|
||||
EnforcedStyle: end
|
||||
|
||||
Layout/FirstArrayElementIndentation:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
Layout/FirstHashElementIndentation:
|
||||
EnforcedStyle: consistent
|
||||
|
||||
Layout/LineLength:
|
||||
Exclude:
|
||||
- "lib/stripe/object_types.rb"
|
||||
- "lib/stripe/stripe_client.rb"
|
||||
- "lib/stripe/resources/**/*.rb"
|
||||
- "lib/stripe/services/**/*.rb"
|
||||
- "test/**/*.rb"
|
||||
|
||||
Lint/MissingSuper:
|
||||
Exclude:
|
||||
- "lib/stripe/resources/**/*.rb"
|
||||
- "lib/stripe/services/**/*.rb"
|
||||
- "test/stripe/request_params_test.rb"
|
||||
|
||||
Metrics/AbcSize:
|
||||
Enabled: false
|
||||
|
||||
Metrics/BlockLength:
|
||||
Max: 40
|
||||
Exclude:
|
||||
# `context` in tests are blocks and get quite large, so exclude the test
|
||||
# directory from having to adhere to this rule.
|
||||
- "test/**/*.rb"
|
||||
|
||||
Metrics/ClassLength:
|
||||
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/stripe_object.rb"
|
||||
- "lib/stripe/util.rb"
|
||||
|
||||
Metrics/MethodLength:
|
||||
# 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
|
||||
# (but the default of 10 is probably too short).
|
||||
Max: 55
|
||||
Exclude:
|
||||
- "lib/stripe/services/v1_services.rb"
|
||||
- "lib/stripe/event_types.rb"
|
||||
AllowedMethods:
|
||||
- initialize
|
||||
|
||||
# TODO(xavdid): remove this once the first `basil` release is out
|
||||
Naming/MethodName:
|
||||
# these endpoints are removed soon so we pulled their overrides, meaning their names are wrong
|
||||
# that won't make it out to users, but it's breaking linting/formatting in the meantime
|
||||
Exclude:
|
||||
- "lib/stripe/services/invoice_service.rb"
|
||||
- "lib/stripe/resources/invoice.rb"
|
||||
|
||||
Metrics/ModuleLength:
|
||||
Enabled: false
|
||||
|
||||
Metrics/ParameterLists:
|
||||
# There's 2 methods in `StripeClient` that have long parameter lists.
|
||||
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"
|
||||
- "lib/stripe/stripe_client.rb"
|
||||
- "lib/stripe/resources/**/*.rb"
|
||||
- "lib/stripe/services/**/*.rb"
|
||||
|
||||
Naming/MethodParameterName:
|
||||
# We have many parameters that are less than 3 characters for tax codes
|
||||
Exclude:
|
||||
- "lib/stripe/resources/**/*.rb"
|
||||
- "lib/stripe/services/**/*.rb"
|
||||
|
||||
Naming/VariableNumber:
|
||||
# We use a variety of variable number syntaxes
|
||||
Exclude:
|
||||
- "lib/stripe/resources/**/*.rb"
|
||||
- "lib/stripe/services/**/*.rb"
|
||||
|
||||
Style/AccessModifierDeclarations:
|
||||
EnforcedStyle: inline
|
||||
|
||||
Style/AsciiComments:
|
||||
Enabled: false
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
EnforcedStyle: always
|
||||
|
||||
Style/HashEachMethods:
|
||||
Enabled: true
|
||||
|
||||
Style/HashTransformKeys:
|
||||
Enabled: true
|
||||
|
||||
Style/HashTransformValues:
|
||||
Enabled: true
|
||||
|
||||
Style/NumericPredicate:
|
||||
Enabled: false
|
||||
|
||||
Style/StringLiterals:
|
||||
EnforcedStyle: double_quotes
|
||||
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
EnforcedStyleForMultiline: consistent_comma
|
||||
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
EnforcedStyleForMultiline: consistent_comma
|
||||
|
||||
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
|
||||
Enabled: true
|
||||
Gemspec/DevelopmentDependencies: # new in 1.44
|
||||
Enabled: true
|
||||
Gemspec/RequireMFA: # new in 1.23
|
||||
Enabled: false
|
||||
Layout/LineContinuationLeadingSpace: # new in 1.31
|
||||
Enabled: true
|
||||
Layout/LineContinuationSpacing: # new in 1.31
|
||||
Enabled: true
|
||||
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
||||
Enabled: true
|
||||
Layout/SpaceBeforeBrackets: # new in 1.7
|
||||
Enabled: true
|
||||
Lint/AmbiguousAssignment: # new in 1.7
|
||||
Enabled: true
|
||||
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
||||
Enabled: true
|
||||
Lint/AmbiguousRange: # new in 1.19
|
||||
Enabled: true
|
||||
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
||||
Enabled: true
|
||||
Lint/DeprecatedConstants: # new in 1.8
|
||||
Enabled: true
|
||||
Lint/DuplicateBranch: # new in 1.3
|
||||
Enabled: true
|
||||
Lint/DuplicateMagicComment: # new in 1.37
|
||||
Enabled: true
|
||||
Lint/DuplicateMatchPattern: # new in 1.50
|
||||
Enabled: true
|
||||
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
||||
Enabled: true
|
||||
Lint/EmptyBlock: # new in 1.1
|
||||
Enabled: true
|
||||
Lint/EmptyClass: # new in 1.3
|
||||
Enabled: true
|
||||
Lint/EmptyInPattern: # new in 1.16
|
||||
Enabled: true
|
||||
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
||||
Enabled: true
|
||||
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
||||
Enabled: true
|
||||
Lint/MixedCaseRange: # new in 1.53
|
||||
Enabled: true
|
||||
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
||||
Enabled: true
|
||||
Lint/NonAtomicFileOperation: # new in 1.31
|
||||
Enabled: true
|
||||
Lint/NumberedParameterAssignment: # new in 1.9
|
||||
Enabled: true
|
||||
Lint/OrAssignmentToConstant: # new in 1.9
|
||||
Enabled: true
|
||||
Lint/RedundantDirGlobSort: # new in 1.8
|
||||
Enabled: true
|
||||
Lint/RedundantRegexpQuantifiers: # new in 1.53
|
||||
Enabled: true
|
||||
Lint/RefinementImportMethods: # new in 1.27
|
||||
Enabled: true
|
||||
Lint/RequireRangeParentheses: # new in 1.32
|
||||
Enabled: true
|
||||
Lint/RequireRelativeSelfPath: # new in 1.22
|
||||
Enabled: true
|
||||
Lint/SymbolConversion: # new in 1.9
|
||||
Enabled: true
|
||||
Lint/ToEnumArguments: # new in 1.1
|
||||
Enabled: true
|
||||
Lint/TripleQuotes: # new in 1.9
|
||||
Enabled: true
|
||||
Lint/UnexpectedBlockArity: # new in 1.5
|
||||
Enabled: true
|
||||
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
||||
Enabled: true
|
||||
Lint/UselessAssignment:
|
||||
Exclude:
|
||||
- "test/stripe/generated_examples_test.rb"
|
||||
Lint/UselessRescue: # new in 1.43
|
||||
Enabled: true
|
||||
Lint/UselessRuby2Keywords: # new in 1.23
|
||||
Enabled: true
|
||||
Metrics/CollectionLiteralLength: # new in 1.47
|
||||
Enabled: true
|
||||
Naming/BlockForwarding: # new in 1.24
|
||||
Enabled: true
|
||||
Security/CompoundHash: # new in 1.28
|
||||
Enabled: true
|
||||
Security/IoMethods: # new in 1.22
|
||||
Enabled: true
|
||||
Style/ArgumentsForwarding: # new in 1.1
|
||||
Enabled: true
|
||||
Style/ArrayIntersect: # new in 1.40
|
||||
Enabled: true
|
||||
Style/CollectionCompact: # new in 1.2
|
||||
Enabled: true
|
||||
Style/ComparableClamp: # new in 1.44
|
||||
Enabled: true
|
||||
Style/ConcatArrayLiterals: # new in 1.41
|
||||
Enabled: true
|
||||
Style/DataInheritance: # new in 1.49
|
||||
Enabled: true
|
||||
Style/DirEmpty: # new in 1.48
|
||||
Enabled: true
|
||||
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
||||
Enabled: true
|
||||
Style/EmptyHeredoc: # new in 1.32
|
||||
Enabled: true
|
||||
Style/EndlessMethod: # new in 1.8
|
||||
Enabled: true
|
||||
Style/EnvHome: # new in 1.29
|
||||
Enabled: true
|
||||
Style/ExactRegexpMatch: # new in 1.51
|
||||
Enabled: true
|
||||
Style/FetchEnvVar: # new in 1.28
|
||||
Enabled: true
|
||||
Style/FileEmpty: # new in 1.48
|
||||
Enabled: true
|
||||
Style/FileRead: # new in 1.24
|
||||
Enabled: true
|
||||
Style/FileWrite: # new in 1.24
|
||||
Enabled: true
|
||||
Style/HashConversion: # new in 1.10
|
||||
Enabled: true
|
||||
Style/HashExcept: # new in 1.7
|
||||
Enabled: true
|
||||
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
||||
Enabled: true
|
||||
Style/InPatternThen: # new in 1.16
|
||||
Enabled: true
|
||||
Style/MagicCommentFormat: # new in 1.35
|
||||
Enabled: true
|
||||
Style/MapCompactWithConditionalBlock: # new in 1.30
|
||||
Enabled: true
|
||||
Style/MapToHash: # new in 1.24
|
||||
Enabled: true
|
||||
Style/MapToSet: # new in 1.42
|
||||
Enabled: true
|
||||
Style/MinMaxComparison: # new in 1.42
|
||||
Enabled: true
|
||||
Style/MultilineInPatternThen: # new in 1.16
|
||||
Enabled: true
|
||||
Style/NegatedIfElseCondition: # new in 1.2
|
||||
Enabled: true
|
||||
Style/NestedFileDirname: # new in 1.26
|
||||
Enabled: true
|
||||
Style/NilLambda: # new in 1.3
|
||||
Enabled: true
|
||||
Style/NumberedParameters: # new in 1.22
|
||||
Enabled: true
|
||||
Style/NumberedParametersLimit: # new in 1.22
|
||||
Enabled: true
|
||||
Style/ObjectThen: # new in 1.28
|
||||
Enabled: true
|
||||
Style/OpenStructUse: # new in 1.23
|
||||
Enabled: true
|
||||
Style/OperatorMethodCall: # new in 1.37
|
||||
Enabled: true
|
||||
Style/QuotedSymbols: # new in 1.16
|
||||
Enabled: true
|
||||
Style/RedundantArgument: # new in 1.4
|
||||
Enabled: true
|
||||
Style/RedundantArrayConstructor: # new in 1.52
|
||||
Enabled: true
|
||||
Style/RedundantConstantBase: # new in 1.40
|
||||
Enabled: true
|
||||
Style/RedundantCurrentDirectoryInPath: # new in 1.53
|
||||
Enabled: true
|
||||
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
||||
Enabled: true
|
||||
Style/RedundantEach: # new in 1.38
|
||||
Enabled: true
|
||||
Style/RedundantFilterChain: # new in 1.52
|
||||
Enabled: true
|
||||
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
||||
Enabled: true
|
||||
Style/RedundantInitialize: # new in 1.27
|
||||
Enabled: true
|
||||
Style/RedundantLineContinuation: # new in 1.49
|
||||
Enabled: true
|
||||
Style/RedundantRegexpArgument: # new in 1.53
|
||||
Enabled: true
|
||||
Style/RedundantRegexpConstructor: # new in 1.52
|
||||
Enabled: true
|
||||
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
||||
Enabled: true
|
||||
Style/RedundantStringEscape: # new in 1.37
|
||||
Enabled: true
|
||||
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
|
||||
Enabled: true
|
||||
Style/SelectByRegexp: # new in 1.22
|
||||
Enabled: true
|
||||
Style/SingleLineDoEndBlock: # new in 1.57
|
||||
Enabled: true
|
||||
Style/StringChars: # new in 1.12
|
||||
Enabled: true
|
||||
Style/SwapValues: # new in 1.1
|
||||
Enabled: true
|
||||
Style/YAMLFileRead: # new in 1.53
|
||||
Enabled: true
|
||||
Gemspec/AddRuntimeDependency: # new in 1.65
|
||||
Enabled: true
|
||||
Lint/ArrayLiteralInRegexp: # new in 1.71
|
||||
Enabled: true
|
||||
Lint/ConstantReassignment: # new in 1.70
|
||||
Enabled: true
|
||||
Lint/CopDirectiveSyntax: # new in 1.72
|
||||
Enabled: true
|
||||
Lint/DuplicateSetElement: # new in 1.67
|
||||
Enabled: true
|
||||
Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
|
||||
Enabled: true
|
||||
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
||||
Enabled: true
|
||||
Lint/LiteralAssignmentInCondition: # new in 1.58
|
||||
Enabled: true
|
||||
Lint/NumericOperationWithConstantResult: # new in 1.69
|
||||
Enabled: true
|
||||
Lint/RedundantTypeConversion: # new in 1.72
|
||||
Enabled: true
|
||||
Lint/SharedMutableDefault: # new in 1.70
|
||||
Enabled: true
|
||||
Lint/SuppressedExceptionInNumberConversion: # new in 1.72
|
||||
Enabled: true
|
||||
Lint/UnescapedBracketInRegexp: # new in 1.68
|
||||
Enabled: true
|
||||
Lint/UselessConstantScoping: # new in 1.72
|
||||
Enabled: true
|
||||
Lint/UselessDefined: # new in 1.69
|
||||
Enabled: true
|
||||
Lint/UselessNumericOperation: # new in 1.66
|
||||
Enabled: true
|
||||
Style/AmbiguousEndlessMethodDefinition: # new in 1.68
|
||||
Enabled: true
|
||||
Style/BitwisePredicate: # new in 1.68
|
||||
Enabled: true
|
||||
Style/CombinableDefined: # new in 1.68
|
||||
Enabled: true
|
||||
Style/ComparableBetween: # new in 1.74
|
||||
Enabled: true
|
||||
Style/DigChain: # new in 1.69
|
||||
Enabled: true
|
||||
Style/FileNull: # new in 1.69
|
||||
Enabled: true
|
||||
Style/FileTouch: # new in 1.69
|
||||
Enabled: true
|
||||
Style/HashFetchChain: # new in 1.75
|
||||
Enabled: true
|
||||
Style/HashSlice: # new in 1.71
|
||||
Enabled: true
|
||||
Style/ItAssignment: # new in 1.70
|
||||
Enabled: true
|
||||
Style/ItBlockParameter: # new in 1.75
|
||||
Enabled: true
|
||||
Style/KeywordArgumentsMerging: # new in 1.68
|
||||
Enabled: true
|
||||
Style/MapIntoArray: # new in 1.63
|
||||
Enabled: true
|
||||
Style/RedundantFormat: # new in 1.72
|
||||
Enabled: true
|
||||
Style/RedundantInterpolationUnfreeze: # new in 1.66
|
||||
Enabled: true
|
||||
Style/SafeNavigationChainLength: # new in 1.68
|
||||
Enabled: true
|
||||
Style/SendWithLiteralMethodName: # new in 1.64
|
||||
Enabled: true
|
||||
Style/SuperArguments: # new in 1.64
|
||||
Enabled: true
|
||||
Style/SuperWithArgsParentheses: # new in 1.58
|
||||
Enabled: true
|
87
.rubocop_todo.yml
Normal file
87
.rubocop_todo.yml
Normal file
@ -0,0 +1,87 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2023-11-28 01:02:03 UTC using RuboCop version 1.57.2.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 2
|
||||
Lint/HashCompareByIdentity:
|
||||
Exclude:
|
||||
- 'lib/stripe/api_requestor.rb'
|
||||
|
||||
# Offense count: 26
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
Max: 50
|
||||
|
||||
# Offense count: 9
|
||||
# Configuration parameters: CountComments, CountAsOne.
|
||||
Metrics/ClassLength:
|
||||
Max: 592
|
||||
|
||||
# Offense count: 12
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 12
|
||||
|
||||
# Offense count: 9
|
||||
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
||||
Metrics/ParameterLists:
|
||||
Max: 7
|
||||
|
||||
# Offense count: 8
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 12
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: MinBranchesCount.
|
||||
Style/CaseLikeIf:
|
||||
Exclude:
|
||||
- 'lib/stripe/stripe_configuration.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
Style/CombinableLoops:
|
||||
Exclude:
|
||||
- 'lib/stripe/api_requestor.rb'
|
||||
|
||||
# Offense count: 39
|
||||
# Configuration parameters: AllowedConstants.
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: AllowSplatArgument.
|
||||
Style/HashConversion:
|
||||
Exclude:
|
||||
- 'lib/stripe/api_requestor.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
||||
# AllowedMethods: present?, blank?, presence, try, try!
|
||||
Style/SafeNavigation:
|
||||
Exclude:
|
||||
- 'lib/stripe/instrumentation.rb'
|
||||
- 'lib/stripe/stripe_response.rb'
|
||||
|
||||
# Offense count: 15
|
||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||
# Configuration parameters: Mode.
|
||||
Style/StringConcatenation:
|
||||
Exclude:
|
||||
- 'lib/stripe.rb'
|
||||
- 'lib/stripe/connection_manager.rb'
|
||||
- 'lib/stripe/multipart_encoder.rb'
|
||||
- 'lib/stripe/oauth.rb'
|
||||
- 'lib/stripe/resources/bank_account.rb'
|
||||
- 'lib/stripe/resources/source.rb'
|
||||
- 'lib/stripe/api_requestor.rb'
|
||||
- 'test/stripe/api_resource_test.rb'
|
||||
- 'test/stripe/stripe_client_test.rb'
|
||||
- 'test/stripe/webhook_test.rb'
|
9
.vscode/extensions.json
vendored
Normal file
9
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"EditorConfig.editorconfig", // default
|
||||
"castwide.solargraph", // intellisense
|
||||
"sorbet.sorbet-vscode-extension", // typechecking, where applicable
|
||||
"LoranKloeze.ruby-rubocop-revived", // linting
|
||||
"SarahRidge.vscode-ruby-syntax" // Semantic syntax highlighting
|
||||
]
|
||||
}
|
11
.vscode/settings.json
vendored
Normal file
11
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
// Show the repo name in the top window bar.
|
||||
"window.title": "${rootName}${separator}${activeEditorMedium}",
|
||||
|
||||
"editor.formatOnSave": true,
|
||||
"files.trimTrailingWhitespace": true,
|
||||
|
||||
// Rubocop settings
|
||||
"ruby.rubocop.configFilePath": ".rubocop.yml",
|
||||
"ruby.rubocop.onSave": true
|
||||
}
|
1704
CHANGELOG.md
Normal file
1704
CHANGELOG.md
Normal file
File diff suppressed because it is too large
Load Diff
77
CODE_OF_CONDUCT.md
Normal file
77
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,77 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to make participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces, and it also applies when
|
||||
an individual is representing the project or its community in public spaces.
|
||||
Examples of representing a project or community include using an official
|
||||
project e-mail address, posting via an official social media account, or acting
|
||||
as an appointed representative at an online or offline event. Representation of
|
||||
a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at conduct@stripe.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
|
25
CONTRIBUTING.md
Normal file
25
CONTRIBUTING.md
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
# Contributing
|
||||
|
||||
We welcome bug reports, feature requests, and code contributions in a pull request.
|
||||
|
||||
For most pull requests, we request that you identify or create an associated issue that has the necessary context. We use these issues to reach agreement on an approach and save the PR author from having to redo work. Fixing typos or documentation issues likely do not need an issue; for any issue that introduces substantial code changes, changes the public interface, or if you aren't sure, please find or [create an issue](https://www.github.com/stripe/stripe-ruby/issues/new/choose).
|
||||
|
||||
## Contributor License Agreement
|
||||
|
||||
All contributors must sign the Contributor License Agreement (CLA) before we can accept their contribution. If you have not yet signed the agreement, you will be given an option to do so when you open a pull request. You can then sign by clicking on the badge in the comment from @CLAassistant.
|
||||
|
||||
## Generated code
|
||||
|
||||
This project has a combination of manually maintained code and code generated from our private code generator. If your contribution involves changes to generated code, please call this out in the issue or pull request as we will likely need to make a change to our code generator before accepting the contribution.
|
||||
|
||||
To identify files with purely generated code, look for the comment `File generated from our OpenAPI spec.` at the start of the file. Generated blocks of code within hand-written files will be between comments that say `The beginning of the section generated from our OpenAPI spec` and `The end of the section generated from our OpenAPI spec`.
|
||||
|
||||
## Compatibility with supported language and runtime versions
|
||||
|
||||
This project supports [many different langauge and runtime versions](README.md#requirements) and we are unable to accept any contribution that does not work on _all_ supported versions. If, after discussing the approach in the associated issue, your change must use an API / feature that isn't available in all supported versions, please call this out explicitly in the issue or pull request so we can help figure out the best way forward.
|
||||
|
||||
## Set up your dev environment
|
||||
|
||||
Please refer to this project's [README.md](README.md#development) for instructions on how to set up your development environment.
|
||||
|
3
CONTRIBUTORS
Normal file
3
CONTRIBUTORS
Normal file
@ -0,0 +1,3 @@
|
||||
Greg Brockman <gdb@gregbrockman.com>
|
||||
Ross Boucher <rboucher@gmail.com>
|
||||
Bradley Grzesiak <brad@bendyworks.com>
|
41
Gemfile
Normal file
41
Gemfile
Normal file
@ -0,0 +1,41 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gemspec
|
||||
|
||||
group :development do
|
||||
gem "mocha", "~> 1.16.0"
|
||||
gem "rack", ">= 2.0.6"
|
||||
gem "rake"
|
||||
|
||||
gem "shoulda-context", "2.0.0"
|
||||
|
||||
gem "test-unit"
|
||||
|
||||
# Version doesn't matter that much, but this one contains some fixes for Ruby
|
||||
# 2.7 warnings that add noise to the test suite.
|
||||
gem "webmock", ">= 3.8.0"
|
||||
|
||||
# Rubocop changes pretty quickly: new cops get added and old cops change
|
||||
# names or go into new namespaces. This is a library and we don't have
|
||||
# `Gemfile.lock` checked in, so to prevent good builds from suddenly going
|
||||
# bad, pin to a specific version number here. Try to keep this relatively
|
||||
# up-to-date, but it's not the end of the world if it's not.
|
||||
#
|
||||
# The latest version of rubocop is only compatible with Ruby 2.7+
|
||||
gem "rubocop", "1.75.2" if RUBY_VERSION >= "2.7"
|
||||
|
||||
gem "sorbet"
|
||||
gem "tapioca"
|
||||
|
||||
platforms :mri do
|
||||
gem "byebug"
|
||||
gem "pry"
|
||||
gem "pry-byebug"
|
||||
end
|
||||
|
||||
platforms :jruby do
|
||||
gem "rbi", "0.2.4" # jruby does not support rbs, a new dependency in 0.3.0
|
||||
end
|
||||
end
|
25
History.txt
25
History.txt
@ -1,24 +1 @@
|
||||
=== 1.5.0 2011-05-09
|
||||
|
||||
* 1 major enhancement:
|
||||
* Update for new RESTful API
|
||||
|
||||
=== 1.3.4 2011-01-07
|
||||
|
||||
* 1 major enhancement:
|
||||
* Rename to Stripe
|
||||
|
||||
=== 1.2 2010-06-06
|
||||
|
||||
* 1 major enhancement:
|
||||
* Support for the set_customer_subscription and delete_customer API methods
|
||||
|
||||
=== 1.1 2010-03-14
|
||||
|
||||
* 1 major enhancement:
|
||||
* Support for recurring billing
|
||||
|
||||
=== 1.0 2010-01-05
|
||||
|
||||
* 1 major enhancement:
|
||||
* Initial release
|
||||
History.txt has been converted to a formal changelog. Please see CHANGELOG.md.
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010 Stripe (https://stripe.com)
|
||||
Copyright (c) 2011- Stripe, Inc. (https://stripe.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
22
Makefile
Normal file
22
Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
# NOTE: this file is deprecated and slated for deletion; prefer using the equivalent `just` commands.
|
||||
|
||||
.PHONY: update-version codegen-format test ci-test
|
||||
update-version:
|
||||
@echo "$(VERSION)" > VERSION
|
||||
@perl -pi -e 's|VERSION = "[.\-\w\d]+"|VERSION = "$(VERSION)"|' lib/stripe/version.rb
|
||||
|
||||
codegen-format:
|
||||
bundle install --quiet
|
||||
bundle exec rubocop -o /dev/null --autocorrect
|
||||
|
||||
ci-test:
|
||||
bundle install && bundle exec rake test
|
||||
@version=$$(ruby -e "puts RUBY_VERSION.split('.')[0..1].join.to_i"); \
|
||||
if [ $$version -ge 27 ]; then \
|
||||
echo "Ruby version >= 2.7, continue with srb tc"; \
|
||||
bundle exec srb tc; \
|
||||
else \
|
||||
echo "Ruby version < 2.7, skipping srb tc"; \
|
||||
fi
|
||||
|
||||
test: ci-test
|
1
OPENAPI_VERSION
Normal file
1
OPENAPI_VERSION
Normal file
@ -0,0 +1 @@
|
||||
v1773
|
460
README.md
Normal file
460
README.md
Normal file
@ -0,0 +1,460 @@
|
||||
# Stripe Ruby Library
|
||||
|
||||
[](https://badge.fury.io/rb/stripe)
|
||||
[](https://github.com/stripe/stripe-ruby/actions?query=branch%3Amaster)
|
||||
|
||||
The Stripe Ruby library provides convenient access to the Stripe API from
|
||||
applications written in the Ruby language. It includes a pre-defined set of
|
||||
classes for API resources that initialize themselves dynamically from API
|
||||
responses which makes it compatible with a wide range of versions of the Stripe
|
||||
API.
|
||||
|
||||
The library also provides other features. For example:
|
||||
|
||||
- Easy configuration path for fast setup and use.
|
||||
- Helpers for pagination.
|
||||
- Built-in mechanisms for the serialization of parameters according to the
|
||||
expectations of Stripe's API.
|
||||
|
||||
## Documentation
|
||||
|
||||
See the [Ruby API docs](https://stripe.com/docs/api?lang=ruby).
|
||||
|
||||
## Installation
|
||||
|
||||
You don't need this source code unless you want to modify the gem. If you just
|
||||
want to use the package, just run:
|
||||
|
||||
```sh
|
||||
gem install stripe
|
||||
```
|
||||
|
||||
If you want to build the gem from source:
|
||||
|
||||
```sh
|
||||
gem build stripe.gemspec
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
- Ruby 2.3+.
|
||||
|
||||
### Bundler
|
||||
|
||||
If you are installing via bundler, you should be sure to use the https rubygems
|
||||
source in your Gemfile, as any gems fetched over http could potentially be
|
||||
compromised in transit and alter the code of gems fetched securely over https:
|
||||
|
||||
```ruby
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rails'
|
||||
gem 'stripe'
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The library needs to be configured with your account's secret key which is
|
||||
available in your [Stripe Dashboard][api-keys]. Set `Stripe.api_key` to its
|
||||
value:
|
||||
|
||||
```ruby
|
||||
require 'stripe'
|
||||
Stripe.api_key = 'sk_test_...'
|
||||
|
||||
# list customers
|
||||
Stripe::Customer.list()
|
||||
|
||||
# retrieve single customer
|
||||
Stripe::Customer.retrieve('cus_123456789')
|
||||
```
|
||||
|
||||
### Per-request Configuration
|
||||
|
||||
For apps that need to use multiple keys during the lifetime of a process, like
|
||||
one that uses [Stripe Connect][connect], it's also possible to set a
|
||||
per-request key and/or account:
|
||||
|
||||
```ruby
|
||||
require "stripe"
|
||||
|
||||
Stripe::Customer.list(
|
||||
{},
|
||||
{
|
||||
api_key: 'sk_test_...',
|
||||
stripe_account: 'acct_...',
|
||||
stripe_version: '2018-02-28',
|
||||
}
|
||||
)
|
||||
|
||||
Stripe::Customer.retrieve(
|
||||
'cus_123456789',
|
||||
{
|
||||
api_key: 'sk_test_...',
|
||||
stripe_account: 'acct_...',
|
||||
stripe_version: '2018-02-28',
|
||||
}
|
||||
)
|
||||
|
||||
Stripe::Customer.retrieve(
|
||||
{
|
||||
id: 'cus_123456789',
|
||||
expand: %w(balance_transaction)
|
||||
},
|
||||
{
|
||||
stripe_version: '2018-02-28',
|
||||
api_key: 'sk_test_...',
|
||||
}
|
||||
)
|
||||
|
||||
Stripe::Customer.capture(
|
||||
'cus_123456789',
|
||||
{},
|
||||
{
|
||||
stripe_version: '2018-02-28',
|
||||
api_key: 'sk_test_...',
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
Keep in mind that there are different method signatures depending on the action:
|
||||
|
||||
- When operating on a collection (e.g. `.list`, `.create`) the method signature is
|
||||
`method(params, opts)`.
|
||||
- When operating on resource (e.g. `.capture`, `.update`) the method signature is
|
||||
`method(id, params, opts)`.
|
||||
- One exception is that `retrieve`, despite being an operation on a resource, has the signature
|
||||
`retrieve(id, opts)`. In addition, it will accept a Hash for the `id` param but will extract the
|
||||
`id` key out and use the others as options.
|
||||
|
||||
### StripeClient vs legacy pattern
|
||||
|
||||
We introduced the `StripeClient` class in v13 of the Ruby SDK. The legacy pattern used prior to that version is still available to use but will be marked as deprecated soon. Review the [migration guide to use StripeClient](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v13) to move from the legacy pattern.
|
||||
|
||||
Once the legacy pattern is deprecated, new API endpoints will only be accessible in the StripeClient. While there are no current plans to remove the legacy pattern for existing API endpoints, this may change in the future.
|
||||
|
||||
### Accessing resource properties
|
||||
|
||||
Both indexer and accessors can be used to retrieve values of resource properties.
|
||||
|
||||
```ruby
|
||||
customer = Stripe::Customer.retrieve('cus_123456789')
|
||||
puts customer['id']
|
||||
puts customer.id
|
||||
```
|
||||
|
||||
NOTE: If the resource property is not defined, the accessors will raise an exception, while the indexer will return `nil`.
|
||||
|
||||
```ruby
|
||||
customer = Stripe::Customer.retrieve('cus_123456789')
|
||||
puts customer['unknown'] # nil
|
||||
puts customer.unknown # raises NoMethodError
|
||||
```
|
||||
|
||||
### Accessing a response object
|
||||
|
||||
Get access to response objects by using the `last_response` property of the returned resource:
|
||||
|
||||
```ruby
|
||||
customer = Stripe::Customer.retrieve('cus_123456789')
|
||||
|
||||
print(customer.last_response.http_status) # to retrieve status code
|
||||
print(customer.last_response.http_headers) # to retrieve headers
|
||||
```
|
||||
|
||||
If you are accessing a response field with custom hashes provided by you, such as `Customer.metadata`,
|
||||
please access your fields with the `[]` accessor.
|
||||
|
||||
### Configuring a proxy
|
||||
|
||||
A proxy can be configured with `Stripe.proxy`:
|
||||
|
||||
```ruby
|
||||
Stripe.proxy = 'https://user:pass@example.com:1234'
|
||||
```
|
||||
|
||||
### Configuring an API Version
|
||||
|
||||
By default, the library will use the API version pinned to the account making
|
||||
a request. This can be overridden with this global option:
|
||||
|
||||
```ruby
|
||||
Stripe.api_version = '2018-02-28'
|
||||
```
|
||||
|
||||
See [versioning in the API reference][versioning] for more information.
|
||||
|
||||
### Configuring CA Bundles
|
||||
|
||||
By default, the library will use its own internal bundle of known CA
|
||||
certificates, but it's possible to configure your own:
|
||||
|
||||
```ruby
|
||||
Stripe.ca_bundle_path = 'path/to/ca/bundle'
|
||||
```
|
||||
|
||||
### Configuring Automatic Retries
|
||||
|
||||
You can enable automatic retries on requests that fail due to a transient
|
||||
problem by configuring the maximum number of retries:
|
||||
|
||||
```ruby
|
||||
Stripe.max_network_retries = 2
|
||||
```
|
||||
|
||||
Various errors can trigger a retry, like a connection error or a timeout, and
|
||||
also certain API responses like HTTP status `409 Conflict`.
|
||||
|
||||
[Idempotency keys][idempotency-keys] are added to requests to guarantee that
|
||||
retries are safe.
|
||||
|
||||
### Configuring Timeouts
|
||||
|
||||
Open, read and write timeouts are configurable:
|
||||
|
||||
```ruby
|
||||
Stripe.open_timeout = 30 # in seconds
|
||||
Stripe.read_timeout = 80
|
||||
Stripe.write_timeout = 30 # only supported on Ruby 2.6+
|
||||
```
|
||||
|
||||
Please take care to set conservative read timeouts. Some API requests can take
|
||||
some time, and a short timeout increases the likelihood of a problem within our
|
||||
servers.
|
||||
|
||||
### Logging
|
||||
|
||||
The library can be configured to emit logging that will give you better insight
|
||||
into what it's doing. The `info` logging level is usually most appropriate for
|
||||
production use, but `debug` is also available for more verbosity.
|
||||
|
||||
There are a few options for enabling it:
|
||||
|
||||
1. Set the environment variable `STRIPE_LOG` to the value `debug` or `info`:
|
||||
|
||||
```sh
|
||||
$ export STRIPE_LOG=info
|
||||
```
|
||||
|
||||
2. Set `Stripe.log_level`:
|
||||
|
||||
```ruby
|
||||
Stripe.log_level = Stripe::LEVEL_INFO
|
||||
```
|
||||
|
||||
### Instrumentation
|
||||
|
||||
The library has various hooks that user code can tie into by passing a block to
|
||||
`Stripe::Instrumentation.subscribe` to be notified about specific events.
|
||||
|
||||
#### `request_begin`
|
||||
|
||||
Invoked when an HTTP request starts. Receives `RequestBeginEvent` with the
|
||||
following properties:
|
||||
|
||||
- `method`: HTTP method. (`Symbol`)
|
||||
- `path`: Request path. (`String`)
|
||||
- `user_data`: A hash on which users can set arbitrary data, and which will be
|
||||
passed through to `request_end` invocations. This could be used, for example,
|
||||
to assign unique IDs to each request, and it'd work even if many requests are
|
||||
running in parallel. All subscribers share the same object for any particular
|
||||
request, so they must be careful to use unique keys that will not conflict
|
||||
with other subscribers. (`Hash`)
|
||||
|
||||
#### `request_end`
|
||||
|
||||
Invoked when an HTTP request finishes, regardless of whether it terminated with
|
||||
a success or error. Receives `RequestEndEvent` with the following properties:
|
||||
|
||||
- `duration`: Request duration in seconds. (`Float`)
|
||||
- `http_status`: HTTP response code (`Integer`) if available, or `nil` in case
|
||||
of a lower level network error.
|
||||
- `method`: HTTP method. (`Symbol`)
|
||||
- `num_retries`: The number of retries. (`Integer`)
|
||||
- `path`: Request path. (`String`)
|
||||
- `user_data`: A hash on which users may have set arbitrary data in
|
||||
`request_begin`. See above for more information. (`Hash`)
|
||||
- `request_id`: HTTP request identifier. (`String`)
|
||||
- `response_header`: The response headers. (`Hash`)
|
||||
- `response_body` = The response body. (`String`)
|
||||
- `request_header` = The request headers. (`Hash`)
|
||||
- `request_body` = The request body. (`String`)
|
||||
|
||||
#### Example
|
||||
|
||||
For example:
|
||||
|
||||
```ruby
|
||||
Stripe::Instrumentation.subscribe(:request_end) do |request_event|
|
||||
# Filter out high-cardinality ids from `path`
|
||||
path_parts = request_event.path.split("/").drop(2)
|
||||
resource = path_parts.map { |part| part.match?(/\A[a-z_]+\z/) ? part : ":id" }.join("/")
|
||||
|
||||
tags = {
|
||||
method: request_event.method,
|
||||
resource: resource,
|
||||
code: request_event.http_status,
|
||||
retries: request_event.num_retries
|
||||
}
|
||||
StatsD.distribution('stripe_request', request_event.duration, tags: tags)
|
||||
end
|
||||
```
|
||||
|
||||
### Writing a Plugin
|
||||
|
||||
If you're writing a plugin that uses the library, we'd appreciate it if you
|
||||
identified using `#set_app_info`:
|
||||
|
||||
```ruby
|
||||
Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesomeplugin.info')
|
||||
```
|
||||
|
||||
This information is passed along when the library makes calls to the Stripe
|
||||
API.
|
||||
|
||||
### Telemetry
|
||||
|
||||
By default, the library sends telemetry to Stripe regarding request latency and feature usage. These
|
||||
numbers help Stripe improve the overall latency of its API for all users, and
|
||||
improve popular features.
|
||||
|
||||
You can disable this behavior if you prefer:
|
||||
|
||||
```ruby
|
||||
Stripe.enable_telemetry = false
|
||||
```
|
||||
|
||||
### Types
|
||||
|
||||
In [v14.0.0](https://github.com/stripe/stripe-python/releases/tag/v7.1.0) and newer, the library provides RBI
|
||||
static type annotations. See [the wiki](https://github.com/stripe/stripe-ruby/wiki/Static-Type-Annotations)
|
||||
for an detailed guide.
|
||||
|
||||
Please note that these types are available only for static analysis and we only support RBIs at the moment.
|
||||
Please [report an issue](https://github.com/stripe/stripe-ruby/issues/new/choose)
|
||||
if you find discrepancies or have issues using types.
|
||||
|
||||
The RBIs can be found in the `rbi/stripe/` directory, and to decrease `Tapioca` loading time we pack the gem with the
|
||||
combined RBI at `rbi/stripe.rbi`.
|
||||
|
||||
#### Types and the Versioning Policy
|
||||
|
||||
We release type changes in minor releases. While stripe-ruby follows semantic versioning, our semantic
|
||||
versions describe the runtime behavior of the library alone. Our type annotations are not reflected in the
|
||||
semantic version. That is, upgrading to a new minor version of `stripe-ruby` might result in your type checker
|
||||
producing a type error that it didn't before. You can use `~> x.x` or `x.x.x` constrain the version
|
||||
of `stripe-ruby` in your Gemfile to a certain version or range of `stripe-ruby`.
|
||||
|
||||
#### Types and API Versions
|
||||
|
||||
The types describe the [Stripe API version](https://stripe.com/docs/api/versioning)
|
||||
that was the latest at the time of release. This is the version that your library sends
|
||||
by default. If you are overriding `Stripe.api_version` / `stripe_version` on the StripeClient,
|
||||
or using a webhook endpoint tied to an older version, be aware that the data
|
||||
you see at runtime may not match the types.
|
||||
|
||||
### Public Preview SDKs
|
||||
|
||||
Stripe has features in the [public preview phase](https://docs.stripe.com/release-phases) that can be accessed via versions of this package that have the `-beta.X` suffix like `11.2.0-beta.2`.
|
||||
We would love for you to try these as we incrementally release new features and improve them based on your feedback.
|
||||
|
||||
To install, choose the version that includes support for the preview feature you are interested in by reviewing the [releases page](https://github.com/stripe/stripe-ruby/releases/) and use it in the `gem install` command:
|
||||
|
||||
```sh
|
||||
gem install stripe -v <replace-with-the-version-of-your-choice>
|
||||
```
|
||||
|
||||
You can find the latest version to use in this command from the [releases page](https://github.com/stripe/stripe-ruby/releases/)
|
||||
|
||||
> **Note**
|
||||
> There can be breaking changes between two versions of the public preview SDKs without a bump in the major version. Therefore we recommend pinning the package version to a specific version in your Gemfile. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest version of the public preview SDK.
|
||||
|
||||
We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.
|
||||
|
||||
Some preview features require a name and version to be set in the `Stripe-Version` header like `feature_beta=v3`. If your preview feature has this requirement, use the `Stripe.add_beta_version` function (available only in the public preview SDKs):
|
||||
|
||||
```python
|
||||
Stripe.add_beta_version("feature_beta", "v3")
|
||||
```
|
||||
|
||||
### Custom requests
|
||||
|
||||
If you:
|
||||
|
||||
- would like to send a request to an undocumented API (for example you are in a private beta)
|
||||
- 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
|
||||
|
||||
you can now use the `raw_request` method on `StripeClient`.
|
||||
|
||||
```ruby
|
||||
client = Stripe::StripeClient.new(...)
|
||||
resp = client.raw_request(:post, "/v1/beta_endpoint", params: {param: 123}, opts: {stripe_version: "2022-11-15; feature_beta=v3"})
|
||||
|
||||
# (Optional) resp is a StripeResponse. You can use `Stripe.deserialize` to get a StripeObject.
|
||||
deserialized_resp = client.deserialize(resp.http_body)
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
New features and bug fixes are released on the latest major version of the Stripe Ruby library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
|
||||
|
||||
## Development
|
||||
|
||||
[Contribution guidelines for this project](CONTRIBUTING.md)
|
||||
|
||||
The test suite depends on [stripe-mock], so make sure to fetch and run it from a background terminal ([stripe-mock's README][stripe-mock] also contains instructions for installing via Homebrew and other methods):
|
||||
|
||||
```sh
|
||||
go install github.com/stripe/stripe-mock@latest
|
||||
stripe-mock
|
||||
```
|
||||
|
||||
We use [just](https://github.com/casey/just) for common development tasks. You can install it or run the underlying commands directly (by copying them from the `justfile`). Common tasks include:
|
||||
|
||||
Run all tests:
|
||||
|
||||
```sh
|
||||
just test
|
||||
# or: bundle exec rake test
|
||||
```
|
||||
|
||||
Run a single test suite:
|
||||
|
||||
```sh
|
||||
bundle exec ruby -Ilib/ test/stripe/util_test.rb
|
||||
```
|
||||
|
||||
Run a single test:
|
||||
|
||||
```sh
|
||||
bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.symbols/
|
||||
```
|
||||
|
||||
Run the linter:
|
||||
|
||||
```sh
|
||||
just lint
|
||||
# or: bundle exec rubocop
|
||||
```
|
||||
|
||||
Update bundled CA certificates from the [Mozilla cURL release][curl]:
|
||||
|
||||
```sh
|
||||
just update-certs
|
||||
# or: bundle exec rake update_certs
|
||||
```
|
||||
|
||||
Update the bundled [stripe-mock] by editing the version number found in
|
||||
`.travis.yml`.
|
||||
|
||||
[api-keys]: https://dashboard.stripe.com/account/apikeys
|
||||
[connect]: https://stripe.com/connect
|
||||
[curl]: http://curl.haxx.se/docs/caextract.html
|
||||
[idempotency-keys]: https://stripe.com/docs/api/idempotent_requests?lang=ruby
|
||||
[stripe-mock]: https://github.com/stripe/stripe-mock
|
||||
[versioning]: https://stripe.com/docs/api/versioning?lang=ruby
|
||||
|
||||
<!--
|
||||
# vim: set tw=79:
|
||||
-->
|
15
README.rdoc
15
README.rdoc
@ -1,15 +0,0 @@
|
||||
= Stripe Ruby bindings
|
||||
|
||||
== Installation
|
||||
|
||||
You don't need this source code unless you want to modify the gem. If you just want to use the Stripe Ruby bindings, you should run:
|
||||
|
||||
sudo gem install --source https://gems.stripe.com stripe
|
||||
|
||||
If you want to build the gem from source:
|
||||
|
||||
sudo gem build stripe.gemspec
|
||||
|
||||
== REQUIREMENTS:
|
||||
|
||||
* rest-client, json
|
34
Rakefile
Normal file
34
Rakefile
Normal file
@ -0,0 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rake/testtask"
|
||||
|
||||
task default: %i[test rubocop]
|
||||
|
||||
Rake::TestTask.new do |t|
|
||||
t.pattern = "./test/**/*_test.rb"
|
||||
end
|
||||
|
||||
desc "Update bundled certs"
|
||||
task :update_certs do
|
||||
require "net/http"
|
||||
require "uri"
|
||||
|
||||
fetch_file "https://curl.haxx.se/ca/cacert.pem",
|
||||
File.expand_path("lib/data/ca-certificates.crt", __dir__)
|
||||
end
|
||||
|
||||
#
|
||||
# helpers
|
||||
#
|
||||
|
||||
def fetch_file(uri, dest)
|
||||
File.open(dest, "w") do |file|
|
||||
resp = Net::HTTP.get_response(URI.parse(uri))
|
||||
unless resp.code.to_i == 200
|
||||
abort("bad response when fetching: #{uri}\n" \
|
||||
"Status #{resp.code}: #{resp.body}")
|
||||
end
|
||||
file.write(resp.body)
|
||||
puts "Successfully fetched: #{uri}"
|
||||
end
|
||||
end
|
@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
||||
|
||||
libs = " -r irb/completion"
|
||||
libs << " -r #{File.dirname(__FILE__) + '/../lib/stripe'}"
|
||||
puts "Loading stripe gem"
|
||||
exec "#{irb} #{libs} --simple-prompt"
|
27
bin/tapioca
Executable file
27
bin/tapioca
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'tapioca' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
bundle_binstub = File.expand_path("bundle", __dir__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
load Gem.bin_path("tapioca", "tapioca")
|
16
examples/README.md
Normal file
16
examples/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
## Running an example
|
||||
|
||||
From the examples folder, run:
|
||||
`RUBYLIB=../lib ruby your_example.rb`
|
||||
|
||||
e.g.
|
||||
|
||||
`RUBYLIB=../lib ruby thinevent_webhook_handler.rb`
|
||||
|
||||
## Adding a new example
|
||||
|
||||
1. Clone new_example.rb
|
||||
2. Implement your example
|
||||
3. Fill out the file comment. Include a description and key steps that are being demonstrated.
|
||||
4. Run it (as per above)
|
||||
5. 👍
|
36
examples/example_template.rb
Normal file
36
examples/example_template.rb
Normal file
@ -0,0 +1,36 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# example_template.py - This is a template for defining new examples. It is not intended to be used directly.
|
||||
#
|
||||
# <describe what this example does>
|
||||
#
|
||||
# In this example, we:
|
||||
# - <key step 1>
|
||||
# - <key step 2
|
||||
# - ...
|
||||
#
|
||||
# <describe assumptions about the user's stripe account, environment, or configuration;
|
||||
# or things to watch out for when running>
|
||||
|
||||
require "stripe"
|
||||
require "date"
|
||||
|
||||
class ExampleTemplate
|
||||
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 = ExampleTemplate.new(api_key)
|
||||
example.do_something_great
|
57
examples/meter_event_stream.rb
Normal file
57
examples/meter_event_stream.rb
Normal file
@ -0,0 +1,57 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# meter_event_stream.py - use the high-throughput meter event stream to report create billing meter events.
|
||||
#
|
||||
# In this example, we:
|
||||
# - create a meter event session and store the session's authentication token
|
||||
# - define an event with a payload
|
||||
# - use the meter_event_stream service accessor in StripeClient to create an event stream that reports this event
|
||||
#
|
||||
# This example expects a billing meter with an event_name of 'alpaca_ai_tokens'. If you have
|
||||
# a different meter event name, you can change it before running this example.
|
||||
|
||||
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",
|
||||
},
|
||||
}
|
||||
)
|
39
examples/thinevent_webhook_handler.rb
Normal file
39
examples/thinevent_webhook_handler.rb
Normal file
@ -0,0 +1,39 @@
|
||||
# frozen_string_literal: true
|
||||
# typed: false
|
||||
|
||||
# thinevent_webhook_handler.rb - receive and process thin events like the
|
||||
# v1.billing.meter.error_report_triggered event.
|
||||
#
|
||||
# In this example, we:
|
||||
# - create a StripeClient called client
|
||||
# - use client.parse_thin_event to parse the received thin event webhook body
|
||||
# - call client.v2.core.events.retrieve to retrieve the full event object
|
||||
# - if it is a V1BillingMeterErrorReportTriggeredEvent event type, call
|
||||
# event.fetchRelatedObject to retrieve the Billing Meter object associated
|
||||
# with the event.
|
||||
|
||||
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
|
16
exe/stripe-console
Executable file
16
exe/stripe-console
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "irb"
|
||||
require "irb/completion"
|
||||
|
||||
require "#{File.dirname(__FILE__)}/../lib/stripe"
|
||||
|
||||
# Config IRB to enable --simple-prompt and auto indent
|
||||
IRB.conf[:PROMPT_MODE] = :SIMPLE
|
||||
IRB.conf[:AUTO_INDENT] = true
|
||||
|
||||
puts "Loaded gem 'stripe'"
|
||||
|
||||
IRB.start
|
43
justfile
Normal file
43
justfile
Normal file
@ -0,0 +1,43 @@
|
||||
set quiet
|
||||
|
||||
import? '../sdk-codegen/utils.just'
|
||||
|
||||
_default:
|
||||
just --list --unsorted
|
||||
|
||||
install *args:
|
||||
bundle install {{ if is_dependency() == "true" {"--quiet"} else {""} }} {{ args }}
|
||||
|
||||
# ⭐ run all unit tests
|
||||
test: install
|
||||
bundle exec rake test
|
||||
|
||||
# check linting / formatting status of files
|
||||
format-check *args: install
|
||||
bundle exec rubocop {{ args }}
|
||||
alias lint-check := format-check
|
||||
|
||||
# ⭐ check style & formatting for all files, fixing what we can
|
||||
lint: (format-check "--autocorrect")
|
||||
|
||||
# NOTE: "-o /dev/null" is vital - rubocop has super noisy output and codegen will crash when formatting ruby if everything gets printed
|
||||
# so, we send all its output to the void
|
||||
# copy of `lint` with less output
|
||||
format: (format-check "-o /dev/null --autocorrect")
|
||||
|
||||
update-certs: install
|
||||
bundle exec rake update_certs
|
||||
|
||||
# run sorbet to check type definitions
|
||||
typecheck: install
|
||||
{{ if semver_matches(`ruby -e "puts RUBY_VERSION"`, ">=2.7") == "true" { \
|
||||
"bundle exec srb tc" \
|
||||
} else { \
|
||||
"echo \"Ruby version < 2.7, skipping srb tc\"" \
|
||||
} }}
|
||||
|
||||
# called by tooling
|
||||
[private]
|
||||
update-version version:
|
||||
echo "{{ version }}" > VERSION
|
||||
perl -pi -e 's|VERSION = "[.\-\w\d]+"|VERSION = "{{ version }}"|' lib/stripe/version.rb
|
File diff suppressed because it is too large
Load Diff
657
lib/stripe.rb
657
lib/stripe.rb
@ -1,515 +1,160 @@
|
||||
# Stripe Ruby bindings
|
||||
# API spec at http://stripe.com/api/spec
|
||||
# Authors: Ross Boucher <boucher@stripe.com> and Greg Brockman <gdb@stripe.com>
|
||||
require 'set'
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rubygems'
|
||||
require 'json'
|
||||
require 'openssl'
|
||||
require 'rest_client'
|
||||
# Stripe Ruby bindings
|
||||
# API spec at https://stripe.com/docs/api
|
||||
require "cgi"
|
||||
require "json"
|
||||
require "logger"
|
||||
require "net/http"
|
||||
require "openssl"
|
||||
require "rbconfig"
|
||||
require "securerandom"
|
||||
require "set"
|
||||
require "socket"
|
||||
require "uri"
|
||||
require "forwardable"
|
||||
|
||||
# Version
|
||||
require "stripe/api_version"
|
||||
require "stripe/version"
|
||||
|
||||
# API operations
|
||||
require "stripe/api_operations/create"
|
||||
require "stripe/api_operations/delete"
|
||||
require "stripe/api_operations/list"
|
||||
require "stripe/api_operations/nested_resource"
|
||||
require "stripe/api_operations/request"
|
||||
require "stripe/api_operations/save"
|
||||
require "stripe/api_operations/singleton_save"
|
||||
require "stripe/api_operations/search"
|
||||
|
||||
# API resource support classes
|
||||
require "stripe/errors"
|
||||
require "stripe/object_types"
|
||||
require "stripe/event_types"
|
||||
require "stripe/request_options"
|
||||
require "stripe/request_params"
|
||||
require "stripe/util"
|
||||
require "stripe/connection_manager"
|
||||
require "stripe/multipart_encoder"
|
||||
require "stripe/api_requestor"
|
||||
require "stripe/stripe_service"
|
||||
require "stripe/stripe_client"
|
||||
require "stripe/stripe_object"
|
||||
require "stripe/stripe_response"
|
||||
require "stripe/list_object"
|
||||
require "stripe/v2_list_object"
|
||||
require "stripe/search_result_object"
|
||||
require "stripe/error_object"
|
||||
require "stripe/api_resource"
|
||||
require "stripe/api_resource_test_helpers"
|
||||
require "stripe/singleton_api_resource"
|
||||
require "stripe/webhook"
|
||||
require "stripe/stripe_configuration"
|
||||
require "stripe/thin_event"
|
||||
|
||||
# Named API resources
|
||||
require "stripe/resources"
|
||||
require "stripe/services"
|
||||
|
||||
# OAuth
|
||||
require "stripe/oauth"
|
||||
require "stripe/services/oauth_service"
|
||||
|
||||
module Stripe
|
||||
@@version = '1.5.2'
|
||||
@@ssl_bundle_path = File.join(File.dirname(__FILE__), 'data/ca-certificates.crt')
|
||||
@@api_key = nil
|
||||
@@api_base = 'https://api.stripe.com/v1'
|
||||
DEFAULT_CA_BUNDLE_PATH = __dir__ + "/data/ca-certificates.crt"
|
||||
|
||||
module Util
|
||||
def self.objects_to_ids(h)
|
||||
case h
|
||||
when APIResource
|
||||
h.id
|
||||
when Hash
|
||||
res = {}
|
||||
h.each { |k, v| res[k] = objects_to_ids(v) }
|
||||
res
|
||||
else
|
||||
h
|
||||
end
|
||||
# map to the same values as the standard library's logger
|
||||
LEVEL_DEBUG = Logger::DEBUG
|
||||
LEVEL_ERROR = Logger::ERROR
|
||||
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"
|
||||
|
||||
# Options that can be configured globally by users
|
||||
USER_CONFIGURABLE_GLOBAL_OPTIONS = Set.new(%i[
|
||||
api_key
|
||||
api_version
|
||||
stripe_account
|
||||
api_base
|
||||
uploads_base
|
||||
connect_base
|
||||
meter_events_base
|
||||
open_timeout
|
||||
read_timeout
|
||||
write_timeout
|
||||
proxy
|
||||
verify_ssl_certs
|
||||
ca_bundle_path
|
||||
log_level
|
||||
logger
|
||||
max_network_retries
|
||||
enable_telemetry
|
||||
client_id
|
||||
])
|
||||
|
||||
@app_info = nil
|
||||
|
||||
@config = Stripe::StripeConfiguration.setup
|
||||
|
||||
class << self
|
||||
extend Forwardable
|
||||
|
||||
attr_reader :config
|
||||
|
||||
# User configurable options
|
||||
def_delegators :@config, :api_key, :api_key=
|
||||
def_delegators :@config, :api_version, :api_version=
|
||||
def_delegators :@config, :stripe_account, :stripe_account=
|
||||
def_delegators :@config, :api_base, :api_base=
|
||||
def_delegators :@config, :uploads_base, :uploads_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, :read_timeout, :read_timeout=
|
||||
def_delegators :@config, :write_timeout, :write_timeout=
|
||||
def_delegators :@config, :proxy, :proxy=
|
||||
def_delegators :@config, :verify_ssl_certs, :verify_ssl_certs=
|
||||
def_delegators :@config, :ca_bundle_path, :ca_bundle_path=
|
||||
def_delegators :@config, :log_level, :log_level=
|
||||
def_delegators :@config, :logger, :logger=
|
||||
def_delegators :@config, :max_network_retries, :max_network_retries=
|
||||
def_delegators :@config, :enable_telemetry=, :enable_telemetry?
|
||||
def_delegators :@config, :client_id=, :client_id
|
||||
|
||||
# Internal configurations
|
||||
def_delegators :@config, :max_network_retry_delay
|
||||
def_delegators :@config, :initial_network_retry_delay
|
||||
def_delegators :@config, :ca_store
|
||||
end
|
||||
|
||||
def self.convert_to_stripe_object(resp, api_key)
|
||||
types = {
|
||||
'charge' => Charge,
|
||||
'customer' => Customer,
|
||||
'invoiceitem' => InvoiceItem,
|
||||
'invoice' => Invoice
|
||||
# Gets the application for a plugin that's identified some. See
|
||||
# #set_app_info.
|
||||
def self.app_info
|
||||
@app_info
|
||||
end
|
||||
|
||||
def self.app_info=(info)
|
||||
@app_info = info
|
||||
end
|
||||
|
||||
# Sets some basic information about the running application that's sent along
|
||||
# with API requests. Useful for plugin authors to identify their plugin when
|
||||
# communicating with Stripe.
|
||||
#
|
||||
# Takes a name and optional partner program ID, plugin URL, and version.
|
||||
def self.set_app_info(name, partner_id: nil, url: nil, version: nil)
|
||||
@app_info = {
|
||||
name: name,
|
||||
partner_id: partner_id,
|
||||
url: url,
|
||||
version: version,
|
||||
}
|
||||
case resp
|
||||
when Array
|
||||
resp.map { |i| convert_to_stripe_object(i, api_key) }
|
||||
when Hash
|
||||
# Try converting to a known object class. If none available, fall back to generic APIResource
|
||||
if klass_name = resp[:object]
|
||||
klass = types[klass_name]
|
||||
end
|
||||
klass ||= StripeObject
|
||||
klass.construct_from(resp, api_key)
|
||||
else
|
||||
resp
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module APIOperations
|
||||
module Create
|
||||
module ClassMethods
|
||||
def create(params={}, api_key=nil)
|
||||
response, api_key = Stripe.request(:post, self.url, api_key, params)
|
||||
Util.convert_to_stripe_object(response, api_key)
|
||||
end
|
||||
end
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
end
|
||||
end
|
||||
|
||||
module Update
|
||||
def save
|
||||
if @unsaved_values.length > 0
|
||||
values = {}
|
||||
@unsaved_values.each { |k| values[k] = @values[k] }
|
||||
response, api_key = Stripe.request(:post, url, @api_key, values)
|
||||
refresh_from(response, api_key)
|
||||
end
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
module Delete
|
||||
def delete
|
||||
response, api_key = Stripe.request(:delete, url, @api_key)
|
||||
refresh_from(response, api_key)
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
module List
|
||||
module ClassMethods
|
||||
def all(filters={}, api_key=nil)
|
||||
response, api_key = Stripe.request(:get, url, api_key, filters)
|
||||
Util.convert_to_stripe_object(response, api_key)
|
||||
end
|
||||
end
|
||||
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class StripeObject
|
||||
attr_accessor :api_key
|
||||
@@permanent_attributes = Set.new([:api_key])
|
||||
@@ignored_attributes = Set.new([:id, :api_key, :object])
|
||||
|
||||
# The default :id method is deprecated and isn't useful to us
|
||||
if method_defined?(:id)
|
||||
undef :id
|
||||
end
|
||||
|
||||
def initialize(id=nil, api_key=nil)
|
||||
@api_key = api_key
|
||||
@values = {}
|
||||
# This really belongs in APIResource, but not putting it there allows us
|
||||
# to have a unified inspect method
|
||||
@unsaved_values = Set.new
|
||||
@transient_values = Set.new
|
||||
self.id = id if id
|
||||
end
|
||||
|
||||
def self.construct_from(values, api_key=nil)
|
||||
obj = self.new(values[:id], api_key)
|
||||
obj.refresh_from(values, api_key)
|
||||
obj
|
||||
end
|
||||
|
||||
def to_s(*args); inspect(*args); end
|
||||
def inspect(verbose=false, nested=false)
|
||||
str = ["#<#{self.class}"]
|
||||
if (desc = ident.compact).length > 0
|
||||
str << "[#{desc.join(', ')}]"
|
||||
end
|
||||
|
||||
if !verbose and nested
|
||||
str << ' ...'
|
||||
else
|
||||
content = @values.keys.sort { |a, b| a.to_s <=> b.to_s }.map do |k|
|
||||
if @@ignored_attributes.include?(k)
|
||||
nil
|
||||
else
|
||||
v = @values[k]
|
||||
v = v.kind_of?(StripeObject) ? v.inspect(verbose, true) : v.inspect
|
||||
v = @unsaved_values.include?(k) ? "#{v} (unsaved)" : v
|
||||
"#{k}=#{v}"
|
||||
end
|
||||
end.compact.join(', ')
|
||||
|
||||
str << ' '
|
||||
if content.length > 0
|
||||
str << content
|
||||
else
|
||||
str << '(no attributes)'
|
||||
end
|
||||
end
|
||||
|
||||
str << ">"
|
||||
str.join
|
||||
end
|
||||
|
||||
def refresh_from(values, api_key, partial=false)
|
||||
@api_key = api_key
|
||||
|
||||
removed = partial ? Set.new : Set.new(@values.keys - values.keys)
|
||||
added = Set.new(values.keys - @values.keys)
|
||||
# Wipe old state before setting new. This is useful for e.g. updating a
|
||||
# customer, where there is no persistent card parameter. Mark those values
|
||||
# which don't persist as transient
|
||||
|
||||
instance_eval do
|
||||
remove_accessors(removed)
|
||||
add_accessors(added)
|
||||
end
|
||||
removed.each do |k|
|
||||
@values.delete(k)
|
||||
@transient_values.add(k)
|
||||
@unsaved_values.delete(k)
|
||||
end
|
||||
values.each do |k, v|
|
||||
@values[k] = Util.convert_to_stripe_object(v, api_key)
|
||||
@transient_values.delete(k)
|
||||
@unsaved_values.delete(k)
|
||||
end
|
||||
end
|
||||
|
||||
def [](k)
|
||||
k = k.to_sym if k.kind_of?(String)
|
||||
@values[k]
|
||||
end
|
||||
def []=(k, v)
|
||||
send(:"#{k}=", v)
|
||||
end
|
||||
def keys; @values.keys; end
|
||||
def values; @values.values; end
|
||||
def to_json(*a); @values.to_json(*a); end
|
||||
|
||||
protected
|
||||
|
||||
def ident
|
||||
[@values[:object], @values[:id]]
|
||||
end
|
||||
|
||||
def metaclass
|
||||
class << self; self; end
|
||||
end
|
||||
|
||||
def remove_accessors(keys)
|
||||
metaclass.instance_eval do
|
||||
keys.each do |k|
|
||||
next if @@permanent_attributes.include?(k)
|
||||
k_eq = :"#{k}="
|
||||
remove_method(k) if method_defined?(k)
|
||||
remove_method(k_eq) if method_defined?(k_eq)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def add_accessors(keys)
|
||||
metaclass.instance_eval do
|
||||
keys.each do |k|
|
||||
next if @@permanent_attributes.include?(k)
|
||||
k_eq = :"#{k}="
|
||||
define_method(k) { @values[k] }
|
||||
define_method(k_eq) do |v|
|
||||
@values[k] = v
|
||||
@unsaved_values.add(k) unless @@ignored_attributes.include?(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def method_missing(name, *args)
|
||||
# TODO: only allow setting in updateable classes.
|
||||
if name.to_s.end_with?('=')
|
||||
attr = name.to_s[0...-1].to_sym
|
||||
@values[attr] = args[0]
|
||||
@unsaved_values.add(attr)
|
||||
add_accessors([attr])
|
||||
return
|
||||
else
|
||||
return @values[name] if @values.has_key?(name)
|
||||
end
|
||||
|
||||
begin
|
||||
super
|
||||
rescue NoMethodError => e
|
||||
if @transient_values.include?(name)
|
||||
raise NoMethodError.new(e.message + ". HINT: The '#{name}' attribute was set in the past, however. It was then wiped when refreshing the object with the result returned by Stripe's API, probably as a result of a save(). The attributes currently available on this object are: #{@values.keys.join(', ')}")
|
||||
else
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class APIResource < StripeObject
|
||||
def self.url
|
||||
if self == APIResource
|
||||
raise NotImplementedError.new("APIResource is an abstract class. You should perform actions on its subclasses (Charge, Customer, etc.)")
|
||||
end
|
||||
shortname = self.name.split('::')[-1]
|
||||
"/#{CGI.escape(shortname.downcase)}s"
|
||||
end
|
||||
def url
|
||||
id = self['id']
|
||||
raise InvalidRequestError.new("Could not determine which URL to request: #{self.class} instance has invalid ID: #{id.inspect}", 'id') unless id
|
||||
"#{self.class.url}/#{CGI.escape(id)}"
|
||||
end
|
||||
|
||||
def refresh
|
||||
response, api_key = Stripe.request(:get, url, @api_key)
|
||||
refresh_from(response, api_key)
|
||||
self
|
||||
end
|
||||
|
||||
def self.retrieve(id, api_key=nil)
|
||||
instance = self.new(id, api_key)
|
||||
instance.refresh
|
||||
instance
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def ident
|
||||
[@values[:id]]
|
||||
end
|
||||
end
|
||||
|
||||
class Customer < APIResource
|
||||
include Stripe::APIOperations::Create
|
||||
include Stripe::APIOperations::Delete
|
||||
include Stripe::APIOperations::Update
|
||||
include Stripe::APIOperations::List
|
||||
|
||||
def add_invoice_item(params)
|
||||
InvoiceItem.create(params.merge(:customer => id), @api_key)
|
||||
end
|
||||
|
||||
def invoices
|
||||
Invoice.all({ :customer => id }, @api_key)
|
||||
end
|
||||
|
||||
def invoice_items
|
||||
InvoiceItem.all({ :customer => id }, @api_key)
|
||||
end
|
||||
|
||||
def charges
|
||||
Charge.all({ :customer => id }, @api_key)
|
||||
end
|
||||
|
||||
def cancel_subscription
|
||||
response, api_key = Stripe.request(:delete, subscription_url, @api_key)
|
||||
refresh_from({ :subscription => response }, api_key, true)
|
||||
subscription
|
||||
end
|
||||
|
||||
def update_subscription(params)
|
||||
response, api_key = Stripe.request(:post, subscription_url, @api_key)
|
||||
refresh_from({ :subscription => response }, api_key, true)
|
||||
subscription
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def subscription_url
|
||||
url + '/subscription'
|
||||
end
|
||||
end
|
||||
|
||||
class Invoice < APIResource
|
||||
include Stripe::APIOperations::List
|
||||
|
||||
def self.upcoming(params)
|
||||
response, api_key = Stripe.request(:get, upcoming_url, @api_key, params)
|
||||
Util.convert_to_stripe_object(response, api_key)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.upcoming_url
|
||||
url + '/upcoming'
|
||||
end
|
||||
end
|
||||
|
||||
class InvoiceItem < APIResource
|
||||
include Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Create
|
||||
include Stripe::APIOperations::Delete
|
||||
include Stripe::APIOperations::Update
|
||||
end
|
||||
|
||||
class Charge < APIResource
|
||||
include Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Create
|
||||
|
||||
def refund
|
||||
response, api_key = Stripe.request(:post, refund_url, @api_key)
|
||||
refresh_from(response, api_key)
|
||||
self
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def refund_url
|
||||
url + '/refund'
|
||||
end
|
||||
end
|
||||
|
||||
class StripeError < StandardError; end
|
||||
class APIError < StripeError; end
|
||||
class APIConnectionError < StripeError; end
|
||||
class CardError < StripeError
|
||||
attr_reader :param, :code
|
||||
|
||||
def initialize(message, param, code)
|
||||
super(message)
|
||||
@param = param
|
||||
@code = code
|
||||
end
|
||||
end
|
||||
class InvalidRequestError < StripeError
|
||||
attr_accessor :param
|
||||
|
||||
def initialize(message, param)
|
||||
super(message)
|
||||
@param = param
|
||||
end
|
||||
end
|
||||
class AuthenticationError < StripeError; end
|
||||
|
||||
def self.api_url(url=''); @@api_base + url; end
|
||||
def self.api_key=(api_key); @@api_key = api_key; end
|
||||
def self.api_key; @@api_key; end
|
||||
def self.api_base=(api_base); @@api_base = api_base; end
|
||||
def self.api_base; @@api_base; end
|
||||
def self.version; @@version; end
|
||||
|
||||
def self.request(method, url, api_key, params=nil, headers={})
|
||||
api_key ||= @@api_key
|
||||
raise AuthenticationError.new('No API key provided. (HINT: set your API key using "Stripe.api_key = <API-KEY>". You can generate API keys from the Stripe web interface. See https://stripe.com/api for details, or email support@stripe.com if you have any questions.)') unless api_key
|
||||
|
||||
if !File.exists?(@@ssl_bundle_path)
|
||||
unless @no_bundle
|
||||
$stderr.puts "WARNING: Running without SSL cert verification because #{@@ssl_bundle_path} does not exist"
|
||||
@no_bundle = true
|
||||
end
|
||||
ssl_opts = { :verify_ssl => false }
|
||||
else
|
||||
ssl_opts = {
|
||||
:verify_ssl => OpenSSL::SSL::VERIFY_PEER,
|
||||
:ssl_ca_file => @@ssl_bundle_path
|
||||
}
|
||||
end
|
||||
uname = (@@uname ||= RUBY_PLATFORM =~ /linux|darwin/i ? `uname -a 2>/dev/null`.strip : nil)
|
||||
lang_version = "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})"
|
||||
ua = {
|
||||
:bindings_version => Stripe.version,
|
||||
:lang => 'ruby',
|
||||
:lang_version => lang_version,
|
||||
:platform => RUBY_PLATFORM,
|
||||
:publisher => 'stripe',
|
||||
:uname => uname
|
||||
}
|
||||
headers = {
|
||||
:x_stripe_client_user_agent => JSON.dump(ua),
|
||||
:user_agent => "Stripe/v1 RubyBindings/#{Stripe.version}"
|
||||
}.merge(headers)
|
||||
opts = {
|
||||
:method => method,
|
||||
:url => self.api_url(url),
|
||||
:user => api_key,
|
||||
:headers => headers,
|
||||
:payload => Util.objects_to_ids(params),
|
||||
:open_timeout => 30,
|
||||
:timeout => 80
|
||||
}.merge(ssl_opts)
|
||||
|
||||
begin
|
||||
response = execute_request(opts)
|
||||
rescue SocketError => e
|
||||
self.handle_restclient_error(e)
|
||||
rescue NoMethodError => e
|
||||
# Work around RestClient bug
|
||||
if e.message =~ /\WRequestFailed\W/
|
||||
e = APIConnectionError.new('Unexpected HTTP response code')
|
||||
self.handle_restclient_error(e)
|
||||
else
|
||||
raise
|
||||
end
|
||||
rescue RestClient::ExceptionWithResponse => e
|
||||
if rcode = e.http_code and rbody = e.http_body
|
||||
self.handle_api_error(rcode, rbody)
|
||||
else
|
||||
self.handle_restclient_error(e)
|
||||
end
|
||||
rescue RestClient::Exception, Errno::ECONNREFUSED => e
|
||||
self.handle_restclient_error(e)
|
||||
end
|
||||
|
||||
rbody = response.body
|
||||
rcode = response.code
|
||||
begin
|
||||
resp = JSON.parse(rbody, :symbolize_names => true)
|
||||
rescue JSON::ParseError
|
||||
raise APIError.new("Invalid response object from API: #{rbody.inspect} (HTTP response code was #{rcode})")
|
||||
end
|
||||
|
||||
[resp, api_key]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.execute_request(opts)
|
||||
RestClient::Request.execute(opts)
|
||||
end
|
||||
|
||||
def self.handle_api_error(rcode, rbody)
|
||||
begin
|
||||
error_obj = JSON.parse(rbody, :symbolize_names => true)
|
||||
error = error_obj[:error] or raise StripeError.new
|
||||
rescue JSON::ParserError, StripeError
|
||||
raise APIError.new("Invalid response object from API: #{rbody.inspect} (HTTP response code was #{rcode})")
|
||||
end
|
||||
|
||||
case rcode
|
||||
when 400, 404 then
|
||||
raise invalid_request_error(error)
|
||||
when 401
|
||||
raise authentication_error(error)
|
||||
when 402
|
||||
raise card_error(error)
|
||||
else
|
||||
raise api_error(error)
|
||||
end
|
||||
end
|
||||
|
||||
def self.invalid_request_error(error); InvalidRequestError.new(error[:message], error[:param]); end
|
||||
def self.authentication_error(error); AuthenticationError.new(error[:message]); end
|
||||
def self.card_error(error); CardError.new(error[:message], error[:param], error[:code]); end
|
||||
def self.api_error(error); APIError.new(error[:message]); end
|
||||
|
||||
def self.handle_restclient_error(e)
|
||||
case e
|
||||
when RestClient::ServerBrokeConnection, RestClient::RequestTimeout
|
||||
message = "Could not connect to Stripe (#{@@api_base}). Please check your internet connection and try again. If this problem persists, you should check Stripe's service status at https://twitter.com/stripe, or let us know at support@stripe.com."
|
||||
when RestClient::SSLCertificateNotVerified
|
||||
message = "Could not verify Stripe's SSL certificate. Please make sure that your network is not intercepting certificates. (Try going to https://api.stripe.com in your browser.) If this problem persists, let us know at support@stripe.com."
|
||||
when SocketError
|
||||
message = "Unexpected error communicating when trying to connect to Stripe. HINT: You may be seeing this message because your DNS is not working. To check, try running 'host stripe.com' from the command line."
|
||||
else
|
||||
message = "Unexpected error communicating with Stripe. If this problem persists, let us know at support@stripe.com."
|
||||
end
|
||||
message += "\n\n(Network error: #{e.message})"
|
||||
raise APIConnectionError.new(message)
|
||||
end
|
||||
end
|
||||
|
||||
Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
|
||||
|
16
lib/stripe/api_operations/create.rb
Normal file
16
lib/stripe/api_operations/create.rb
Normal file
@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module Create
|
||||
def create(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: resource_url,
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
44
lib/stripe/api_operations/delete.rb
Normal file
44
lib/stripe/api_operations/delete.rb
Normal file
@ -0,0 +1,44 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module Delete
|
||||
module ClassMethods
|
||||
# Deletes an API resource
|
||||
#
|
||||
# Deletes the identified resource with the passed in parameters.
|
||||
#
|
||||
# ==== Attributes
|
||||
#
|
||||
# * +id+ - ID of the resource to delete.
|
||||
# * +params+ - A hash of parameters to pass to the API
|
||||
# * +opts+ - A Hash of additional options (separate from the params /
|
||||
# object values) to be added to the request. E.g. to allow for an
|
||||
# idempotency_key to be passed in the request headers, or for the
|
||||
# api_key to be overwritten. See
|
||||
# {APIOperations::Request.execute_resource_request}.
|
||||
def delete(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: "#{resource_url}/#{id}",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def delete(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: resource_url,
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
16
lib/stripe/api_operations/list.rb
Normal file
16
lib/stripe/api_operations/list.rb
Normal file
@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module List
|
||||
def list(filters = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: resource_url,
|
||||
params: filters,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
101
lib/stripe/api_operations/nested_resource.rb
Normal file
101
lib/stripe/api_operations/nested_resource.rb
Normal file
@ -0,0 +1,101 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
# Adds methods to help manipulate a subresource from its parent resource so
|
||||
# that it's possible to do so from a static context (i.e. without a
|
||||
# pre-existing collection of subresources on the parent).
|
||||
#
|
||||
# For example, a transfer gains the static methods for reversals so that the
|
||||
# methods `.create_reversal`, `.retrieve_reversal`, `.update_reversal`,
|
||||
# etc. all become available.
|
||||
module NestedResource
|
||||
def nested_resource_class_methods(resource, path: nil, operations: nil,
|
||||
resource_plural: nil)
|
||||
resource_plural ||= "#{resource}s"
|
||||
path ||= resource_plural
|
||||
|
||||
raise ArgumentError, "operations array required" if operations.nil?
|
||||
|
||||
resource_url_method = :"#{resource}s_url"
|
||||
|
||||
define_singleton_method(resource_url_method) do |id, nested_id = nil|
|
||||
url = "#{resource_url}/#{CGI.escape(id)}/#{CGI.escape(path)}"
|
||||
url += "/#{CGI.escape(nested_id)}" unless nested_id.nil?
|
||||
url
|
||||
end
|
||||
|
||||
operations.each do |operation|
|
||||
define_operation(
|
||||
resource,
|
||||
operation,
|
||||
resource_url_method,
|
||||
resource_plural
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
private def define_operation(
|
||||
resource,
|
||||
operation,
|
||||
resource_url_method,
|
||||
resource_plural
|
||||
)
|
||||
case operation
|
||||
when :create
|
||||
define_singleton_method(:"create_#{resource}") \
|
||||
do |id, params = {}, opts = {}|
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: send(resource_url_method, id),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
when :retrieve
|
||||
define_singleton_method(:"retrieve_#{resource}") \
|
||||
do |id, nested_id, params = {}, opts = {}|
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: send(resource_url_method, id, nested_id),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
when :update
|
||||
define_singleton_method(:"update_#{resource}") \
|
||||
do |id, nested_id, params = {}, opts = {}|
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: send(resource_url_method, id, nested_id),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
when :delete
|
||||
define_singleton_method(:"delete_#{resource}") \
|
||||
do |id, nested_id, params = {}, opts = {}|
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: send(resource_url_method, id, nested_id),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
when :list
|
||||
define_singleton_method(:"list_#{resource_plural}") \
|
||||
do |id, params = {}, opts = {}|
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: send(resource_url_method, id),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
else
|
||||
raise ArgumentError, "Unknown operation: #{operation.inspect}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
94
lib/stripe/api_operations/request.rb
Normal file
94
lib/stripe/api_operations/request.rb
Normal file
@ -0,0 +1,94 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module Request
|
||||
module ClassMethods
|
||||
def execute_resource_request(method, url, base_address = :api,
|
||||
params = {}, opts = {}, usage = [])
|
||||
execute_resource_request_internal(
|
||||
:execute_request, method, url, base_address, params, opts, usage
|
||||
)
|
||||
end
|
||||
|
||||
def execute_resource_request_stream(method, url, base_address = :api,
|
||||
params = {}, opts = {}, usage = [],
|
||||
&read_body_chunk_block)
|
||||
execute_resource_request_internal(
|
||||
:execute_request_stream,
|
||||
method,
|
||||
url,
|
||||
base_address,
|
||||
params,
|
||||
opts,
|
||||
usage,
|
||||
&read_body_chunk_block
|
||||
)
|
||||
end
|
||||
|
||||
private def request_stripe_object(method:, path:, base_address: :api, params: {}, opts: {}, usage: [])
|
||||
execute_resource_request(method, path, base_address, params, opts, usage)
|
||||
end
|
||||
|
||||
private def execute_resource_request_internal(client_request_method_sym,
|
||||
method, url, base_address,
|
||||
params, opts, usage,
|
||||
&read_body_chunk_block)
|
||||
params = params.to_h if params.is_a?(Stripe::RequestParams)
|
||||
params ||= {}
|
||||
|
||||
error_on_invalid_params(params)
|
||||
warn_on_opts_in_params(params)
|
||||
|
||||
opts = Util.normalize_opts(opts)
|
||||
req_opts = RequestOptions.extract_opts_from_hash(opts)
|
||||
|
||||
APIRequestor.active_requestor.send(
|
||||
client_request_method_sym,
|
||||
method, url,
|
||||
base_address,
|
||||
params: params, opts: req_opts, usage: usage,
|
||||
&read_body_chunk_block
|
||||
)
|
||||
end
|
||||
|
||||
private def error_on_invalid_params(params)
|
||||
return if params.nil? || params.is_a?(Hash)
|
||||
|
||||
raise ArgumentError,
|
||||
"request params should be either a Hash or nil " \
|
||||
"(was a #{params.class})"
|
||||
end
|
||||
|
||||
private def warn_on_opts_in_params(params)
|
||||
RequestOptions::OPTS_USER_SPECIFIED.each do |opt|
|
||||
warn("WARNING: '#{opt}' should be in opts instead of params.") if params.key?(opt)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
end
|
||||
|
||||
protected def execute_resource_request(method, url, base_address = :api,
|
||||
params = {}, opts = {}, usage = [])
|
||||
opts = @opts.merge(Util.normalize_opts(opts))
|
||||
self.class.execute_resource_request(method, url, base_address, params, opts, usage)
|
||||
end
|
||||
|
||||
protected def execute_resource_request_stream(method, url, base_address = :api,
|
||||
params = {}, opts = {}, usage = [],
|
||||
&read_body_chunk_block)
|
||||
opts = @opts.merge(Util.normalize_opts(opts))
|
||||
self.class.execute_resource_request_stream(
|
||||
method, url, base_address, params, opts, usage, &read_body_chunk_block
|
||||
)
|
||||
end
|
||||
|
||||
private def request_stripe_object(method:, path:, params:, base_address: :api, opts: {}, usage: [])
|
||||
execute_resource_request(method, path, base_address, params, opts, usage)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
107
lib/stripe/api_operations/save.rb
Normal file
107
lib/stripe/api_operations/save.rb
Normal file
@ -0,0 +1,107 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module Save
|
||||
module ClassMethods
|
||||
# Updates an API resource
|
||||
#
|
||||
# Updates the identified resource with the passed in parameters.
|
||||
#
|
||||
# ==== Attributes
|
||||
#
|
||||
# * +id+ - ID of the resource to update.
|
||||
# * +params+ - A hash of parameters to pass to the API
|
||||
# * +opts+ - A Hash of additional options (separate from the params /
|
||||
# object values) to be added to the request. E.g. to allow for an
|
||||
# idempotency_key to be passed in the request headers, or for the
|
||||
# api_key to be overwritten. See
|
||||
# {APIOperations::Request.execute_resource_request}.
|
||||
def update(id, params = {}, opts = {})
|
||||
params.each_key do |k|
|
||||
raise ArgumentError, "Cannot update protected field: #{k}" if protected_fields.include?(k)
|
||||
end
|
||||
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "#{resource_url}/#{id}",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# The `save` method is DEPRECATED and will be removed in a future major
|
||||
# version of the library. Use the `update` method on the resource instead.
|
||||
#
|
||||
# Creates or updates an API resource.
|
||||
#
|
||||
# If the resource doesn't yet have an assigned ID and the resource is one
|
||||
# that can be created, then the method attempts to create the resource.
|
||||
# The resource is updated otherwise.
|
||||
#
|
||||
# ==== Attributes
|
||||
#
|
||||
# * +params+ - Overrides any parameters in the resource's serialized data
|
||||
# and includes them in the create or update. If +:req_url:+ is included
|
||||
# in the list, it overrides the update URL used for the create or
|
||||
# update.
|
||||
# * +opts+ - A Hash of additional options (separate from the params /
|
||||
# object values) to be added to the request. E.g. to allow for an
|
||||
# idempotency_key to be passed in the request headers, or for the
|
||||
# api_key to be overwritten. See
|
||||
# {APIOperations::Request.execute_resource_request}.
|
||||
def save(params = {}, opts = {})
|
||||
# We started unintentionally (sort of) allowing attributes sent to
|
||||
# +save+ to override values used during the update. So as not to break
|
||||
# the API, this makes that official here.
|
||||
update_attributes(params)
|
||||
|
||||
# Now remove any parameters that look like object attributes.
|
||||
params = params.reject { |k, _| respond_to?(k) }
|
||||
|
||||
values = serialize_params(self).merge(params)
|
||||
|
||||
# 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
|
||||
values.delete(:id)
|
||||
opts = Util.normalize_opts(opts)
|
||||
APIRequestor.active_requestor.execute_request_initialize_from(:post, save_url, :api, self,
|
||||
params: values,
|
||||
opts: RequestOptions.extract_opts_from_hash(opts),
|
||||
usage: ["save"])
|
||||
end
|
||||
extend Gem::Deprecate
|
||||
deprecate :save, "the `update` class method (for examples " \
|
||||
"see https://github.com/stripe/stripe-ruby" \
|
||||
"/wiki/Migration-guide-for-v8)", 2022, 11
|
||||
|
||||
def self.included(base)
|
||||
# Set `metadata` as additive so that when it's set directly we remember
|
||||
# to clear keys that may have been previously set by sending empty
|
||||
# values for them.
|
||||
#
|
||||
# It's possible that not every object with `Save` has `metadata`, but
|
||||
# it's a close enough heuristic, and having this option set when there
|
||||
# is no `metadata` field is not harmful.
|
||||
base.additive_object_param(:metadata)
|
||||
|
||||
base.extend(ClassMethods)
|
||||
end
|
||||
|
||||
private def save_url
|
||||
# This switch essentially allows us "upsert"-like functionality. If the
|
||||
# API resource doesn't have an ID set (suggesting that it's new) and
|
||||
# its class responds to .create (which comes from
|
||||
# Stripe::APIOperations::Create), then use the URL to create a new
|
||||
# resource. Otherwise, generate a URL based on the object's identifier
|
||||
# for a normal update.
|
||||
if self[:id].nil? && self.class.respond_to?(:create)
|
||||
self.class.resource_url
|
||||
else
|
||||
resource_url
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
21
lib/stripe/api_operations/search.rb
Normal file
21
lib/stripe/api_operations/search.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
# The _search method via API Operations is deprecated.
|
||||
# Please use the search method from within the resource instead.
|
||||
module Search
|
||||
def _search(search_url, filters = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: search_url,
|
||||
params: filters,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
extend Gem::Deprecate
|
||||
deprecate :_search, "request_stripe_object", 2024, 1
|
||||
end
|
||||
end
|
||||
end
|
90
lib/stripe/api_operations/singleton_save.rb
Normal file
90
lib/stripe/api_operations/singleton_save.rb
Normal file
@ -0,0 +1,90 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module APIOperations
|
||||
module SingletonSave
|
||||
module ClassMethods
|
||||
# Updates a singleton API resource
|
||||
#
|
||||
# Updates the identified resource with the passed in parameters.
|
||||
#
|
||||
# ==== Attributes
|
||||
#
|
||||
# * +params+ - A hash of parameters to pass to the API
|
||||
# * +opts+ - A Hash of additional options (separate from the params /
|
||||
# object values) to be added to the request. E.g. to allow for an
|
||||
# idempotency_key to be passed in the request headers, or for the
|
||||
# api_key to be overwritten. See
|
||||
# {APIOperations::Request.execute_resource_request}.
|
||||
def update(params = {}, opts = {})
|
||||
params.each_key do |k|
|
||||
raise ArgumentError, "Cannot update protected field: #{k}" if protected_fields.include?(k)
|
||||
end
|
||||
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: resource_url,
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# The `save` method is DEPRECATED and will be removed in a future major
|
||||
# version of the library. Use the `update` method on the resource instead.
|
||||
#
|
||||
# Updates a singleton API resource.
|
||||
#
|
||||
# If the resource doesn't yet have an assigned ID and the resource is one
|
||||
# that can be created, then the method attempts to create the resource.
|
||||
# The resource is updated otherwise.
|
||||
#
|
||||
# ==== Attributes
|
||||
#
|
||||
# * +params+ - Overrides any parameters in the resource's serialized data
|
||||
# and includes them in the create or update. If +:req_url:+ is included
|
||||
# in the list, it overrides the update URL used for the create or
|
||||
# update.
|
||||
# * +opts+ - A Hash of additional options (separate from the params /
|
||||
# object values) to be added to the request. E.g. to allow for an
|
||||
# idempotency_key to be passed in the request headers, or for the
|
||||
# api_key to be overwritten. See
|
||||
# {APIOperations::Request.execute_resource_request}.
|
||||
def save(params = {}, opts = {})
|
||||
# We started unintentionally (sort of) allowing attributes sent to
|
||||
# +save+ to override values used during the update. So as not to break
|
||||
# the API, this makes that official here.
|
||||
update_attributes(params)
|
||||
|
||||
# Now remove any parameters that look like object attributes.
|
||||
params = params.reject { |k, _| respond_to?(k) }
|
||||
|
||||
values = serialize_params(self).merge(params)
|
||||
|
||||
opts = Util.normalize_opts(opts)
|
||||
|
||||
APIRequestor.active_requestor.execute_request_initialize_from(:post, resource_url, :api, self,
|
||||
params: values,
|
||||
opts: RequestOptions.extract_opts_from_hash(opts),
|
||||
usage: ["save"])
|
||||
end
|
||||
extend Gem::Deprecate
|
||||
deprecate :save, "the `update` class method (for examples " \
|
||||
"see https://github.com/stripe/stripe-ruby" \
|
||||
"/wiki/Migration-guide-for-v8)", 2022, 11
|
||||
|
||||
def self.included(base)
|
||||
# Set `metadata` as additive so that when it's set directly we remember
|
||||
# to clear keys that may have been previously set by sending empty
|
||||
# values for them.
|
||||
#
|
||||
# It's possible that not every object with `Save` has `metadata`, but
|
||||
# it's a close enough heuristic, and having this option set when there
|
||||
# is no `metadata` field is not harmful.
|
||||
base.additive_object_param(:metadata)
|
||||
|
||||
base.extend(ClassMethods)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
1136
lib/stripe/api_requestor.rb
Normal file
1136
lib/stripe/api_requestor.rb
Normal file
File diff suppressed because it is too large
Load Diff
142
lib/stripe/api_resource.rb
Normal file
142
lib/stripe/api_resource.rb
Normal file
@ -0,0 +1,142 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class APIResource < StripeObject
|
||||
include Stripe::APIOperations::Request
|
||||
|
||||
# A flag that can be set a behavior that will cause this resource to be
|
||||
# encoded and sent up along with an update of its parent resource. This is
|
||||
# usually not desirable because resources are updated individually on their
|
||||
# own endpoints, but there are certain cases, replacing a customer's source
|
||||
# for example, where this is allowed.
|
||||
attr_accessor :save_with_parent
|
||||
|
||||
# TODO: (major) Remove OBJECT_NAME and stop using const_get here
|
||||
# This is a workaround to avoid breaking users who have defined their own
|
||||
# APIResource subclasses with a custom OBJECT_NAME. We should never fallback
|
||||
# on this case otherwise.
|
||||
OBJECT_NAME = ""
|
||||
def self.object_name
|
||||
const_get(:OBJECT_NAME)
|
||||
end
|
||||
|
||||
def self.class_name
|
||||
name.split("::")[-1]
|
||||
end
|
||||
|
||||
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
|
||||
raise NotImplementedError,
|
||||
"APIResource is an abstract class. You should perform actions " \
|
||||
"on its subclasses (Charge, Customer, etc.)"
|
||||
end
|
||||
# Namespaces are separated in object names with periods (.) and in URLs
|
||||
# with forward slashes (/), so replace the former with the latter.
|
||||
"/v1/#{object_name.downcase.tr('.', '/')}s"
|
||||
end
|
||||
|
||||
# A metaprogramming call that specifies that a field of a resource can be
|
||||
# its own type of API resource (say a nested card under an account for
|
||||
# example), and if that resource is set, it should be transmitted to the
|
||||
# API on a create or update. Doing so is not the default behavior because
|
||||
# API resources should normally be persisted on their own RESTful
|
||||
# endpoints.
|
||||
def self.save_nested_resource(name)
|
||||
define_method(:"#{name}=") do |value|
|
||||
super(value)
|
||||
|
||||
# The parent setter will perform certain useful operations like
|
||||
# converting to an APIResource if appropriate. Refresh our argument
|
||||
# value to whatever it mutated to.
|
||||
value = send(name)
|
||||
|
||||
# Note that the value may be subresource, but could also be a scalar
|
||||
# (like a tokenized card's ID for example), so we check the type before
|
||||
# setting #save_with_parent here.
|
||||
value.save_with_parent = true if value.is_a?(APIResource)
|
||||
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
# Adds a custom method to a resource class. This is used to add support for
|
||||
# non-CRUDL API requests, e.g. capturing charges. custom_method takes the
|
||||
# following parameters:
|
||||
# - name: the name of the custom method to create (as a symbol)
|
||||
# - http_verb: the HTTP verb for the API request (:get, :post, or :delete)
|
||||
# - http_path: the path to append to the resource's URL. If not provided,
|
||||
# the name is used as the path
|
||||
#
|
||||
# For example, this call:
|
||||
# custom_method :capture, http_verb: post
|
||||
# adds a `capture` class method to the resource class that, when called,
|
||||
# will send a POST request to `/v1/<object_name>/capture`.
|
||||
def self.custom_method(name, http_verb:, http_path: nil)
|
||||
Util.custom_method self, self, name, http_verb, http_path
|
||||
end
|
||||
|
||||
def resource_url
|
||||
unless (id = self["id"])
|
||||
raise InvalidRequestError.new(
|
||||
"Could not determine which URL to request: #{self.class} instance " \
|
||||
"has invalid ID: #{id.inspect}",
|
||||
"id"
|
||||
)
|
||||
end
|
||||
"#{self.class.resource_url}/#{CGI.escape(id)}"
|
||||
end
|
||||
|
||||
def refresh
|
||||
if self.class.name.include?("Stripe::V2")
|
||||
raise NotImplementedError,
|
||||
"It is not possible to refresh v2 objects. Please retrieve the object using the StripeClient instead."
|
||||
end
|
||||
|
||||
opts = RequestOptions.extract_opts_from_hash(@retrieve_opts || {})
|
||||
@retrieve_opts = {} # Make sure to clear the retrieve options
|
||||
@obj = @requestor.execute_request_initialize_from(:get, resource_url, :api, self, params: @retrieve_params,
|
||||
opts: opts)
|
||||
initialize_from(
|
||||
@obj.last_response.data,
|
||||
@obj.instance_variable_get(:@opts),
|
||||
@obj.last_response,
|
||||
api_mode: :v1,
|
||||
requestor: @requestor
|
||||
)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
instance = new(id)
|
||||
# Explicitly send options for the retrieve call, to preserve custom headers
|
||||
# This is so we can pass custom headers from this static function
|
||||
# to the instance variable method call
|
||||
# The custom headers will be cleaned up with the rest of the RequestOptions
|
||||
instance.instance_variable_set(:@retrieve_opts, Util.normalize_opts(opts))
|
||||
instance.refresh
|
||||
end
|
||||
|
||||
def request_stripe_object(method:, path:, params:, base_address: :api, opts: {})
|
||||
APIRequestor.active_requestor.execute_request_initialize_from(method, path, base_address, self,
|
||||
params: params, opts: opts)
|
||||
end
|
||||
|
||||
protected def request_stream(method:, path:, params:, base_address: :api, opts: {},
|
||||
&read_body_chunk_block)
|
||||
resp, = execute_resource_request_stream(
|
||||
method, path, base_address, params, opts, &read_body_chunk_block
|
||||
)
|
||||
resp
|
||||
end
|
||||
end
|
||||
end
|
53
lib/stripe/api_resource_test_helpers.rb
Normal file
53
lib/stripe/api_resource_test_helpers.rb
Normal file
@ -0,0 +1,53 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# The base class for nested TestHelpers classes in resource objects.
|
||||
# The APIResourceTestHelpers handles URL generation and custom method
|
||||
# support for test-helper methods.
|
||||
#
|
||||
# class MyAPIResource < APIResource
|
||||
# class TestHelpers < APIResourceTestHelpers
|
||||
class APIResourceTestHelpers
|
||||
include Stripe::APIOperations::Request
|
||||
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
||||
def self.resource_class
|
||||
nil
|
||||
end
|
||||
|
||||
# Adds a custom method to a test helper. This is used to add support for
|
||||
# non-CRUDL API requests, e.g. capturing charges. custom_method takes the
|
||||
# following parameters:
|
||||
# - name: the name of the custom method to create (as a symbol)
|
||||
# - http_verb: the HTTP verb for the API request (:get, :post, or :delete)
|
||||
# - http_path: the path to append to the resource's URL. If not provided,
|
||||
# the name is used as the path
|
||||
#
|
||||
# For example, this call:
|
||||
# custom_method :capture, http_verb: post
|
||||
# adds a `capture` class method to the resource class that, when called,
|
||||
# will send a POST request to `/v1/<object_name>/capture`.
|
||||
def self.custom_method(name, http_verb:, http_path: nil)
|
||||
Util.custom_method resource_class, self, name, http_verb, http_path
|
||||
end
|
||||
|
||||
def self.resource_url
|
||||
"/v1/test_helpers/" \
|
||||
"#{resource_class.object_name.downcase.tr('.', '/')}s"
|
||||
end
|
||||
|
||||
def resource_url
|
||||
unless (id = @resource["id"])
|
||||
raise InvalidRequestError.new(
|
||||
"Could not determine which URL to request: #{self.class} instance " \
|
||||
"has invalid ID: #{id.inspect}",
|
||||
"id"
|
||||
)
|
||||
end
|
||||
"#{self.class.resource_url}/#{CGI.escape(id)}"
|
||||
end
|
||||
end
|
||||
end
|
8
lib/stripe/api_version.rb
Normal file
8
lib/stripe/api_version.rb
Normal file
@ -0,0 +1,8 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module ApiVersion
|
||||
CURRENT = "2025-05-28.basil"
|
||||
end
|
||||
end
|
196
lib/stripe/connection_manager.rb
Normal file
196
lib/stripe/connection_manager.rb
Normal file
@ -0,0 +1,196 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Manages connections across multiple hosts which is useful because the
|
||||
# library may connect to multiple hosts during a typical session (main API,
|
||||
# Connect, Uploads). Ruby doesn't provide an easy way to make this happen
|
||||
# easily, so this class is designed to track what we're connected to and
|
||||
# manage the lifecycle of those connections.
|
||||
#
|
||||
# Note that this class in itself is *not* thread safe. We expect it to be
|
||||
# instantiated once per thread.
|
||||
class ConnectionManager
|
||||
# Timestamp (in seconds procured from the system's monotonic clock)
|
||||
# indicating when the connection manager last made a request. This is used
|
||||
# by `APIRequestor` to determine whether a connection manager should be
|
||||
# garbage collected or not.
|
||||
attr_reader :last_used
|
||||
attr_reader :config
|
||||
|
||||
def initialize(config = Stripe.config)
|
||||
@config = config
|
||||
@active_connections = {}
|
||||
@last_used = Util.monotonic_time
|
||||
|
||||
# A connection manager may be accessed across threads as one thread makes
|
||||
# requests on it while another is trying to clear it (either because it's
|
||||
# trying to garbage collect the manager or trying to clear it because a
|
||||
# configuration setting has changed). That's probably thread-safe already
|
||||
# because of Ruby's GIL, but just in case the library's running on JRuby
|
||||
# or the like, use a mutex to synchronize access in this connection
|
||||
# manager.
|
||||
@mutex = Mutex.new
|
||||
end
|
||||
|
||||
# Finishes any active connections by closing their TCP connection and
|
||||
# clears them from internal tracking.
|
||||
def clear
|
||||
@mutex.synchronize do
|
||||
@active_connections.each_value(&:finish)
|
||||
@active_connections = {}
|
||||
end
|
||||
end
|
||||
|
||||
# Gets a connection for a given URI. This is for internal use only as it's
|
||||
# subject to change (we've moved between HTTP client schemes in the past
|
||||
# and may do it again).
|
||||
#
|
||||
# `uri` is expected to be a string.
|
||||
def connection_for(uri)
|
||||
@mutex.synchronize do
|
||||
u = URI.parse(uri)
|
||||
connection = @active_connections[[u.host, u.port]]
|
||||
|
||||
if connection.nil?
|
||||
connection = create_connection(u)
|
||||
connection.start
|
||||
|
||||
@active_connections[[u.host, u.port]] = connection
|
||||
end
|
||||
|
||||
connection
|
||||
end
|
||||
end
|
||||
|
||||
# Executes an HTTP request to the given URI with the given method. Also
|
||||
# allows a request body, headers, and query string to be specified.
|
||||
def execute_request(method, uri, body: nil, headers: nil, query: nil,
|
||||
&block)
|
||||
# Perform some basic argument validation because it's easy to get
|
||||
# confused between strings and hashes for things like body and query
|
||||
# parameters.
|
||||
raise ArgumentError, "method should be a symbol" \
|
||||
unless method.is_a?(Symbol)
|
||||
raise ArgumentError, "uri should be a string" \
|
||||
unless uri.is_a?(String)
|
||||
raise ArgumentError, "body should be a string" \
|
||||
if body && !body.is_a?(String)
|
||||
raise ArgumentError, "headers should be a hash" \
|
||||
if headers && !headers.is_a?(Hash)
|
||||
raise ArgumentError, "query should be a string" \
|
||||
if query && !query.is_a?(String)
|
||||
|
||||
@last_used = Util.monotonic_time
|
||||
|
||||
connection = connection_for(uri)
|
||||
|
||||
u = URI.parse(uri)
|
||||
path = if query
|
||||
u.path + "?" + query
|
||||
else
|
||||
u.path
|
||||
end
|
||||
|
||||
method_name = method.to_s.upcase
|
||||
has_response_body = method_name != "HEAD"
|
||||
request = Net::HTTPGenericRequest.new(
|
||||
method_name,
|
||||
(body ? true : false),
|
||||
has_response_body,
|
||||
path,
|
||||
headers
|
||||
)
|
||||
|
||||
Util.log_debug("ConnectionManager starting request",
|
||||
method_name: method_name,
|
||||
path: path,
|
||||
process_id: Process.pid,
|
||||
thread_object_id: Thread.current.object_id,
|
||||
connection_manager_object_id: object_id,
|
||||
connection_object_id: connection.object_id,
|
||||
log_timestamp: Util.monotonic_time)
|
||||
|
||||
resp = @mutex.synchronize do
|
||||
# The block parameter is special here. If a block is provided, the block
|
||||
# is invoked with the Net::HTTPResponse. However, the body will not have
|
||||
# been read yet in the block, and can be streamed by calling
|
||||
# HTTPResponse#read_body.
|
||||
connection.request(request, body, &block)
|
||||
end
|
||||
|
||||
Util.log_debug("ConnectionManager request complete",
|
||||
method_name: method_name,
|
||||
path: path,
|
||||
process_id: Process.pid,
|
||||
thread_object_id: Thread.current.object_id,
|
||||
connection_manager_object_id: object_id,
|
||||
connection_object_id: connection.object_id,
|
||||
response_object_id: resp.object_id,
|
||||
log_timestamp: Util.monotonic_time)
|
||||
|
||||
resp
|
||||
end
|
||||
|
||||
#
|
||||
# private
|
||||
#
|
||||
|
||||
# `uri` should be a parsed `URI` object.
|
||||
private def create_connection(uri)
|
||||
# These all come back as `nil` if no proxy is configured.
|
||||
proxy_host, proxy_port, proxy_user, proxy_pass = proxy_parts
|
||||
|
||||
connection = Net::HTTP.new(uri.host, uri.port,
|
||||
proxy_host, proxy_port,
|
||||
proxy_user, proxy_pass)
|
||||
|
||||
# Time in seconds within which Net::HTTP will try to reuse an already
|
||||
# open connection when issuing a new operation. Outside this window, Ruby
|
||||
# will transparently close and re-open the connection without trying to
|
||||
# reuse it.
|
||||
#
|
||||
# Ruby's default of 2 seconds is almost certainly too short. Here I've
|
||||
# reused Go's default for `DefaultTransport`.
|
||||
connection.keep_alive_timeout = 30
|
||||
|
||||
connection.open_timeout = config.open_timeout
|
||||
connection.read_timeout = config.read_timeout
|
||||
connection.write_timeout = config.write_timeout if connection.respond_to?(:write_timeout=)
|
||||
|
||||
connection.use_ssl = uri.scheme == "https"
|
||||
|
||||
if config.verify_ssl_certs
|
||||
connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
||||
connection.cert_store = config.ca_store
|
||||
else
|
||||
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
warn_ssl_verify_none
|
||||
end
|
||||
|
||||
connection
|
||||
end
|
||||
|
||||
# `Net::HTTP` somewhat awkwardly requires each component of a proxy URI
|
||||
# (host, port, etc.) rather than the URI itself. This method simply parses
|
||||
# out those pieces to make passing them into a new connection a little less
|
||||
# ugly.
|
||||
private def proxy_parts
|
||||
if config.proxy.nil?
|
||||
[nil, nil, nil, nil]
|
||||
else
|
||||
u = URI.parse(config.proxy)
|
||||
[u.host, u.port, u.user, u.password]
|
||||
end
|
||||
end
|
||||
|
||||
private def warn_ssl_verify_none
|
||||
return if @verify_ssl_warned
|
||||
|
||||
@verify_ssl_warned = true
|
||||
warn("WARNING: Running without SSL cert verification. " \
|
||||
"You should never do this in production. " \
|
||||
"Execute `Stripe.verify_ssl_certs = true` to enable " \
|
||||
"verification.")
|
||||
end
|
||||
end
|
||||
end
|
93
lib/stripe/error_object.rb
Normal file
93
lib/stripe/error_object.rb
Normal file
@ -0,0 +1,93 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Represents an error object as returned by the API.
|
||||
#
|
||||
# @see https://stripe.com/docs/api/errors
|
||||
class ErrorObject < StripeObject
|
||||
# Unlike other objects, we explicitly declare getter methods here. This
|
||||
# is because the API doesn't return `null` values for fields on this
|
||||
# object, rather the fields are omitted entirely. Not declaring the getter
|
||||
# methods would cause users to run into `NoMethodError` exceptions and
|
||||
# get in the way of generic error handling.
|
||||
|
||||
# For card errors, the ID of the failed charge.
|
||||
def charge
|
||||
@values[:charge]
|
||||
end
|
||||
|
||||
# For some errors that could be handled programmatically, a short string
|
||||
# indicating the error code reported.
|
||||
def code
|
||||
@values[:code]
|
||||
end
|
||||
|
||||
# For card errors resulting from a card issuer decline, a short string
|
||||
# indicating the card issuer's reason for the decline if they provide one.
|
||||
def decline_code
|
||||
@values[:decline_code]
|
||||
end
|
||||
|
||||
# A URL to more information about the error code reported.
|
||||
def doc_url
|
||||
@values[:doc_url]
|
||||
end
|
||||
|
||||
# A human-readable message providing more details about the error. For card
|
||||
# errors, these messages can be shown to your users.
|
||||
def message
|
||||
@values[:message]
|
||||
end
|
||||
|
||||
# If the error is parameter-specific, the parameter related to the error.
|
||||
# For example, you can use this to display a message near the correct form
|
||||
# field.
|
||||
def param
|
||||
@values[:param]
|
||||
end
|
||||
|
||||
# The PaymentIntent object for errors returned on a request involving a
|
||||
# PaymentIntent.
|
||||
def payment_intent
|
||||
@values[:payment_intent]
|
||||
end
|
||||
|
||||
# The PaymentMethod object for errors returned on a request involving a
|
||||
# PaymentMethod.
|
||||
def payment_method
|
||||
@values[:payment_method]
|
||||
end
|
||||
|
||||
# The SetupIntent object for errors returned on a request involving a
|
||||
# SetupIntent.
|
||||
def setup_intent
|
||||
@values[:setup_intent]
|
||||
end
|
||||
|
||||
# The source object for errors returned on a request involving a source.
|
||||
def source
|
||||
@values[:source]
|
||||
end
|
||||
|
||||
# The type of error returned. One of `api_error`, `card_error`,
|
||||
# `idempotency_error`, or `invalid_request_error`.
|
||||
def type
|
||||
@values[:type]
|
||||
end
|
||||
end
|
||||
|
||||
# Represents on OAuth error returned by the OAuth API.
|
||||
#
|
||||
# @see https://stripe.com/docs/connect/oauth-reference#post-token-errors
|
||||
class OAuthErrorObject < StripeObject
|
||||
# A unique error code per error type.
|
||||
def error
|
||||
@values[:error]
|
||||
end
|
||||
|
||||
# A human readable description of the error.
|
||||
def error_description
|
||||
@values[:error_description]
|
||||
end
|
||||
end
|
||||
end
|
168
lib/stripe/errors.rb
Normal file
168
lib/stripe/errors.rb
Normal file
@ -0,0 +1,168 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# StripeError is the base error from which all other more specific Stripe
|
||||
# errors derive.
|
||||
class StripeError < StandardError
|
||||
attr_reader :message, :code, :error, :http_body, :http_headers, :http_status, :json_body, :request_id
|
||||
|
||||
# Response contains a StripeResponse object that has some basic information
|
||||
# about the response that conveyed the error.
|
||||
attr_accessor :response # equivalent to #data
|
||||
|
||||
# Initializes a StripeError.
|
||||
def initialize(message = nil, http_status: nil, http_body: nil, # rubocop:todo Lint/MissingSuper
|
||||
json_body: nil, http_headers: nil, code: nil)
|
||||
@message = message
|
||||
@http_status = http_status
|
||||
@http_body = http_body
|
||||
@http_headers = http_headers || {}
|
||||
@idempotent_replayed = @http_headers["idempotent-replayed"] == "true"
|
||||
@json_body = json_body
|
||||
@code = code
|
||||
@request_id = @http_headers["request-id"]
|
||||
@error = construct_error_object
|
||||
end
|
||||
|
||||
def construct_error_object
|
||||
return nil if @json_body.nil? || !@json_body.key?(:error)
|
||||
|
||||
# ErrorObject is shared between v1 and v2, so use original object_classes to find
|
||||
ErrorObject.construct_from(@json_body[:error], {}, nil, :v1)
|
||||
end
|
||||
|
||||
def to_s
|
||||
status_string = @http_status.nil? ? "" : "(Status #{@http_status}) "
|
||||
id_string = @request_id.nil? ? "" : "(Request #{@request_id}) "
|
||||
"#{status_string}#{id_string}#{@message}"
|
||||
end
|
||||
end
|
||||
|
||||
# AuthenticationError is raised when invalid credentials are used to connect
|
||||
# to Stripe's servers.
|
||||
class AuthenticationError < StripeError
|
||||
end
|
||||
|
||||
# APIConnectionError is raised in the event that the SDK can't connect to
|
||||
# Stripe's servers. That can be for a variety of different reasons from a
|
||||
# downed network to a bad TLS certificate.
|
||||
class APIConnectionError < StripeError
|
||||
end
|
||||
|
||||
# APIError is a generic error that may be raised in cases where none of the
|
||||
# other named errors cover the problem. It could also be raised in the case
|
||||
# that a new error has been introduced in the API, but this version of the
|
||||
# Ruby SDK doesn't know how to handle it.
|
||||
class APIError < StripeError
|
||||
end
|
||||
|
||||
# CardError is raised when a user enters a card that can't be charged for
|
||||
# some reason.
|
||||
class CardError < StripeError
|
||||
attr_reader :param
|
||||
|
||||
def initialize(message, param, code: nil, http_status: nil, http_body: nil,
|
||||
json_body: nil, http_headers: nil)
|
||||
super(message, http_status: http_status, http_body: http_body,
|
||||
json_body: json_body, http_headers: http_headers,
|
||||
code: code)
|
||||
@param = param
|
||||
end
|
||||
end
|
||||
|
||||
# IdempotencyError is raised in cases where an idempotency key was used
|
||||
# improperly.
|
||||
class IdempotencyError < StripeError
|
||||
end
|
||||
|
||||
# InvalidRequestError is raised when a request is initiated with invalid
|
||||
# parameters.
|
||||
class InvalidRequestError < StripeError
|
||||
attr_accessor :param
|
||||
|
||||
def initialize(message, param, http_status: nil, http_body: nil,
|
||||
json_body: nil, http_headers: nil, code: nil)
|
||||
super(message, http_status: http_status, http_body: http_body,
|
||||
json_body: json_body, http_headers: http_headers,
|
||||
code: code)
|
||||
@param = param
|
||||
end
|
||||
end
|
||||
|
||||
# PermissionError is raised in cases where access was attempted on a resource
|
||||
# that wasn't allowed.
|
||||
class PermissionError < StripeError
|
||||
end
|
||||
|
||||
# RateLimitError is raised in cases where an account is putting too much load
|
||||
# on Stripe's API servers (usually by performing too many requests). Please
|
||||
# back off on request rate.
|
||||
class RateLimitError < StripeError
|
||||
end
|
||||
|
||||
# SignatureVerificationError is raised when the signature verification for a
|
||||
# webhook fails
|
||||
class SignatureVerificationError < StripeError
|
||||
attr_accessor :sig_header
|
||||
|
||||
def initialize(message, sig_header, http_body: nil)
|
||||
super(message, http_body: http_body)
|
||||
@sig_header = sig_header
|
||||
end
|
||||
end
|
||||
|
||||
module OAuth
|
||||
# OAuthError is raised when the OAuth API returns an error.
|
||||
class OAuthError < StripeError
|
||||
def initialize(code, description, http_status: nil, http_body: nil,
|
||||
json_body: nil, http_headers: nil)
|
||||
super(description, http_status: http_status, http_body: http_body,
|
||||
json_body: json_body, http_headers: http_headers,
|
||||
code: code)
|
||||
end
|
||||
|
||||
def construct_error_object
|
||||
return nil if @json_body.nil?
|
||||
|
||||
OAuthErrorObject.construct_from(@json_body, {}, nil, :v1)
|
||||
end
|
||||
end
|
||||
|
||||
# InvalidClientError is raised when the client doesn't belong to you, or
|
||||
# the API key mode (live or test) doesn't match the client mode. Or the
|
||||
# stripe_user_id doesn't exist or isn't connected to your application.
|
||||
class InvalidClientError < OAuthError
|
||||
end
|
||||
|
||||
# InvalidGrantError is raised when a specified code doesn't exist, is
|
||||
# expired, has been used, or doesn't belong to you; a refresh token doesn't
|
||||
# exist, or doesn't belong to you; or if an API key's mode (live or test)
|
||||
# doesn't match the mode of a code or refresh token.
|
||||
class InvalidGrantError < OAuthError
|
||||
end
|
||||
|
||||
# InvalidRequestError is raised when a code, refresh token, or grant type
|
||||
# parameter is not provided, but was required.
|
||||
class InvalidRequestError < OAuthError
|
||||
end
|
||||
|
||||
# InvalidScopeError is raised when an invalid scope parameter is provided.
|
||||
class InvalidScopeError < OAuthError
|
||||
end
|
||||
|
||||
# UnsupportedGrantTypeError is raised when an unuspported grant type
|
||||
# parameter is specified.
|
||||
class UnsupportedGrantTypeError < OAuthError
|
||||
end
|
||||
|
||||
# UnsupportedResponseTypeError is raised when an unsupported response type
|
||||
# parameter is specified.
|
||||
class UnsupportedResponseTypeError < OAuthError
|
||||
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
|
15
lib/stripe/event_types.rb
Normal file
15
lib/stripe/event_types.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# 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,
|
||||
V2CoreEventDestinationPingEvent.lookup_type => V2CoreEventDestinationPingEvent,
|
||||
# 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
|
||||
# Occurs when a Meter has invalid async usage events.
|
||||
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
|
||||
# Occurs when a Meter's id is missing or invalid in async usage events.
|
||||
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
lib/stripe/events/v2_core_event_destination_ping_event.rb
Normal file
21
lib/stripe/events/v2_core_event_destination_ping_event.rb
Normal file
@ -0,0 +1,21 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# A ping event used to test the connection to an event destination.
|
||||
class V2CoreEventDestinationPingEvent < Stripe::V2::Event
|
||||
def self.lookup_type
|
||||
"v2.core.event_destination.ping"
|
||||
end
|
||||
|
||||
# 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
|
106
lib/stripe/instrumentation.rb
Normal file
106
lib/stripe/instrumentation.rb
Normal file
@ -0,0 +1,106 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Instrumentation
|
||||
# Event emitted on `request_begin` callback.
|
||||
class RequestBeginEvent
|
||||
attr_reader :method, :path
|
||||
|
||||
# Arbitrary user-provided data in the form of a Ruby hash that's passed
|
||||
# from subscribers on `request_begin` to subscribers on `request_end`.
|
||||
# `request_begin` subscribers can set keys which will then be available
|
||||
# in `request_end`.
|
||||
#
|
||||
# Note that all subscribers of `request_begin` share the same object, so
|
||||
# they must be careful to set unique keys so as to not conflict with data
|
||||
# set by other subscribers.
|
||||
attr_reader :user_data
|
||||
|
||||
def initialize(method:, path:, user_data:)
|
||||
@method = method
|
||||
@path = path
|
||||
@user_data = user_data
|
||||
freeze
|
||||
end
|
||||
end
|
||||
|
||||
# Event emitted on `request_end` callback.
|
||||
class RequestEndEvent
|
||||
attr_reader :duration, :http_status, :method, :num_retries, :path, :request_id, :response_header, :response_body,
|
||||
:request_header, :request_body
|
||||
|
||||
# Arbitrary user-provided data in the form of a Ruby hash that's passed
|
||||
# from subscribers on `request_begin` to subscribers on `request_end`.
|
||||
# `request_begin` subscribers can set keys which will then be available
|
||||
# in `request_end`.
|
||||
attr_reader :user_data
|
||||
|
||||
def initialize(request_context:, response_context:,
|
||||
num_retries:, user_data: nil)
|
||||
@duration = request_context.duration
|
||||
@http_status = response_context.http_status
|
||||
@method = request_context.method
|
||||
@num_retries = num_retries
|
||||
@path = request_context.path
|
||||
@request_id = request_context.request_id
|
||||
@user_data = user_data
|
||||
@response_header = response_context.header
|
||||
@response_body = response_context.body
|
||||
@request_header = request_context.header
|
||||
@request_body = request_context.body
|
||||
freeze
|
||||
end
|
||||
end
|
||||
|
||||
class RequestContext
|
||||
attr_reader :duration, :method, :path, :request_id, :body, :header
|
||||
|
||||
def initialize(duration:, context:, header:)
|
||||
@duration = duration
|
||||
@method = context.method
|
||||
@path = context.path
|
||||
@request_id = context.request_id
|
||||
@body = context.body
|
||||
@header = header
|
||||
end
|
||||
end
|
||||
|
||||
class ResponseContext
|
||||
attr_reader :http_status, :body, :header
|
||||
|
||||
def initialize(http_status:, response:)
|
||||
@http_status = http_status
|
||||
@header = response ? response.to_hash : nil
|
||||
@body = response ? response.body : nil
|
||||
end
|
||||
end
|
||||
|
||||
# This class was renamed for consistency. This alias is here for backwards
|
||||
# compatibility.
|
||||
RequestEvent = RequestEndEvent
|
||||
|
||||
# Returns true if there are a non-zero number of subscribers on the given
|
||||
# topic, and false otherwise.
|
||||
def self.any_subscribers?(topic)
|
||||
!subscribers[topic].empty?
|
||||
end
|
||||
|
||||
def self.subscribe(topic, name = rand, &block)
|
||||
subscribers[topic][name] = block
|
||||
name
|
||||
end
|
||||
|
||||
def self.unsubscribe(topic, name)
|
||||
subscribers[topic].delete(name)
|
||||
end
|
||||
|
||||
def self.notify(topic, event)
|
||||
subscribers[topic].each_value { |subscriber| subscriber.call(event) }
|
||||
end
|
||||
|
||||
def self.subscribers
|
||||
@subscribers ||= Hash.new { |hash, key| hash[key] = {} }
|
||||
end
|
||||
private_class_method :subscribers
|
||||
end
|
||||
end
|
141
lib/stripe/list_object.rb
Normal file
141
lib/stripe/list_object.rb
Normal file
@ -0,0 +1,141 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class ListObject < StripeObject
|
||||
include Enumerable
|
||||
include Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Request
|
||||
include Stripe::APIOperations::Create
|
||||
|
||||
OBJECT_NAME = "list"
|
||||
def self.object_name
|
||||
"list"
|
||||
end
|
||||
|
||||
# This accessor allows a `ListObject` to inherit various filters that were
|
||||
# given to a predecessor. This allows for things like consistent limits,
|
||||
# expansions, and predicates as a user pages through resources.
|
||||
attr_accessor :filters
|
||||
|
||||
# An empty list object. This is returned from +next+ when we know 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.
|
||||
def self.empty_list(opts = {})
|
||||
ListObject.construct_from({ data: [] }, opts, nil, :v1)
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
self.filters = {}
|
||||
end
|
||||
|
||||
def [](key)
|
||||
case key
|
||||
when String, Symbol
|
||||
super
|
||||
else
|
||||
raise ArgumentError,
|
||||
"You tried to access the #{key.inspect} index, but ListObject " \
|
||||
"types only support String keys. (HINT: List calls return an " \
|
||||
"object with a 'data' (which is the data array). You likely " \
|
||||
"want to call #data[#{key.inspect}])"
|
||||
end
|
||||
end
|
||||
|
||||
# Iterates through each resource in the page represented by the current
|
||||
# `ListObject`.
|
||||
#
|
||||
# Note that this method makes no effort to fetch a new page when it gets to
|
||||
# the end of the current page's resources. See also +auto_paging_each+.
|
||||
def each(&blk)
|
||||
data.each(&blk)
|
||||
end
|
||||
|
||||
# Iterates through each resource in all pages, making additional fetches to
|
||||
# the API as necessary.
|
||||
#
|
||||
# The default iteration direction is forwards according to Stripe's API
|
||||
# "natural" ordering direction -- newer objects first, and moving towards
|
||||
# older objects.
|
||||
#
|
||||
# However, if the initial list object was fetched using an `ending_before`
|
||||
# cursor (and only `ending_before`, `starting_after` cannot also be
|
||||
# included), the method assumes that the user is trying to iterate
|
||||
# backwards compared to natural ordering and returns results that way --
|
||||
# older objects first, and moving towards newer objects.
|
||||
#
|
||||
# Note that this method will make as many API calls as necessary to fetch
|
||||
# all resources. For more granular control, please see +each+ and
|
||||
# +next_page+.
|
||||
def auto_paging_each(&blk)
|
||||
return enum_for(:auto_paging_each) unless block_given?
|
||||
|
||||
page = self
|
||||
loop do
|
||||
# Backward iterating activates if we have an `ending_before` constraint
|
||||
# and _just_ an `ending_before` constraint. If `starting_after` was
|
||||
# also used, we iterate forwards normally.
|
||||
if filters.include?(:ending_before) &&
|
||||
!filters.include?(:starting_after)
|
||||
page.reverse_each(&blk)
|
||||
page = page.previous_page
|
||||
else
|
||||
page.each(&blk)
|
||||
page = page.next_page
|
||||
end
|
||||
|
||||
break if page.empty?
|
||||
end
|
||||
end
|
||||
|
||||
# Returns true if the page object contains no elements.
|
||||
def empty?
|
||||
data.empty?
|
||||
end
|
||||
|
||||
def retrieve(id, opts = {})
|
||||
id, retrieve_params = Util.normalize_id(id)
|
||||
url = "#{resource_url}/#{CGI.escape(id)}"
|
||||
execute_resource_request(:get, url, :api, retrieve_params, opts)
|
||||
end
|
||||
|
||||
# Fetches the next page in the resource list (if there is one).
|
||||
#
|
||||
# This method will try to respect the limit of the current page. If none
|
||||
# was given, the default limit will be fetched again.
|
||||
def next_page(params = {}, opts = {})
|
||||
return self.class.empty_list(opts) unless has_more
|
||||
|
||||
last_id = data.last.id
|
||||
|
||||
params = filters.merge(starting_after: last_id).merge(params)
|
||||
|
||||
list(params, opts)
|
||||
end
|
||||
|
||||
# Fetches the previous page in the resource list (if there is one).
|
||||
#
|
||||
# This method will try to respect the limit of the current page. If none
|
||||
# was given, the default limit will be fetched again.
|
||||
def previous_page(params = {}, opts = {})
|
||||
return self.class.empty_list(opts) unless has_more
|
||||
|
||||
first_id = data.first.id
|
||||
|
||||
params = filters.merge(ending_before: first_id).merge(params)
|
||||
|
||||
list(params, opts)
|
||||
end
|
||||
|
||||
def resource_url
|
||||
url ||
|
||||
raise(ArgumentError, "List object does not contain a 'url' field.")
|
||||
end
|
||||
|
||||
# Iterates through each resource in the page represented by the current
|
||||
# `ListObject` in reverse.
|
||||
def reverse_each(&blk)
|
||||
data.reverse_each(&blk)
|
||||
end
|
||||
end
|
||||
end
|
131
lib/stripe/multipart_encoder.rb
Normal file
131
lib/stripe/multipart_encoder.rb
Normal file
@ -0,0 +1,131 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "securerandom"
|
||||
require "tempfile"
|
||||
|
||||
module Stripe
|
||||
# Encodes parameters into a `multipart/form-data` payload as described by RFC
|
||||
# 2388:
|
||||
#
|
||||
# https://tools.ietf.org/html/rfc2388
|
||||
#
|
||||
# This is most useful for transferring file-like objects.
|
||||
#
|
||||
# Parameters should be added with `#encode`. When ready, use `#body` to get
|
||||
# the encoded result and `#content_type` to get the value that should be
|
||||
# placed in the `Content-Type` header of a subsequent request (which includes
|
||||
# a boundary value).
|
||||
class MultipartEncoder
|
||||
MULTIPART_FORM_DATA = "multipart/form-data"
|
||||
|
||||
# A shortcut for encoding a single set of parameters and finalizing a
|
||||
# result.
|
||||
#
|
||||
# Returns an encoded body and the value that should be set in the content
|
||||
# type header of a subsequent request.
|
||||
def self.encode(params)
|
||||
encoder = MultipartEncoder.new
|
||||
encoder.encode(params)
|
||||
encoder.close
|
||||
[encoder.body, encoder.content_type]
|
||||
end
|
||||
|
||||
# Gets the object's randomly generated boundary string.
|
||||
attr_reader :boundary
|
||||
|
||||
# Initializes a new multipart encoder.
|
||||
def initialize
|
||||
# Kind of weird, but required by Rubocop because the unary plus operator
|
||||
# is considered faster than `Stripe.new`.
|
||||
@body = +""
|
||||
|
||||
# Chose the same number of random bytes that Go uses in its standard
|
||||
# library implementation. Easily enough entropy to ensure that it won't
|
||||
# be present in a file we're sending.
|
||||
@boundary = SecureRandom.hex(30)
|
||||
|
||||
@closed = false
|
||||
@first_field = true
|
||||
end
|
||||
|
||||
# Gets the encoded body. `#close` must be called first.
|
||||
def body
|
||||
raise "object must be closed before getting body" unless @closed
|
||||
|
||||
@body
|
||||
end
|
||||
|
||||
# Finalizes the object by writing the final boundary.
|
||||
def close
|
||||
raise "object already closed" if @closed
|
||||
|
||||
@body << "\r\n"
|
||||
@body << "--#{@boundary}--"
|
||||
|
||||
@closed = true
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
# Gets the value including boundary that should be put into a multipart
|
||||
# request's `Content-Type`.
|
||||
def content_type
|
||||
"#{MULTIPART_FORM_DATA}; boundary=#{@boundary}"
|
||||
end
|
||||
|
||||
# Encodes a set of parameters to the body.
|
||||
#
|
||||
# Note that parameters are expected to be a hash, but a "flat" hash such
|
||||
# that complex substructures like hashes and arrays have already been
|
||||
# appropriately Stripe-encoded. Pass a complex structure through
|
||||
# `Util.flatten_params` first before handing it off to this method.
|
||||
def encode(params)
|
||||
raise "no more parameters can be written to closed object" if @closed
|
||||
|
||||
params.each do |name, val|
|
||||
if val.is_a?(::File) || val.is_a?(::Tempfile)
|
||||
write_field(name, val.read, filename: ::File.basename(val.path))
|
||||
elsif val.respond_to?(:read)
|
||||
write_field(name, val.read, filename: "blob")
|
||||
else
|
||||
write_field(name, val, filename: nil)
|
||||
end
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
#
|
||||
# private
|
||||
#
|
||||
|
||||
# Escapes double quotes so that the given value can be used in a
|
||||
# double-quoted string and replaces any linebreak characters with spaces.
|
||||
private def escape(str)
|
||||
str.gsub('"', "%22").tr("\n", " ").tr("\r", " ")
|
||||
end
|
||||
|
||||
private def write_field(name, data, filename:)
|
||||
if @first_field
|
||||
@first_field = false
|
||||
else
|
||||
@body << "\r\n"
|
||||
end
|
||||
|
||||
@body << "--#{@boundary}\r\n"
|
||||
|
||||
if filename
|
||||
@body << (%(Content-Disposition: form-data) +
|
||||
%(; name="#{escape(name.to_s)}") +
|
||||
%(; filename="#{escape(filename)}"\r\n))
|
||||
@body << %(Content-Type: application/octet-stream\r\n)
|
||||
else
|
||||
@body << (%(Content-Disposition: form-data) +
|
||||
%(; name="#{escape(name.to_s)}"\r\n))
|
||||
end
|
||||
|
||||
@body << "\r\n"
|
||||
@body << data.to_s
|
||||
end
|
||||
end
|
||||
end
|
58
lib/stripe/oauth.rb
Normal file
58
lib/stripe/oauth.rb
Normal file
@ -0,0 +1,58 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module OAuth
|
||||
module OAuthOperations
|
||||
extend APIOperations::Request::ClassMethods
|
||||
|
||||
def self.execute_resource_request(method, url, base_address, params, opts)
|
||||
opts = Util.normalize_opts(opts)
|
||||
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_client_id(params = {})
|
||||
client_id = params[:client_id] || Stripe.client_id
|
||||
unless client_id
|
||||
raise AuthenticationError, "No client_id provided. " \
|
||||
'Set your client_id using "Stripe.client_id = <CLIENT-ID>". ' \
|
||||
"You can find your client_ids in your Stripe dashboard at " \
|
||||
"https://dashboard.stripe.com/account/applications/settings, " \
|
||||
"after registering your account as a platform. See " \
|
||||
"https://stripe.com/docs/connect/standalone-accounts for details, " \
|
||||
"or email support@stripe.com if you have any questions."
|
||||
end
|
||||
client_id
|
||||
end
|
||||
|
||||
def self.authorize_url(params = {}, opts = {})
|
||||
base = opts[:connect_base] || APIRequestor.active_requestor.config.connect_base
|
||||
|
||||
path = "/oauth/authorize"
|
||||
path = "/express" + path if opts[:express]
|
||||
|
||||
params[:client_id] = get_client_id(params)
|
||||
params[:response_type] ||= "code"
|
||||
query = Util.encode_parameters(params, :v1)
|
||||
|
||||
"#{base}#{path}?#{query}"
|
||||
end
|
||||
|
||||
def self.token(params = {}, opts = {})
|
||||
opts = Util.normalize_opts(opts)
|
||||
opts[:api_key] = params[:client_secret] if params[:client_secret]
|
||||
OAuthOperations.execute_resource_request(
|
||||
:post, "/oauth/token", :connect, params, opts
|
||||
)
|
||||
end
|
||||
|
||||
def self.deauthorize(params = {}, opts = {})
|
||||
opts = Util.normalize_opts(opts)
|
||||
params[:client_id] = get_client_id(params)
|
||||
OAuthOperations.execute_resource_request(
|
||||
:post, "/oauth/deauthorize", :connect, params, opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
173
lib/stripe/object_types.rb
Normal file
173
lib/stripe/object_types.rb
Normal file
@ -0,0 +1,173 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# rubocop:disable Metrics/MethodLength
|
||||
|
||||
module Stripe
|
||||
module ObjectTypes
|
||||
def self.object_names_to_classes
|
||||
{
|
||||
# data structures
|
||||
ListObject.object_name => ListObject,
|
||||
SearchResultObject.object_name => SearchResultObject,
|
||||
File.object_name_alt => File,
|
||||
|
||||
# object classes: The beginning of the section generated from our OpenAPI spec
|
||||
Account.object_name => Account,
|
||||
AccountLink.object_name => AccountLink,
|
||||
AccountSession.object_name => AccountSession,
|
||||
ApplePayDomain.object_name => ApplePayDomain,
|
||||
Application.object_name => Application,
|
||||
ApplicationFee.object_name => ApplicationFee,
|
||||
ApplicationFeeRefund.object_name => ApplicationFeeRefund,
|
||||
Apps::Secret.object_name => Apps::Secret,
|
||||
Balance.object_name => Balance,
|
||||
BalanceTransaction.object_name => BalanceTransaction,
|
||||
BankAccount.object_name => BankAccount,
|
||||
Billing::Alert.object_name => Billing::Alert,
|
||||
Billing::AlertTriggered.object_name => Billing::AlertTriggered,
|
||||
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::MeterEvent.object_name => Billing::MeterEvent,
|
||||
Billing::MeterEventAdjustment.object_name => Billing::MeterEventAdjustment,
|
||||
Billing::MeterEventSummary.object_name => Billing::MeterEventSummary,
|
||||
BillingPortal::Configuration.object_name => BillingPortal::Configuration,
|
||||
BillingPortal::Session.object_name => BillingPortal::Session,
|
||||
Capability.object_name => Capability,
|
||||
Card.object_name => Card,
|
||||
CashBalance.object_name => CashBalance,
|
||||
Charge.object_name => Charge,
|
||||
Checkout::Session.object_name => Checkout::Session,
|
||||
Climate::Order.object_name => Climate::Order,
|
||||
Climate::Product.object_name => Climate::Product,
|
||||
Climate::Supplier.object_name => Climate::Supplier,
|
||||
ConfirmationToken.object_name => ConfirmationToken,
|
||||
ConnectCollectionTransfer.object_name => ConnectCollectionTransfer,
|
||||
CountrySpec.object_name => CountrySpec,
|
||||
Coupon.object_name => Coupon,
|
||||
CreditNote.object_name => CreditNote,
|
||||
CreditNoteLineItem.object_name => CreditNoteLineItem,
|
||||
Customer.object_name => Customer,
|
||||
CustomerBalanceTransaction.object_name => CustomerBalanceTransaction,
|
||||
CustomerCashBalanceTransaction.object_name => CustomerCashBalanceTransaction,
|
||||
CustomerSession.object_name => CustomerSession,
|
||||
Discount.object_name => Discount,
|
||||
Dispute.object_name => Dispute,
|
||||
Entitlements::ActiveEntitlement.object_name => Entitlements::ActiveEntitlement,
|
||||
Entitlements::ActiveEntitlementSummary.object_name => Entitlements::ActiveEntitlementSummary,
|
||||
Entitlements::Feature.object_name => Entitlements::Feature,
|
||||
EphemeralKey.object_name => EphemeralKey,
|
||||
Event.object_name => Event,
|
||||
ExchangeRate.object_name => ExchangeRate,
|
||||
File.object_name => File,
|
||||
FileLink.object_name => FileLink,
|
||||
FinancialConnections::Account.object_name => FinancialConnections::Account,
|
||||
FinancialConnections::AccountOwner.object_name => FinancialConnections::AccountOwner,
|
||||
FinancialConnections::AccountOwnership.object_name => FinancialConnections::AccountOwnership,
|
||||
FinancialConnections::Session.object_name => FinancialConnections::Session,
|
||||
FinancialConnections::Transaction.object_name => FinancialConnections::Transaction,
|
||||
Forwarding::Request.object_name => Forwarding::Request,
|
||||
FundingInstructions.object_name => FundingInstructions,
|
||||
Identity::VerificationReport.object_name => Identity::VerificationReport,
|
||||
Identity::VerificationSession.object_name => Identity::VerificationSession,
|
||||
Invoice.object_name => Invoice,
|
||||
InvoiceItem.object_name => InvoiceItem,
|
||||
InvoiceLineItem.object_name => InvoiceLineItem,
|
||||
InvoicePayment.object_name => InvoicePayment,
|
||||
InvoiceRenderingTemplate.object_name => InvoiceRenderingTemplate,
|
||||
Issuing::Authorization.object_name => Issuing::Authorization,
|
||||
Issuing::Card.object_name => Issuing::Card,
|
||||
Issuing::Cardholder.object_name => Issuing::Cardholder,
|
||||
Issuing::Dispute.object_name => Issuing::Dispute,
|
||||
Issuing::PersonalizationDesign.object_name => Issuing::PersonalizationDesign,
|
||||
Issuing::PhysicalBundle.object_name => Issuing::PhysicalBundle,
|
||||
Issuing::Token.object_name => Issuing::Token,
|
||||
Issuing::Transaction.object_name => Issuing::Transaction,
|
||||
LineItem.object_name => LineItem,
|
||||
LoginLink.object_name => LoginLink,
|
||||
Mandate.object_name => Mandate,
|
||||
PaymentIntent.object_name => PaymentIntent,
|
||||
PaymentLink.object_name => PaymentLink,
|
||||
PaymentMethod.object_name => PaymentMethod,
|
||||
PaymentMethodConfiguration.object_name => PaymentMethodConfiguration,
|
||||
PaymentMethodDomain.object_name => PaymentMethodDomain,
|
||||
Payout.object_name => Payout,
|
||||
Person.object_name => Person,
|
||||
Plan.object_name => Plan,
|
||||
Price.object_name => Price,
|
||||
Product.object_name => Product,
|
||||
ProductFeature.object_name => ProductFeature,
|
||||
PromotionCode.object_name => PromotionCode,
|
||||
Quote.object_name => Quote,
|
||||
Radar::EarlyFraudWarning.object_name => Radar::EarlyFraudWarning,
|
||||
Radar::ValueList.object_name => Radar::ValueList,
|
||||
Radar::ValueListItem.object_name => Radar::ValueListItem,
|
||||
Refund.object_name => Refund,
|
||||
Reporting::ReportRun.object_name => Reporting::ReportRun,
|
||||
Reporting::ReportType.object_name => Reporting::ReportType,
|
||||
ReserveTransaction.object_name => ReserveTransaction,
|
||||
Reversal.object_name => Reversal,
|
||||
Review.object_name => Review,
|
||||
SetupAttempt.object_name => SetupAttempt,
|
||||
SetupIntent.object_name => SetupIntent,
|
||||
ShippingRate.object_name => ShippingRate,
|
||||
Sigma::ScheduledQueryRun.object_name => Sigma::ScheduledQueryRun,
|
||||
Source.object_name => Source,
|
||||
SourceMandateNotification.object_name => SourceMandateNotification,
|
||||
SourceTransaction.object_name => SourceTransaction,
|
||||
Subscription.object_name => Subscription,
|
||||
SubscriptionItem.object_name => SubscriptionItem,
|
||||
SubscriptionSchedule.object_name => SubscriptionSchedule,
|
||||
Tax::Calculation.object_name => Tax::Calculation,
|
||||
Tax::CalculationLineItem.object_name => Tax::CalculationLineItem,
|
||||
Tax::Registration.object_name => Tax::Registration,
|
||||
Tax::Settings.object_name => Tax::Settings,
|
||||
Tax::Transaction.object_name => Tax::Transaction,
|
||||
Tax::TransactionLineItem.object_name => Tax::TransactionLineItem,
|
||||
TaxCode.object_name => TaxCode,
|
||||
TaxDeductedAtSource.object_name => TaxDeductedAtSource,
|
||||
TaxId.object_name => TaxId,
|
||||
TaxRate.object_name => TaxRate,
|
||||
Terminal::Configuration.object_name => Terminal::Configuration,
|
||||
Terminal::ConnectionToken.object_name => Terminal::ConnectionToken,
|
||||
Terminal::Location.object_name => Terminal::Location,
|
||||
Terminal::Reader.object_name => Terminal::Reader,
|
||||
TestHelpers::TestClock.object_name => TestHelpers::TestClock,
|
||||
Token.object_name => Token,
|
||||
Topup.object_name => Topup,
|
||||
Transfer.object_name => Transfer,
|
||||
Treasury::CreditReversal.object_name => Treasury::CreditReversal,
|
||||
Treasury::DebitReversal.object_name => Treasury::DebitReversal,
|
||||
Treasury::FinancialAccount.object_name => Treasury::FinancialAccount,
|
||||
Treasury::FinancialAccountFeatures.object_name => Treasury::FinancialAccountFeatures,
|
||||
Treasury::InboundTransfer.object_name => Treasury::InboundTransfer,
|
||||
Treasury::OutboundPayment.object_name => Treasury::OutboundPayment,
|
||||
Treasury::OutboundTransfer.object_name => Treasury::OutboundTransfer,
|
||||
Treasury::ReceivedCredit.object_name => Treasury::ReceivedCredit,
|
||||
Treasury::ReceivedDebit.object_name => Treasury::ReceivedDebit,
|
||||
Treasury::Transaction.object_name => Treasury::Transaction,
|
||||
Treasury::TransactionEntry.object_name => Treasury::TransactionEntry,
|
||||
WebhookEndpoint.object_name => WebhookEndpoint,
|
||||
# object classes: The end of the section generated from our OpenAPI spec
|
||||
}
|
||||
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::EventDestination.object_name => V2::EventDestination,
|
||||
# v2 object classes: The end of the section generated from our OpenAPI spec
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
# rubocop:enable Metrics/MethodLength
|
129
lib/stripe/request_options.rb
Normal file
129
lib/stripe/request_options.rb
Normal file
@ -0,0 +1,129 @@
|
||||
# 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, expects extract_opts_from_hash to be called first!!!
|
||||
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[:stripe_version],
|
||||
headers: req_opts[:headers] || {},
|
||||
}
|
||||
|
||||
# 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
|
24
lib/stripe/request_params.rb
Normal file
24
lib/stripe/request_params.rb
Normal file
@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
# typed: true
|
||||
|
||||
module Stripe
|
||||
# For internal use only. Does not provide a stable API and may be broken
|
||||
# with future non-major changes.
|
||||
class RequestParams
|
||||
def to_h
|
||||
instance_variables.each_with_object({}) do |var, hash|
|
||||
key = var.to_s.delete("@").to_sym
|
||||
value = instance_variable_get(var)
|
||||
|
||||
hash[key] = if value.is_a?(RequestParams)
|
||||
value.to_h
|
||||
# Check if value is an array and contains RequestParams objects
|
||||
elsif value.is_a?(Array)
|
||||
value.map { |item| item.is_a?(RequestParams) ? item.to_h : item }
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
148
lib/stripe/resources.rb
Normal file
148
lib/stripe/resources.rb
Normal file
@ -0,0 +1,148 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "stripe/resources/account"
|
||||
require "stripe/resources/account_link"
|
||||
require "stripe/resources/account_session"
|
||||
require "stripe/resources/apple_pay_domain"
|
||||
require "stripe/resources/application"
|
||||
require "stripe/resources/application_fee"
|
||||
require "stripe/resources/application_fee_refund"
|
||||
require "stripe/resources/apps/secret"
|
||||
require "stripe/resources/balance"
|
||||
require "stripe/resources/balance_transaction"
|
||||
require "stripe/resources/bank_account"
|
||||
require "stripe/resources/billing/alert"
|
||||
require "stripe/resources/billing/alert_triggered"
|
||||
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_event"
|
||||
require "stripe/resources/billing/meter_event_adjustment"
|
||||
require "stripe/resources/billing/meter_event_summary"
|
||||
require "stripe/resources/billing_portal/configuration"
|
||||
require "stripe/resources/billing_portal/session"
|
||||
require "stripe/resources/capability"
|
||||
require "stripe/resources/card"
|
||||
require "stripe/resources/cash_balance"
|
||||
require "stripe/resources/charge"
|
||||
require "stripe/resources/checkout/session"
|
||||
require "stripe/resources/climate/order"
|
||||
require "stripe/resources/climate/product"
|
||||
require "stripe/resources/climate/supplier"
|
||||
require "stripe/resources/confirmation_token"
|
||||
require "stripe/resources/connect_collection_transfer"
|
||||
require "stripe/resources/country_spec"
|
||||
require "stripe/resources/coupon"
|
||||
require "stripe/resources/credit_note"
|
||||
require "stripe/resources/credit_note_line_item"
|
||||
require "stripe/resources/customer"
|
||||
require "stripe/resources/customer_balance_transaction"
|
||||
require "stripe/resources/customer_cash_balance_transaction"
|
||||
require "stripe/resources/customer_session"
|
||||
require "stripe/resources/discount"
|
||||
require "stripe/resources/dispute"
|
||||
require "stripe/resources/entitlements/active_entitlement"
|
||||
require "stripe/resources/entitlements/active_entitlement_summary"
|
||||
require "stripe/resources/entitlements/feature"
|
||||
require "stripe/resources/ephemeral_key"
|
||||
require "stripe/resources/event"
|
||||
require "stripe/resources/exchange_rate"
|
||||
require "stripe/resources/file"
|
||||
require "stripe/resources/file_link"
|
||||
require "stripe/resources/financial_connections/account"
|
||||
require "stripe/resources/financial_connections/account_owner"
|
||||
require "stripe/resources/financial_connections/account_ownership"
|
||||
require "stripe/resources/financial_connections/session"
|
||||
require "stripe/resources/financial_connections/transaction"
|
||||
require "stripe/resources/forwarding/request"
|
||||
require "stripe/resources/funding_instructions"
|
||||
require "stripe/resources/identity/verification_report"
|
||||
require "stripe/resources/identity/verification_session"
|
||||
require "stripe/resources/invoice"
|
||||
require "stripe/resources/invoice_item"
|
||||
require "stripe/resources/invoice_line_item"
|
||||
require "stripe/resources/invoice_payment"
|
||||
require "stripe/resources/invoice_rendering_template"
|
||||
require "stripe/resources/issuing/authorization"
|
||||
require "stripe/resources/issuing/card"
|
||||
require "stripe/resources/issuing/cardholder"
|
||||
require "stripe/resources/issuing/dispute"
|
||||
require "stripe/resources/issuing/personalization_design"
|
||||
require "stripe/resources/issuing/physical_bundle"
|
||||
require "stripe/resources/issuing/token"
|
||||
require "stripe/resources/issuing/transaction"
|
||||
require "stripe/resources/line_item"
|
||||
require "stripe/resources/login_link"
|
||||
require "stripe/resources/mandate"
|
||||
require "stripe/resources/payment_intent"
|
||||
require "stripe/resources/payment_link"
|
||||
require "stripe/resources/payment_method"
|
||||
require "stripe/resources/payment_method_configuration"
|
||||
require "stripe/resources/payment_method_domain"
|
||||
require "stripe/resources/payout"
|
||||
require "stripe/resources/person"
|
||||
require "stripe/resources/plan"
|
||||
require "stripe/resources/price"
|
||||
require "stripe/resources/product"
|
||||
require "stripe/resources/product_feature"
|
||||
require "stripe/resources/promotion_code"
|
||||
require "stripe/resources/quote"
|
||||
require "stripe/resources/radar/early_fraud_warning"
|
||||
require "stripe/resources/radar/value_list"
|
||||
require "stripe/resources/radar/value_list_item"
|
||||
require "stripe/resources/refund"
|
||||
require "stripe/resources/reporting/report_run"
|
||||
require "stripe/resources/reporting/report_type"
|
||||
require "stripe/resources/reserve_transaction"
|
||||
require "stripe/resources/reversal"
|
||||
require "stripe/resources/review"
|
||||
require "stripe/resources/setup_attempt"
|
||||
require "stripe/resources/setup_intent"
|
||||
require "stripe/resources/shipping_rate"
|
||||
require "stripe/resources/sigma/scheduled_query_run"
|
||||
require "stripe/resources/source"
|
||||
require "stripe/resources/source_mandate_notification"
|
||||
require "stripe/resources/source_transaction"
|
||||
require "stripe/resources/subscription"
|
||||
require "stripe/resources/subscription_item"
|
||||
require "stripe/resources/subscription_schedule"
|
||||
require "stripe/resources/tax/calculation"
|
||||
require "stripe/resources/tax/calculation_line_item"
|
||||
require "stripe/resources/tax/registration"
|
||||
require "stripe/resources/tax/settings"
|
||||
require "stripe/resources/tax/transaction"
|
||||
require "stripe/resources/tax/transaction_line_item"
|
||||
require "stripe/resources/tax_code"
|
||||
require "stripe/resources/tax_deducted_at_source"
|
||||
require "stripe/resources/tax_id"
|
||||
require "stripe/resources/tax_rate"
|
||||
require "stripe/resources/terminal/configuration"
|
||||
require "stripe/resources/terminal/connection_token"
|
||||
require "stripe/resources/terminal/location"
|
||||
require "stripe/resources/terminal/reader"
|
||||
require "stripe/resources/test_helpers/test_clock"
|
||||
require "stripe/resources/token"
|
||||
require "stripe/resources/topup"
|
||||
require "stripe/resources/transfer"
|
||||
require "stripe/resources/treasury/credit_reversal"
|
||||
require "stripe/resources/treasury/debit_reversal"
|
||||
require "stripe/resources/treasury/financial_account"
|
||||
require "stripe/resources/treasury/financial_account_features"
|
||||
require "stripe/resources/treasury/inbound_transfer"
|
||||
require "stripe/resources/treasury/outbound_payment"
|
||||
require "stripe/resources/treasury/outbound_transfer"
|
||||
require "stripe/resources/treasury/received_credit"
|
||||
require "stripe/resources/treasury/received_debit"
|
||||
require "stripe/resources/treasury/transaction"
|
||||
require "stripe/resources/treasury/transaction_entry"
|
||||
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/v2/event_destination"
|
||||
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"
|
||||
require "stripe/events/v2_core_event_destination_ping_event"
|
4994
lib/stripe/resources/account.rb
Normal file
4994
lib/stripe/resources/account.rb
Normal file
File diff suppressed because it is too large
Load Diff
76
lib/stripe/resources/account_link.rb
Normal file
76
lib/stripe/resources/account_link.rb
Normal file
@ -0,0 +1,76 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Account Links are the means by which a Connect platform grants a connected account permission to access
|
||||
# Stripe-hosted applications, such as Connect Onboarding.
|
||||
#
|
||||
# Related guide: [Connect Onboarding](https://stripe.com/docs/connect/custom/hosted-onboarding)
|
||||
class AccountLink < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
||||
OBJECT_NAME = "account_link"
|
||||
def self.object_name
|
||||
"account_link"
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class CollectionOptions < Stripe::RequestParams
|
||||
# Specifies whether the platform collects only currently_due requirements (`currently_due`) or both currently_due and eventually_due requirements (`eventually_due`). If you don't specify `collection_options`, the default value is `currently_due`.
|
||||
attr_accessor :fields
|
||||
# Specifies whether the platform collects future_requirements in addition to requirements in Connect Onboarding. The default value is `omit`.
|
||||
attr_accessor :future_requirements
|
||||
|
||||
def initialize(fields: nil, future_requirements: nil)
|
||||
@fields = fields
|
||||
@future_requirements = future_requirements
|
||||
end
|
||||
end
|
||||
# The identifier of the account to create an account link for.
|
||||
attr_accessor :account
|
||||
# The collect parameter is deprecated. Use `collection_options` instead.
|
||||
attr_accessor :collect
|
||||
# Specifies the requirements that Stripe collects from connected accounts in the Connect Onboarding flow.
|
||||
attr_accessor :collection_options
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# The URL the user will be redirected to if the account link is expired, has been previously-visited, or is otherwise invalid. The URL you specify should attempt to generate a new account link with the same parameters used to create the original account link, then redirect the user to the new account link's URL so they can continue with Connect Onboarding. If a new account link cannot be generated or the redirect fails you should display a useful error to the user.
|
||||
attr_accessor :refresh_url
|
||||
# The URL that the user will be redirected to upon leaving or completing the linked flow.
|
||||
attr_accessor :return_url
|
||||
# The type of account link the user is requesting. Possible values are `account_onboarding` or `account_update`.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(
|
||||
account: nil,
|
||||
collect: nil,
|
||||
collection_options: nil,
|
||||
expand: nil,
|
||||
refresh_url: nil,
|
||||
return_url: nil,
|
||||
type: nil
|
||||
)
|
||||
@account = account
|
||||
@collect = collect
|
||||
@collection_options = collection_options
|
||||
@expand = expand
|
||||
@refresh_url = refresh_url
|
||||
@return_url = return_url
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# The timestamp at which this account link will expire.
|
||||
attr_reader :expires_at
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The URL for the account link.
|
||||
attr_reader :url
|
||||
|
||||
# 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 self.create(params = {}, opts = {})
|
||||
request_stripe_object(method: :post, path: "/v1/account_links", params: params, opts: opts)
|
||||
end
|
||||
end
|
||||
end
|
868
lib/stripe/resources/account_session.rb
Normal file
868
lib/stripe/resources/account_session.rb
Normal file
@ -0,0 +1,868 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# An AccountSession allows a Connect platform to grant access to a connected account in Connect embedded components.
|
||||
#
|
||||
# We recommend that you create an AccountSession each time you need to display an embedded component
|
||||
# to your user. Do not save AccountSessions to your database as they expire relatively
|
||||
# quickly, and cannot be used more than once.
|
||||
#
|
||||
# Related guide: [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components)
|
||||
class AccountSession < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
||||
OBJECT_NAME = "account_session"
|
||||
def self.object_name
|
||||
"account_session"
|
||||
end
|
||||
|
||||
class Components < Stripe::StripeObject
|
||||
class AccountManagement < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_reader :disable_stripe_user_authentication
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_reader :external_account_collection
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class AccountOnboarding < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_reader :disable_stripe_user_authentication
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_reader :external_account_collection
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class Balances < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_reader :disable_stripe_user_authentication
|
||||
# Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_reader :edit_payout_schedule
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_reader :external_account_collection
|
||||
# Whether to allow creation of instant payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_reader :instant_payouts
|
||||
# Whether to allow creation of standard payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_reader :standard_payouts
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class DisputesList < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
|
||||
attr_reader :capture_payments
|
||||
# Whether to allow connected accounts to manage destination charges that are created on behalf of them. This is `false` by default.
|
||||
attr_reader :destination_on_behalf_of_charge_management
|
||||
# Whether to allow responding to disputes, including submitting evidence and accepting disputes. This is `true` by default.
|
||||
attr_reader :dispute_management
|
||||
# Whether to allow sending refunds. This is `true` by default.
|
||||
attr_reader :refund_management
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class Documents < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject; end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class FinancialAccount < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_reader :disable_stripe_user_authentication
|
||||
# Whether to allow external accounts to be linked for money transfer.
|
||||
attr_reader :external_account_collection
|
||||
# Whether to allow sending money.
|
||||
attr_reader :send_money
|
||||
# Whether to allow transferring balance.
|
||||
attr_reader :transfer_balance
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class FinancialAccountTransactions < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Whether to allow card spend dispute management features.
|
||||
attr_reader :card_spend_dispute_management
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class IssuingCard < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Whether to allow card management features.
|
||||
attr_reader :card_management
|
||||
# Whether to allow card spend dispute management features.
|
||||
attr_reader :card_spend_dispute_management
|
||||
# Whether to allow cardholder management features.
|
||||
attr_reader :cardholder_management
|
||||
# Whether to allow spend control management features.
|
||||
attr_reader :spend_control_management
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class IssuingCardsList < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Whether to allow card management features.
|
||||
attr_reader :card_management
|
||||
# Whether to allow card spend dispute management features.
|
||||
attr_reader :card_spend_dispute_management
|
||||
# Whether to allow cardholder management features.
|
||||
attr_reader :cardholder_management
|
||||
# Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts.
|
||||
attr_reader :disable_stripe_user_authentication
|
||||
# Whether to allow spend control management features.
|
||||
attr_reader :spend_control_management
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class NotificationBanner < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_reader :disable_stripe_user_authentication
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_reader :external_account_collection
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class PaymentDetails < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
|
||||
attr_reader :capture_payments
|
||||
# Whether to allow connected accounts to manage destination charges that are created on behalf of them. This is `false` by default.
|
||||
attr_reader :destination_on_behalf_of_charge_management
|
||||
# Whether to allow responding to disputes, including submitting evidence and accepting disputes. This is `true` by default.
|
||||
attr_reader :dispute_management
|
||||
# Whether to allow sending refunds. This is `true` by default.
|
||||
attr_reader :refund_management
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class PaymentDisputes < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Whether to allow connected accounts to manage destination charges that are created on behalf of them. This is `false` by default.
|
||||
attr_reader :destination_on_behalf_of_charge_management
|
||||
# Whether to allow responding to disputes, including submitting evidence and accepting disputes. This is `true` by default.
|
||||
attr_reader :dispute_management
|
||||
# Whether to allow sending refunds. This is `true` by default.
|
||||
attr_reader :refund_management
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class Payments < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
|
||||
attr_reader :capture_payments
|
||||
# Whether to allow connected accounts to manage destination charges that are created on behalf of them. This is `false` by default.
|
||||
attr_reader :destination_on_behalf_of_charge_management
|
||||
# Whether to allow responding to disputes, including submitting evidence and accepting disputes. This is `true` by default.
|
||||
attr_reader :dispute_management
|
||||
# Whether to allow sending refunds. This is `true` by default.
|
||||
attr_reader :refund_management
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class Payouts < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_reader :disable_stripe_user_authentication
|
||||
# Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_reader :edit_payout_schedule
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_reader :external_account_collection
|
||||
# Whether to allow creation of instant payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_reader :instant_payouts
|
||||
# Whether to allow creation of standard payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_reader :standard_payouts
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class PayoutsList < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject; end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class TaxRegistrations < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject; end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
|
||||
class TaxSettings < Stripe::StripeObject
|
||||
class Features < Stripe::StripeObject; end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_reader :enabled
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
end
|
||||
# Attribute for field account_management
|
||||
attr_reader :account_management
|
||||
# Attribute for field account_onboarding
|
||||
attr_reader :account_onboarding
|
||||
# Attribute for field balances
|
||||
attr_reader :balances
|
||||
# Attribute for field disputes_list
|
||||
attr_reader :disputes_list
|
||||
# Attribute for field documents
|
||||
attr_reader :documents
|
||||
# Attribute for field financial_account
|
||||
attr_reader :financial_account
|
||||
# Attribute for field financial_account_transactions
|
||||
attr_reader :financial_account_transactions
|
||||
# Attribute for field issuing_card
|
||||
attr_reader :issuing_card
|
||||
# Attribute for field issuing_cards_list
|
||||
attr_reader :issuing_cards_list
|
||||
# Attribute for field notification_banner
|
||||
attr_reader :notification_banner
|
||||
# Attribute for field payment_details
|
||||
attr_reader :payment_details
|
||||
# Attribute for field payment_disputes
|
||||
attr_reader :payment_disputes
|
||||
# Attribute for field payments
|
||||
attr_reader :payments
|
||||
# Attribute for field payouts
|
||||
attr_reader :payouts
|
||||
# Attribute for field payouts_list
|
||||
attr_reader :payouts_list
|
||||
# Attribute for field tax_registrations
|
||||
attr_reader :tax_registrations
|
||||
# Attribute for field tax_settings
|
||||
attr_reader :tax_settings
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class Components < Stripe::RequestParams
|
||||
class AccountManagement < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_accessor :disable_stripe_user_authentication
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_accessor :external_account_collection
|
||||
|
||||
def initialize(
|
||||
disable_stripe_user_authentication: nil,
|
||||
external_account_collection: nil
|
||||
)
|
||||
@disable_stripe_user_authentication = disable_stripe_user_authentication
|
||||
@external_account_collection = external_account_collection
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class AccountOnboarding < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_accessor :disable_stripe_user_authentication
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_accessor :external_account_collection
|
||||
|
||||
def initialize(
|
||||
disable_stripe_user_authentication: nil,
|
||||
external_account_collection: nil
|
||||
)
|
||||
@disable_stripe_user_authentication = disable_stripe_user_authentication
|
||||
@external_account_collection = external_account_collection
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class Balances < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_accessor :disable_stripe_user_authentication
|
||||
# Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_accessor :edit_payout_schedule
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_accessor :external_account_collection
|
||||
# Whether to allow creation of instant payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_accessor :instant_payouts
|
||||
# Whether to allow creation of standard payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_accessor :standard_payouts
|
||||
|
||||
def initialize(
|
||||
disable_stripe_user_authentication: nil,
|
||||
edit_payout_schedule: nil,
|
||||
external_account_collection: nil,
|
||||
instant_payouts: nil,
|
||||
standard_payouts: nil
|
||||
)
|
||||
@disable_stripe_user_authentication = disable_stripe_user_authentication
|
||||
@edit_payout_schedule = edit_payout_schedule
|
||||
@external_account_collection = external_account_collection
|
||||
@instant_payouts = instant_payouts
|
||||
@standard_payouts = standard_payouts
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class DisputesList < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
|
||||
attr_accessor :capture_payments
|
||||
# Whether to allow connected accounts to manage destination charges that are created on behalf of them. This is `false` by default.
|
||||
attr_accessor :destination_on_behalf_of_charge_management
|
||||
# Whether to allow responding to disputes, including submitting evidence and accepting disputes. This is `true` by default.
|
||||
attr_accessor :dispute_management
|
||||
# Whether to allow sending refunds. This is `true` by default.
|
||||
attr_accessor :refund_management
|
||||
|
||||
def initialize(
|
||||
capture_payments: nil,
|
||||
destination_on_behalf_of_charge_management: nil,
|
||||
dispute_management: nil,
|
||||
refund_management: nil
|
||||
)
|
||||
@capture_payments = capture_payments
|
||||
@destination_on_behalf_of_charge_management = destination_on_behalf_of_charge_management
|
||||
@dispute_management = dispute_management
|
||||
@refund_management = refund_management
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class Documents < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams; end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class FinancialAccount < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_accessor :disable_stripe_user_authentication
|
||||
# Whether to allow external accounts to be linked for money transfer.
|
||||
attr_accessor :external_account_collection
|
||||
# Whether to allow sending money.
|
||||
attr_accessor :send_money
|
||||
# Whether to allow transferring balance.
|
||||
attr_accessor :transfer_balance
|
||||
|
||||
def initialize(
|
||||
disable_stripe_user_authentication: nil,
|
||||
external_account_collection: nil,
|
||||
send_money: nil,
|
||||
transfer_balance: nil
|
||||
)
|
||||
@disable_stripe_user_authentication = disable_stripe_user_authentication
|
||||
@external_account_collection = external_account_collection
|
||||
@send_money = send_money
|
||||
@transfer_balance = transfer_balance
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class FinancialAccountTransactions < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Whether to allow card spend dispute management features.
|
||||
attr_accessor :card_spend_dispute_management
|
||||
|
||||
def initialize(card_spend_dispute_management: nil)
|
||||
@card_spend_dispute_management = card_spend_dispute_management
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class IssuingCard < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Whether to allow card management features.
|
||||
attr_accessor :card_management
|
||||
# Whether to allow card spend dispute management features.
|
||||
attr_accessor :card_spend_dispute_management
|
||||
# Whether to allow cardholder management features.
|
||||
attr_accessor :cardholder_management
|
||||
# Whether to allow spend control management features.
|
||||
attr_accessor :spend_control_management
|
||||
|
||||
def initialize(
|
||||
card_management: nil,
|
||||
card_spend_dispute_management: nil,
|
||||
cardholder_management: nil,
|
||||
spend_control_management: nil
|
||||
)
|
||||
@card_management = card_management
|
||||
@card_spend_dispute_management = card_spend_dispute_management
|
||||
@cardholder_management = cardholder_management
|
||||
@spend_control_management = spend_control_management
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class IssuingCardsList < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Whether to allow card management features.
|
||||
attr_accessor :card_management
|
||||
# Whether to allow card spend dispute management features.
|
||||
attr_accessor :card_spend_dispute_management
|
||||
# Whether to allow cardholder management features.
|
||||
attr_accessor :cardholder_management
|
||||
# Disables Stripe user authentication for this embedded component. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts.
|
||||
attr_accessor :disable_stripe_user_authentication
|
||||
# Whether to allow spend control management features.
|
||||
attr_accessor :spend_control_management
|
||||
|
||||
def initialize(
|
||||
card_management: nil,
|
||||
card_spend_dispute_management: nil,
|
||||
cardholder_management: nil,
|
||||
disable_stripe_user_authentication: nil,
|
||||
spend_control_management: nil
|
||||
)
|
||||
@card_management = card_management
|
||||
@card_spend_dispute_management = card_spend_dispute_management
|
||||
@cardholder_management = cardholder_management
|
||||
@disable_stripe_user_authentication = disable_stripe_user_authentication
|
||||
@spend_control_management = spend_control_management
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class NotificationBanner < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_accessor :disable_stripe_user_authentication
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_accessor :external_account_collection
|
||||
|
||||
def initialize(
|
||||
disable_stripe_user_authentication: nil,
|
||||
external_account_collection: nil
|
||||
)
|
||||
@disable_stripe_user_authentication = disable_stripe_user_authentication
|
||||
@external_account_collection = external_account_collection
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class PaymentDetails < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
|
||||
attr_accessor :capture_payments
|
||||
# Whether to allow connected accounts to manage destination charges that are created on behalf of them. This is `false` by default.
|
||||
attr_accessor :destination_on_behalf_of_charge_management
|
||||
# Whether to allow responding to disputes, including submitting evidence and accepting disputes. This is `true` by default.
|
||||
attr_accessor :dispute_management
|
||||
# Whether to allow sending refunds. This is `true` by default.
|
||||
attr_accessor :refund_management
|
||||
|
||||
def initialize(
|
||||
capture_payments: nil,
|
||||
destination_on_behalf_of_charge_management: nil,
|
||||
dispute_management: nil,
|
||||
refund_management: nil
|
||||
)
|
||||
@capture_payments = capture_payments
|
||||
@destination_on_behalf_of_charge_management = destination_on_behalf_of_charge_management
|
||||
@dispute_management = dispute_management
|
||||
@refund_management = refund_management
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class PaymentDisputes < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Whether to allow connected accounts to manage destination charges that are created on behalf of them. This is `false` by default.
|
||||
attr_accessor :destination_on_behalf_of_charge_management
|
||||
# Whether to allow responding to disputes, including submitting evidence and accepting disputes. This is `true` by default.
|
||||
attr_accessor :dispute_management
|
||||
# Whether to allow sending refunds. This is `true` by default.
|
||||
attr_accessor :refund_management
|
||||
|
||||
def initialize(
|
||||
destination_on_behalf_of_charge_management: nil,
|
||||
dispute_management: nil,
|
||||
refund_management: nil
|
||||
)
|
||||
@destination_on_behalf_of_charge_management = destination_on_behalf_of_charge_management
|
||||
@dispute_management = dispute_management
|
||||
@refund_management = refund_management
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class Payments < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
|
||||
attr_accessor :capture_payments
|
||||
# Whether to allow connected accounts to manage destination charges that are created on behalf of them. This is `false` by default.
|
||||
attr_accessor :destination_on_behalf_of_charge_management
|
||||
# Whether to allow responding to disputes, including submitting evidence and accepting disputes. This is `true` by default.
|
||||
attr_accessor :dispute_management
|
||||
# Whether to allow sending refunds. This is `true` by default.
|
||||
attr_accessor :refund_management
|
||||
|
||||
def initialize(
|
||||
capture_payments: nil,
|
||||
destination_on_behalf_of_charge_management: nil,
|
||||
dispute_management: nil,
|
||||
refund_management: nil
|
||||
)
|
||||
@capture_payments = capture_payments
|
||||
@destination_on_behalf_of_charge_management = destination_on_behalf_of_charge_management
|
||||
@dispute_management = dispute_management
|
||||
@refund_management = refund_management
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class Payouts < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams
|
||||
# Disables Stripe user authentication for this embedded component. This value can only be true for accounts where `controller.requirement_collection` is `application`. The default value is the opposite of the `external_account_collection` value. For example, if you don’t set `external_account_collection`, it defaults to true and `disable_stripe_user_authentication` defaults to false.
|
||||
attr_accessor :disable_stripe_user_authentication
|
||||
# Whether to allow payout schedule to be changed. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_accessor :edit_payout_schedule
|
||||
# Whether to allow platforms to control bank account collection for their connected accounts. This feature can only be false for accounts where you’re responsible for collecting updated information when requirements are due or change, like custom accounts. Otherwise, bank account collection is determined by compliance requirements. The default value for this feature is `true`.
|
||||
attr_accessor :external_account_collection
|
||||
# Whether to allow creation of instant payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_accessor :instant_payouts
|
||||
# Whether to allow creation of standard payouts. Default `true` when Stripe owns Loss Liability, default `false` otherwise.
|
||||
attr_accessor :standard_payouts
|
||||
|
||||
def initialize(
|
||||
disable_stripe_user_authentication: nil,
|
||||
edit_payout_schedule: nil,
|
||||
external_account_collection: nil,
|
||||
instant_payouts: nil,
|
||||
standard_payouts: nil
|
||||
)
|
||||
@disable_stripe_user_authentication = disable_stripe_user_authentication
|
||||
@edit_payout_schedule = edit_payout_schedule
|
||||
@external_account_collection = external_account_collection
|
||||
@instant_payouts = instant_payouts
|
||||
@standard_payouts = standard_payouts
|
||||
end
|
||||
end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class PayoutsList < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams; end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class TaxRegistrations < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams; end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
|
||||
class TaxSettings < Stripe::RequestParams
|
||||
class Features < Stripe::RequestParams; end
|
||||
# Whether the embedded component is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of features enabled in the embedded component.
|
||||
attr_accessor :features
|
||||
|
||||
def initialize(enabled: nil, features: nil)
|
||||
@enabled = enabled
|
||||
@features = features
|
||||
end
|
||||
end
|
||||
# Configuration for the account management embedded component.
|
||||
attr_accessor :account_management
|
||||
# Configuration for the account onboarding embedded component.
|
||||
attr_accessor :account_onboarding
|
||||
# Configuration for the balances embedded component.
|
||||
attr_accessor :balances
|
||||
# Configuration for the disputes list embedded component.
|
||||
attr_accessor :disputes_list
|
||||
# Configuration for the documents embedded component.
|
||||
attr_accessor :documents
|
||||
# Configuration for the financial account embedded component.
|
||||
attr_accessor :financial_account
|
||||
# Configuration for the financial account transactions embedded component.
|
||||
attr_accessor :financial_account_transactions
|
||||
# Configuration for the issuing card embedded component.
|
||||
attr_accessor :issuing_card
|
||||
# Configuration for the issuing cards list embedded component.
|
||||
attr_accessor :issuing_cards_list
|
||||
# Configuration for the notification banner embedded component.
|
||||
attr_accessor :notification_banner
|
||||
# Configuration for the payment details embedded component.
|
||||
attr_accessor :payment_details
|
||||
# Configuration for the payment disputes embedded component.
|
||||
attr_accessor :payment_disputes
|
||||
# Configuration for the payments embedded component.
|
||||
attr_accessor :payments
|
||||
# Configuration for the payouts embedded component.
|
||||
attr_accessor :payouts
|
||||
# Configuration for the payouts list embedded component.
|
||||
attr_accessor :payouts_list
|
||||
# Configuration for the tax registrations embedded component.
|
||||
attr_accessor :tax_registrations
|
||||
# Configuration for the tax settings embedded component.
|
||||
attr_accessor :tax_settings
|
||||
|
||||
def initialize(
|
||||
account_management: nil,
|
||||
account_onboarding: nil,
|
||||
balances: nil,
|
||||
disputes_list: nil,
|
||||
documents: nil,
|
||||
financial_account: nil,
|
||||
financial_account_transactions: nil,
|
||||
issuing_card: nil,
|
||||
issuing_cards_list: nil,
|
||||
notification_banner: nil,
|
||||
payment_details: nil,
|
||||
payment_disputes: nil,
|
||||
payments: nil,
|
||||
payouts: nil,
|
||||
payouts_list: nil,
|
||||
tax_registrations: nil,
|
||||
tax_settings: nil
|
||||
)
|
||||
@account_management = account_management
|
||||
@account_onboarding = account_onboarding
|
||||
@balances = balances
|
||||
@disputes_list = disputes_list
|
||||
@documents = documents
|
||||
@financial_account = financial_account
|
||||
@financial_account_transactions = financial_account_transactions
|
||||
@issuing_card = issuing_card
|
||||
@issuing_cards_list = issuing_cards_list
|
||||
@notification_banner = notification_banner
|
||||
@payment_details = payment_details
|
||||
@payment_disputes = payment_disputes
|
||||
@payments = payments
|
||||
@payouts = payouts
|
||||
@payouts_list = payouts_list
|
||||
@tax_registrations = tax_registrations
|
||||
@tax_settings = tax_settings
|
||||
end
|
||||
end
|
||||
# The identifier of the account to create an Account Session for.
|
||||
attr_accessor :account
|
||||
# Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. whether it has been enabled or not).
|
||||
attr_accessor :components
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(account: nil, components: nil, expand: nil)
|
||||
@account = account
|
||||
@components = components
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
# The ID of the account the AccountSession was created for
|
||||
attr_reader :account
|
||||
# The client secret of this AccountSession. Used on the client to set up secure access to the given `account`.
|
||||
#
|
||||
# The client secret can be used to provide access to `account` from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.
|
||||
#
|
||||
# Refer to our docs to [setup Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components) and learn about how `client_secret` should be handled.
|
||||
attr_reader :client_secret
|
||||
# Attribute for field components
|
||||
attr_reader :components
|
||||
# The timestamp at which this AccountSession will expire.
|
||||
attr_reader :expires_at
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
|
||||
# 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 self.create(params = {}, opts = {})
|
||||
request_stripe_object(method: :post, path: "/v1/account_sessions", params: params, opts: opts)
|
||||
end
|
||||
end
|
||||
end
|
34
lib/stripe/resources/alipay_account.rb
Normal file
34
lib/stripe/resources/alipay_account.rb
Normal file
@ -0,0 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class AlipayAccount < APIResource
|
||||
include Stripe::APIOperations::Save
|
||||
include Stripe::APIOperations::Delete
|
||||
|
||||
OBJECT_NAME = "alipay_account"
|
||||
|
||||
def resource_url
|
||||
if !respond_to?(:customer) || customer.nil?
|
||||
raise NotImplementedError,
|
||||
"Alipay accounts cannot be accessed without a customer ID."
|
||||
end
|
||||
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
|
||||
"/#{CGI.escape(id)}"
|
||||
end
|
||||
|
||||
def self.update(_id, _params = nil, _opts = nil)
|
||||
raise NotImplementedError,
|
||||
"Alipay accounts cannot be updated without a customer ID. " \
|
||||
"Update an Alipay account using `Customer.update_source(" \
|
||||
"'customer_id', 'alipay_account_id', update_params)`"
|
||||
end
|
||||
|
||||
def self.retrieve(_id, _opts = nil)
|
||||
raise NotImplementedError,
|
||||
"Alipay accounts cannot be retrieved without a customer ID. " \
|
||||
"Retrieve an Alipay account using `Customer.retrieve_source(" \
|
||||
"'customer_id', 'alipay_account_id')`"
|
||||
end
|
||||
end
|
||||
end
|
108
lib/stripe/resources/apple_pay_domain.rb
Normal file
108
lib/stripe/resources/apple_pay_domain.rb
Normal file
@ -0,0 +1,108 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Domains registered for Apple Pay on the Web
|
||||
class ApplePayDomain < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
include Stripe::APIOperations::Delete
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
OBJECT_NAME = "apple_pay_domain"
|
||||
def self.object_name
|
||||
"apple_pay_domain"
|
||||
end
|
||||
|
||||
class DeleteParams < Stripe::RequestParams; end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# Attribute for param field domain_name
|
||||
attr_accessor :domain_name
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(
|
||||
domain_name: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
limit: nil,
|
||||
starting_after: nil
|
||||
)
|
||||
@domain_name = domain_name
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
# Attribute for param field domain_name
|
||||
attr_accessor :domain_name
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(domain_name: nil, expand: nil)
|
||||
@domain_name = domain_name
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Attribute for field domain_name
|
||||
attr_reader :domain_name
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Always true for a deleted object
|
||||
attr_reader :deleted
|
||||
|
||||
# Create an apple pay domain.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "/v1/apple_pay/domains",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Delete an apple pay domain.
|
||||
def self.delete(domain, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(domain) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Delete an apple pay domain.
|
||||
def delete(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# List apple pay domains.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/apple_pay/domains", params: params, opts: opts)
|
||||
end
|
||||
|
||||
def self.resource_url
|
||||
"/v1/apple_pay/domains"
|
||||
end
|
||||
end
|
||||
end
|
20
lib/stripe/resources/application.rb
Normal file
20
lib/stripe/resources/application.rb
Normal file
@ -0,0 +1,20 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class Application < APIResource
|
||||
OBJECT_NAME = "application"
|
||||
def self.object_name
|
||||
"application"
|
||||
end
|
||||
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# The name of the application.
|
||||
attr_reader :name
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Always true for a deleted object
|
||||
attr_reader :deleted
|
||||
end
|
||||
end
|
108
lib/stripe/resources/application_fee.rb
Normal file
108
lib/stripe/resources/application_fee.rb
Normal file
@ -0,0 +1,108 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class ApplicationFee < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
extend Stripe::APIOperations::NestedResource
|
||||
|
||||
OBJECT_NAME = "application_fee"
|
||||
def self.object_name
|
||||
"application_fee"
|
||||
end
|
||||
|
||||
nested_resource_class_methods :refund, operations: %i[create retrieve update list]
|
||||
|
||||
class FeeSource < Stripe::StripeObject
|
||||
# Charge ID that created this application fee.
|
||||
attr_reader :charge
|
||||
# Payout ID that created this application fee.
|
||||
attr_reader :payout
|
||||
# Type of object that created the application fee.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
class Created < Stripe::RequestParams
|
||||
# Minimum value to filter by (exclusive)
|
||||
attr_accessor :gt
|
||||
# Minimum value to filter by (inclusive)
|
||||
attr_accessor :gte
|
||||
# Maximum value to filter by (exclusive)
|
||||
attr_accessor :lt
|
||||
# Maximum value to filter by (inclusive)
|
||||
attr_accessor :lte
|
||||
|
||||
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
|
||||
@gt = gt
|
||||
@gte = gte
|
||||
@lt = lt
|
||||
@lte = lte
|
||||
end
|
||||
end
|
||||
# Only return application fees for the charge specified by this charge ID.
|
||||
attr_accessor :charge
|
||||
# Only return applications fees that were created during the given date interval.
|
||||
attr_accessor :created
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(
|
||||
charge: nil,
|
||||
created: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
limit: nil,
|
||||
starting_after: nil
|
||||
)
|
||||
@charge = charge
|
||||
@created = created
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
# ID of the Stripe account this fee was taken from.
|
||||
attr_reader :account
|
||||
# Amount earned, in cents (or local equivalent).
|
||||
attr_reader :amount
|
||||
# Amount in cents (or local equivalent) refunded (can be less than the amount attribute on the fee if a partial refund was issued)
|
||||
attr_reader :amount_refunded
|
||||
# ID of the Connect application that earned the fee.
|
||||
attr_reader :application
|
||||
# Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds).
|
||||
attr_reader :balance_transaction
|
||||
# ID of the charge that the application fee was taken from.
|
||||
attr_reader :charge
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
|
||||
attr_reader :fee_source
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# ID of the corresponding charge on the platform account, if this fee was the result of a charge using the `destination` parameter.
|
||||
attr_reader :originating_transaction
|
||||
# Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false.
|
||||
attr_reader :refunded
|
||||
# A list of refunds that have been applied to the fee.
|
||||
attr_reader :refunds
|
||||
|
||||
# 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 self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/application_fees", params: params, opts: opts)
|
||||
end
|
||||
end
|
||||
end
|
55
lib/stripe/resources/application_fee_refund.rb
Normal file
55
lib/stripe/resources/application_fee_refund.rb
Normal file
@ -0,0 +1,55 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# `Application Fee Refund` objects allow you to refund an application fee that
|
||||
# has previously been created but not yet refunded. Funds will be refunded to
|
||||
# the Stripe account from which the fee was originally collected.
|
||||
#
|
||||
# Related guide: [Refunding application fees](https://stripe.com/docs/connect/destination-charges#refunding-app-fee)
|
||||
class ApplicationFeeRefund < APIResource
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "fee_refund"
|
||||
def self.object_name
|
||||
"fee_refund"
|
||||
end
|
||||
|
||||
# Amount, in cents (or local equivalent).
|
||||
attr_reader :amount
|
||||
# Balance transaction that describes the impact on your account balance.
|
||||
attr_reader :balance_transaction
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# ID of the application fee that was refunded.
|
||||
attr_reader :fee
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
attr_reader :metadata
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
|
||||
def resource_url
|
||||
"#{ApplicationFee.resource_url}/#{CGI.escape(fee)}/refunds" \
|
||||
"/#{CGI.escape(id)}"
|
||||
end
|
||||
|
||||
def self.update(_id, _params = nil, _opts = nil)
|
||||
raise NotImplementedError,
|
||||
"Application fee refunds cannot be updated without an " \
|
||||
"application fee ID. Update an application fee refund using " \
|
||||
"`ApplicationFee.update_refund('fee_id', 'refund_id', " \
|
||||
"update_params)`"
|
||||
end
|
||||
|
||||
def self.retrieve(_id, _api_key = nil)
|
||||
raise NotImplementedError,
|
||||
"Application fee refunds cannot be retrieved without an " \
|
||||
"application fee ID. Retrieve an application fee refund using " \
|
||||
"`ApplicationFee.retrieve_refund('fee_id', 'refund_id')`"
|
||||
end
|
||||
end
|
||||
end
|
196
lib/stripe/resources/apps/secret.rb
Normal file
196
lib/stripe/resources/apps/secret.rb
Normal file
@ -0,0 +1,196 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Apps
|
||||
# Secret Store is an API that allows Stripe Apps developers to securely persist secrets for use by UI Extensions and app backends.
|
||||
#
|
||||
# The primary resource in Secret Store is a `secret`. Other apps can't view secrets created by an app. Additionally, secrets are scoped to provide further permission control.
|
||||
#
|
||||
# All Dashboard users and the app backend share `account` scoped secrets. Use the `account` scope for secrets that don't change per-user, like a third-party API key.
|
||||
#
|
||||
# A `user` scoped secret is accessible by the app backend and one specific Dashboard user. Use the `user` scope for per-user secrets like per-user OAuth tokens, where different users might have different permissions.
|
||||
#
|
||||
# Related guide: [Store data between page reloads](https://stripe.com/docs/stripe-apps/store-auth-data-custom-objects)
|
||||
class Secret < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
OBJECT_NAME = "apps.secret"
|
||||
def self.object_name
|
||||
"apps.secret"
|
||||
end
|
||||
|
||||
class Scope < Stripe::StripeObject
|
||||
# The secret scope type.
|
||||
attr_reader :type
|
||||
# The user ID, if type is set to "user"
|
||||
attr_reader :user
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
class Scope < Stripe::RequestParams
|
||||
# The secret scope type.
|
||||
attr_accessor :type
|
||||
# The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
|
||||
attr_accessor :user
|
||||
|
||||
def initialize(type: nil, user: nil)
|
||||
@type = type
|
||||
@user = user
|
||||
end
|
||||
end
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
|
||||
attr_accessor :scope
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(ending_before: nil, expand: nil, limit: nil, scope: nil, starting_after: nil)
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@scope = scope
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class Scope < Stripe::RequestParams
|
||||
# The secret scope type.
|
||||
attr_accessor :type
|
||||
# The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
|
||||
attr_accessor :user
|
||||
|
||||
def initialize(type: nil, user: nil)
|
||||
@type = type
|
||||
@user = user
|
||||
end
|
||||
end
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# The Unix timestamp for the expiry time of the secret, after which the secret deletes.
|
||||
attr_accessor :expires_at
|
||||
# A name for the secret that's unique within the scope.
|
||||
attr_accessor :name
|
||||
# The plaintext secret value to be stored.
|
||||
attr_accessor :payload
|
||||
# Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
|
||||
attr_accessor :scope
|
||||
|
||||
def initialize(expand: nil, expires_at: nil, name: nil, payload: nil, scope: nil)
|
||||
@expand = expand
|
||||
@expires_at = expires_at
|
||||
@name = name
|
||||
@payload = payload
|
||||
@scope = scope
|
||||
end
|
||||
end
|
||||
|
||||
class FindParams < Stripe::RequestParams
|
||||
class Scope < Stripe::RequestParams
|
||||
# The secret scope type.
|
||||
attr_accessor :type
|
||||
# The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
|
||||
attr_accessor :user
|
||||
|
||||
def initialize(type: nil, user: nil)
|
||||
@type = type
|
||||
@user = user
|
||||
end
|
||||
end
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A name for the secret that's unique within the scope.
|
||||
attr_accessor :name
|
||||
# Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
|
||||
attr_accessor :scope
|
||||
|
||||
def initialize(expand: nil, name: nil, scope: nil)
|
||||
@expand = expand
|
||||
@name = name
|
||||
@scope = scope
|
||||
end
|
||||
end
|
||||
|
||||
class DeleteWhereParams < Stripe::RequestParams
|
||||
class Scope < Stripe::RequestParams
|
||||
# The secret scope type.
|
||||
attr_accessor :type
|
||||
# The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
|
||||
attr_accessor :user
|
||||
|
||||
def initialize(type: nil, user: nil)
|
||||
@type = type
|
||||
@user = user
|
||||
end
|
||||
end
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A name for the secret that's unique within the scope.
|
||||
attr_accessor :name
|
||||
# Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
|
||||
attr_accessor :scope
|
||||
|
||||
def initialize(expand: nil, name: nil, scope: nil)
|
||||
@expand = expand
|
||||
@name = name
|
||||
@scope = scope
|
||||
end
|
||||
end
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# If true, indicates that this secret has been deleted
|
||||
attr_reader :deleted
|
||||
# The Unix timestamp for the expiry time of the secret, after which the secret deletes.
|
||||
attr_reader :expires_at
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# A name for the secret that's unique within the scope.
|
||||
attr_reader :name
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The plaintext secret value to be stored.
|
||||
attr_reader :payload
|
||||
# Attribute for field scope
|
||||
attr_reader :scope
|
||||
|
||||
# Create or replace a secret in the secret store.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(method: :post, path: "/v1/apps/secrets", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# Deletes a secret from the secret store by name and scope.
|
||||
def self.delete_where(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "/v1/apps/secrets/delete",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Finds a secret in the secret store by name and scope.
|
||||
def self.find(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/apps/secrets/find",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# List all secrets stored on the given scope.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/apps/secrets", params: params, opts: opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
186
lib/stripe/resources/balance.rb
Normal file
186
lib/stripe/resources/balance.rb
Normal file
@ -0,0 +1,186 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# This is an object representing your Stripe balance. You can retrieve it to see
|
||||
# the balance currently on your Stripe account.
|
||||
#
|
||||
# You can also retrieve the balance history, which contains a list of
|
||||
# [transactions](https://stripe.com/docs/reporting/balance-transaction-types) that contributed to the balance
|
||||
# (charges, payouts, and so forth).
|
||||
#
|
||||
# The available and pending amounts for each currency are broken down further by
|
||||
# payment source types.
|
||||
#
|
||||
# Related guide: [Understanding Connect account balances](https://stripe.com/docs/connect/account-balances)
|
||||
class Balance < SingletonAPIResource
|
||||
OBJECT_NAME = "balance"
|
||||
def self.object_name
|
||||
"balance"
|
||||
end
|
||||
|
||||
class Available < Stripe::StripeObject
|
||||
class SourceTypes < Stripe::StripeObject
|
||||
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
|
||||
attr_reader :bank_account
|
||||
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
|
||||
attr_reader :card
|
||||
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
|
||||
attr_reader :fpx
|
||||
end
|
||||
# Balance amount.
|
||||
attr_reader :amount
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# Attribute for field source_types
|
||||
attr_reader :source_types
|
||||
end
|
||||
|
||||
class ConnectReserved < Stripe::StripeObject
|
||||
class SourceTypes < Stripe::StripeObject
|
||||
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
|
||||
attr_reader :bank_account
|
||||
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
|
||||
attr_reader :card
|
||||
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
|
||||
attr_reader :fpx
|
||||
end
|
||||
# Balance amount.
|
||||
attr_reader :amount
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# Attribute for field source_types
|
||||
attr_reader :source_types
|
||||
end
|
||||
|
||||
class InstantAvailable < Stripe::StripeObject
|
||||
class NetAvailable < Stripe::StripeObject
|
||||
class SourceTypes < Stripe::StripeObject
|
||||
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
|
||||
attr_reader :bank_account
|
||||
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
|
||||
attr_reader :card
|
||||
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
|
||||
attr_reader :fpx
|
||||
end
|
||||
# Net balance amount, subtracting fees from platform-set pricing.
|
||||
attr_reader :amount
|
||||
# ID of the external account for this net balance (not expandable).
|
||||
attr_reader :destination
|
||||
# Attribute for field source_types
|
||||
attr_reader :source_types
|
||||
end
|
||||
|
||||
class SourceTypes < Stripe::StripeObject
|
||||
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
|
||||
attr_reader :bank_account
|
||||
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
|
||||
attr_reader :card
|
||||
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
|
||||
attr_reader :fpx
|
||||
end
|
||||
# Balance amount.
|
||||
attr_reader :amount
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# Breakdown of balance by destination.
|
||||
attr_reader :net_available
|
||||
# Attribute for field source_types
|
||||
attr_reader :source_types
|
||||
end
|
||||
|
||||
class Issuing < Stripe::StripeObject
|
||||
class Available < Stripe::StripeObject
|
||||
class SourceTypes < Stripe::StripeObject
|
||||
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
|
||||
attr_reader :bank_account
|
||||
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
|
||||
attr_reader :card
|
||||
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
|
||||
attr_reader :fpx
|
||||
end
|
||||
# Balance amount.
|
||||
attr_reader :amount
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# Attribute for field source_types
|
||||
attr_reader :source_types
|
||||
end
|
||||
# Funds that are available for use.
|
||||
attr_reader :available
|
||||
end
|
||||
|
||||
class Pending < Stripe::StripeObject
|
||||
class SourceTypes < Stripe::StripeObject
|
||||
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
|
||||
attr_reader :bank_account
|
||||
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
|
||||
attr_reader :card
|
||||
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
|
||||
attr_reader :fpx
|
||||
end
|
||||
# Balance amount.
|
||||
attr_reader :amount
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# Attribute for field source_types
|
||||
attr_reader :source_types
|
||||
end
|
||||
|
||||
class RefundAndDisputePrefunding < Stripe::StripeObject
|
||||
class Available < Stripe::StripeObject
|
||||
class SourceTypes < Stripe::StripeObject
|
||||
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
|
||||
attr_reader :bank_account
|
||||
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
|
||||
attr_reader :card
|
||||
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
|
||||
attr_reader :fpx
|
||||
end
|
||||
# Balance amount.
|
||||
attr_reader :amount
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# Attribute for field source_types
|
||||
attr_reader :source_types
|
||||
end
|
||||
|
||||
class Pending < Stripe::StripeObject
|
||||
class SourceTypes < Stripe::StripeObject
|
||||
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
|
||||
attr_reader :bank_account
|
||||
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
|
||||
attr_reader :card
|
||||
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
|
||||
attr_reader :fpx
|
||||
end
|
||||
# Balance amount.
|
||||
attr_reader :amount
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# Attribute for field source_types
|
||||
attr_reader :source_types
|
||||
end
|
||||
# Funds that are available for use.
|
||||
attr_reader :available
|
||||
# Funds that are pending
|
||||
attr_reader :pending
|
||||
end
|
||||
# Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts). You can find the available balance for each currency and payment type in the `source_types` property.
|
||||
attr_reader :available
|
||||
# Funds held due to negative balances on connected accounts where [account.controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts. You can find the connect reserve balance for each currency and payment type in the `source_types` property.
|
||||
attr_reader :connect_reserved
|
||||
# Funds that you can pay out using Instant Payouts.
|
||||
attr_reader :instant_available
|
||||
# Attribute for field issuing
|
||||
attr_reader :issuing
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the `source_types` property.
|
||||
attr_reader :pending
|
||||
# Attribute for field refund_and_dispute_prefunding
|
||||
attr_reader :refund_and_dispute_prefunding
|
||||
end
|
||||
end
|
134
lib/stripe/resources/balance_transaction.rb
Normal file
134
lib/stripe/resources/balance_transaction.rb
Normal file
@ -0,0 +1,134 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Balance transactions represent funds moving through your Stripe account.
|
||||
# Stripe creates them for every type of transaction that enters or leaves your Stripe account balance.
|
||||
#
|
||||
# Related guide: [Balance transaction types](https://stripe.com/docs/reports/balance-transaction-types)
|
||||
class BalanceTransaction < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
OBJECT_NAME = "balance_transaction"
|
||||
def self.object_name
|
||||
"balance_transaction"
|
||||
end
|
||||
|
||||
class FeeDetail < Stripe::StripeObject
|
||||
# Amount of the fee, in cents.
|
||||
attr_reader :amount
|
||||
# ID of the Connect application that earned the fee.
|
||||
attr_reader :application
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# An arbitrary string attached to the object. Often useful for displaying to users.
|
||||
attr_reader :description
|
||||
# Type of the fee, one of: `application_fee`, `payment_method_passthrough_fee`, `stripe_fee` or `tax`.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
class Created < Stripe::RequestParams
|
||||
# Minimum value to filter by (exclusive)
|
||||
attr_accessor :gt
|
||||
# Minimum value to filter by (inclusive)
|
||||
attr_accessor :gte
|
||||
# Maximum value to filter by (exclusive)
|
||||
attr_accessor :lt
|
||||
# Maximum value to filter by (inclusive)
|
||||
attr_accessor :lte
|
||||
|
||||
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
|
||||
@gt = gt
|
||||
@gte = gte
|
||||
@lt = lt
|
||||
@lte = lte
|
||||
end
|
||||
end
|
||||
# Only return transactions that were created during the given date interval.
|
||||
attr_accessor :created
|
||||
# Only return transactions in a certain currency. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_accessor :currency
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# For automatic Stripe payouts only, only returns transactions that were paid out on the specified payout ID.
|
||||
attr_accessor :payout
|
||||
# Only returns the original transaction.
|
||||
attr_accessor :source
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
# Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `stripe_balance_payment_debit`, `stripe_balance_payment_debit_reversal`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(
|
||||
created: nil,
|
||||
currency: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
limit: nil,
|
||||
payout: nil,
|
||||
source: nil,
|
||||
starting_after: nil,
|
||||
type: nil
|
||||
)
|
||||
@created = created
|
||||
@currency = currency
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@payout = payout
|
||||
@source = source
|
||||
@starting_after = starting_after
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
# Gross amount of this transaction (in cents (or local equivalent)). A positive value represents funds charged to another party, and a negative value represents funds sent to another party.
|
||||
attr_reader :amount
|
||||
# The date that the transaction's net funds become available in the Stripe balance.
|
||||
attr_reader :available_on
|
||||
# The balance that this transaction impacts.
|
||||
attr_reader :balance_type
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# An arbitrary string attached to the object. Often useful for displaying to users.
|
||||
attr_reader :description
|
||||
# If applicable, this transaction uses an exchange rate. If money converts from currency A to currency B, then the `amount` in currency A, multipled by the `exchange_rate`, equals the `amount` in currency B. For example, if you charge a customer 10.00 EUR, the PaymentIntent's `amount` is `1000` and `currency` is `eur`. If this converts to 12.34 USD in your Stripe account, the BalanceTransaction's `amount` is `1234`, its `currency` is `usd`, and the `exchange_rate` is `1.234`.
|
||||
attr_reader :exchange_rate
|
||||
# Fees (in cents (or local equivalent)) paid for this transaction. Represented as a positive integer when assessed.
|
||||
attr_reader :fee
|
||||
# Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction.
|
||||
attr_reader :fee_details
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Net impact to a Stripe balance (in cents (or local equivalent)). A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance. You can calculate the net impact of a transaction on a balance by `amount` - `fee`
|
||||
attr_reader :net
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Learn more about how [reporting categories](https://stripe.com/docs/reports/reporting-categories) can help you understand balance transactions from an accounting perspective.
|
||||
attr_reader :reporting_category
|
||||
# This transaction relates to the Stripe object.
|
||||
attr_reader :source
|
||||
# The transaction's net funds status in the Stripe balance, which are either `available` or `pending`.
|
||||
attr_reader :status
|
||||
# Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `stripe_balance_payment_debit`, `stripe_balance_payment_debit_reversal`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types). To classify transactions for accounting purposes, consider `reporting_category` instead.
|
||||
attr_reader :type
|
||||
|
||||
# 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 self.list(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/balance_transactions",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
174
lib/stripe/resources/bank_account.rb
Normal file
174
lib/stripe/resources/bank_account.rb
Normal file
@ -0,0 +1,174 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# These bank accounts are payment methods on `Customer` objects.
|
||||
#
|
||||
# On the other hand [External Accounts](https://docs.stripe.com/api#external_accounts) are transfer
|
||||
# destinations on `Account` objects for connected accounts.
|
||||
# They can be bank accounts or debit cards as well, and are documented in the links above.
|
||||
#
|
||||
# Related guide: [Bank debits and transfers](https://docs.stripe.com/payments/bank-debits-transfers)
|
||||
class BankAccount < APIResource
|
||||
include Stripe::APIOperations::Delete
|
||||
extend Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "bank_account"
|
||||
def self.object_name
|
||||
"bank_account"
|
||||
end
|
||||
|
||||
class FutureRequirements < Stripe::StripeObject
|
||||
class Error < Stripe::StripeObject
|
||||
# The code for the type of error.
|
||||
attr_reader :code
|
||||
# An informative message that indicates the error type and provides additional details about the error.
|
||||
attr_reader :reason
|
||||
# The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
|
||||
attr_reader :requirement
|
||||
end
|
||||
# Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled.
|
||||
attr_reader :currently_due
|
||||
# Fields that are `currently_due` and need to be collected again because validation or verification failed.
|
||||
attr_reader :errors
|
||||
# Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the external account.
|
||||
attr_reader :past_due
|
||||
# Fields that might become required depending on the results of verification or review. It's an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. Fields might appear in `eventually_due`, `currently_due`, or `past_due` and in `pending_verification` if verification fails but another verification is still pending.
|
||||
attr_reader :pending_verification
|
||||
end
|
||||
|
||||
class Requirements < Stripe::StripeObject
|
||||
class Error < Stripe::StripeObject
|
||||
# The code for the type of error.
|
||||
attr_reader :code
|
||||
# An informative message that indicates the error type and provides additional details about the error.
|
||||
attr_reader :reason
|
||||
# The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
|
||||
attr_reader :requirement
|
||||
end
|
||||
# Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled.
|
||||
attr_reader :currently_due
|
||||
# Fields that are `currently_due` and need to be collected again because validation or verification failed.
|
||||
attr_reader :errors
|
||||
# Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the external account.
|
||||
attr_reader :past_due
|
||||
# Fields that might become required depending on the results of verification or review. It's an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. Fields might appear in `eventually_due`, `currently_due`, or `past_due` and in `pending_verification` if verification fails but another verification is still pending.
|
||||
attr_reader :pending_verification
|
||||
end
|
||||
# The account this bank account belongs to. Only applicable on Accounts (not customers or recipients) This property is only available when returned as an [External Account](/api/external_account_bank_accounts/object) where [controller.is_controller](/api/accounts/object#account_object-controller-is_controller) is `true`.
|
||||
attr_reader :account
|
||||
# The name of the person or business that owns the bank account.
|
||||
attr_reader :account_holder_name
|
||||
# The type of entity that holds the account. This can be either `individual` or `company`.
|
||||
attr_reader :account_holder_type
|
||||
# The bank account type. This can only be `checking` or `savings` in most countries. In Japan, this can only be `futsu` or `toza`.
|
||||
attr_reader :account_type
|
||||
# A set of available payout methods for this bank account. Only values from this set should be passed as the `method` when creating a payout.
|
||||
attr_reader :available_payout_methods
|
||||
# Name of the bank associated with the routing number (e.g., `WELLS FARGO`).
|
||||
attr_reader :bank_name
|
||||
# Two-letter ISO code representing the country the bank account is located in.
|
||||
attr_reader :country
|
||||
# Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
|
||||
attr_reader :currency
|
||||
# The ID of the customer that the bank account is associated with.
|
||||
attr_reader :customer
|
||||
# Whether this bank account is the default external account for its currency.
|
||||
attr_reader :default_for_currency
|
||||
# Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
|
||||
attr_reader :fingerprint
|
||||
# Information about the [upcoming new requirements for the bank account](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when.
|
||||
attr_reader :future_requirements
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# The last four digits of the bank account number.
|
||||
attr_reader :last4
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
attr_reader :metadata
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Information about the requirements for the bank account, including what information needs to be collected.
|
||||
attr_reader :requirements
|
||||
# The routing transit number for the bank account.
|
||||
attr_reader :routing_number
|
||||
# For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a payout sent to this bank account fails, we'll set the status to `errored` and will not continue to send [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) until the bank details are updated.
|
||||
#
|
||||
# For external accounts, possible values are `new`, `errored` and `verification_failed`. If a payout fails, the status is set to `errored` and scheduled payouts are stopped until account details are updated. In the US and India, if we can't [verify the owner of the bank account](https://support.stripe.com/questions/bank-account-ownership-verification), we'll set the status to `verification_failed`. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.
|
||||
attr_reader :status
|
||||
# Always true for a deleted object
|
||||
attr_reader :deleted
|
||||
|
||||
def verify(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def self.verify(customer, id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def resource_url
|
||||
if !customer.nil?
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
||||
elsif !account.nil?
|
||||
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
|
||||
else
|
||||
raise InvalidRequestError, "Could not determine which URL to request: [account, customer] fields are all null"
|
||||
end
|
||||
end
|
||||
|
||||
def self.update(_id, _params = nil, _opts = nil)
|
||||
raise NotImplementedError,
|
||||
"Bank accounts cannot be updated without a customer ID or an " \
|
||||
"account ID. Update a bank account using " \
|
||||
"`Customer.update_source('customer_id', 'bank_account_id', " \
|
||||
"update_params)` or `Account.update_external_account(" \
|
||||
"'account_id', 'bank_account_id', update_params)`"
|
||||
end
|
||||
|
||||
def self.retrieve(_id, _opts = nil)
|
||||
raise NotImplementedError,
|
||||
"Bank accounts cannot be retrieve without a customer ID or an " \
|
||||
"account ID. Retrieve a bank account using " \
|
||||
"`Customer.retrieve_source('customer_id', 'bank_account_id')` " \
|
||||
"or `Account.retrieve_external_account('account_id', " \
|
||||
"'bank_account_id')`"
|
||||
end
|
||||
|
||||
def self.delete(id, params = {}, opts = {})
|
||||
raise NotImplementedError,
|
||||
"Bank accounts cannot be deleted without a customer ID or an " \
|
||||
"account ID. Delete a bank account using " \
|
||||
"`Customer.delete_source('customer_id', 'bank_account_id')` " \
|
||||
"or `Account.delete_external_account('account_id', " \
|
||||
"'bank_account_id')`"
|
||||
end
|
||||
|
||||
def delete(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: resource_url.to_s,
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def self.list(params = {}, opts = {})
|
||||
raise NotImplementedError,
|
||||
"Bank accounts cannot be listed without a customer ID or an " \
|
||||
"account ID. List bank accounts using " \
|
||||
"`Customer.list_sources('customer_id')` " \
|
||||
"or `Account.list_external_accounts('account_id')`"
|
||||
end
|
||||
end
|
||||
end
|
222
lib/stripe/resources/billing/alert.rb
Normal file
222
lib/stripe/resources/billing/alert.rb
Normal file
@ -0,0 +1,222 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Billing
|
||||
# A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
|
||||
class Alert < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
OBJECT_NAME = "billing.alert"
|
||||
def self.object_name
|
||||
"billing.alert"
|
||||
end
|
||||
|
||||
class UsageThreshold < Stripe::StripeObject
|
||||
class Filter < Stripe::StripeObject
|
||||
# Limit the scope of the alert to this customer ID
|
||||
attr_reader :customer
|
||||
# Attribute for field type
|
||||
attr_reader :type
|
||||
end
|
||||
# The filters allow limiting the scope of this usage alert. You can only specify up to one filter at this time.
|
||||
attr_reader :filters
|
||||
# The value at which this alert will trigger.
|
||||
attr_reader :gte
|
||||
# The [Billing Meter](/api/billing/meter) ID whose usage is monitored.
|
||||
attr_reader :meter
|
||||
# Defines how the alert will behave.
|
||||
attr_reader :recurrence
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# Filter results to only include this type of alert.
|
||||
attr_accessor :alert_type
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# Filter results to only include alerts with the given meter.
|
||||
attr_accessor :meter
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(
|
||||
alert_type: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
limit: nil,
|
||||
meter: nil,
|
||||
starting_after: nil
|
||||
)
|
||||
@alert_type = alert_type
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@meter = meter
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class UsageThreshold < Stripe::RequestParams
|
||||
class Filter < Stripe::RequestParams
|
||||
# Limit the scope to this usage alert only to this customer.
|
||||
attr_accessor :customer
|
||||
# What type of filter is being applied to this usage alert.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(customer: nil, type: nil)
|
||||
@customer = customer
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
# The filters allows limiting the scope of this usage alert. You can only specify up to one filter at this time.
|
||||
attr_accessor :filters
|
||||
# Defines at which value the alert will fire.
|
||||
attr_accessor :gte
|
||||
# The [Billing Meter](/api/billing/meter) ID whose usage is monitored.
|
||||
attr_accessor :meter
|
||||
# Whether the alert should only fire only once, or once per billing cycle.
|
||||
attr_accessor :recurrence
|
||||
|
||||
def initialize(filters: nil, gte: nil, meter: nil, recurrence: nil)
|
||||
@filters = filters
|
||||
@gte = gte
|
||||
@meter = meter
|
||||
@recurrence = recurrence
|
||||
end
|
||||
end
|
||||
# The type of alert to create.
|
||||
attr_accessor :alert_type
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# The title of the alert.
|
||||
attr_accessor :title
|
||||
# The configuration of the usage threshold.
|
||||
attr_accessor :usage_threshold
|
||||
|
||||
def initialize(alert_type: nil, expand: nil, title: nil, usage_threshold: nil)
|
||||
@alert_type = alert_type
|
||||
@expand = expand
|
||||
@title = title
|
||||
@usage_threshold = usage_threshold
|
||||
end
|
||||
end
|
||||
|
||||
class ActivateParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
|
||||
class ArchiveParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
|
||||
class DeactivateParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
# Defines the type of the alert.
|
||||
attr_reader :alert_type
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Status of the alert. This can be active, inactive or archived.
|
||||
attr_reader :status
|
||||
# Title of the alert.
|
||||
attr_reader :title
|
||||
# Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](https://stripe.com/docs/api/billing/meter).
|
||||
attr_reader :usage_threshold
|
||||
|
||||
# Reactivates this alert, allowing it to trigger again.
|
||||
def activate(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Reactivates this alert, allowing it to trigger again.
|
||||
def self.activate(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(id) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Archives this alert, removing it from the list view and APIs. This is non-reversible.
|
||||
def archive(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Archives this alert, removing it from the list view and APIs. This is non-reversible.
|
||||
def self.archive(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(id) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Creates a billing alert
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(method: :post, path: "/v1/billing/alerts", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# Deactivates this alert, preventing it from triggering.
|
||||
def deactivate(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Deactivates this alert, preventing it from triggering.
|
||||
def self.deactivate(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(id) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Lists billing active and inactive alerts
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/billing/alerts", params: params, opts: opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
26
lib/stripe/resources/billing/alert_triggered.rb
Normal file
26
lib/stripe/resources/billing/alert_triggered.rb
Normal file
@ -0,0 +1,26 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Billing
|
||||
class AlertTriggered < APIResource
|
||||
OBJECT_NAME = "billing.alert_triggered"
|
||||
def self.object_name
|
||||
"billing.alert_triggered"
|
||||
end
|
||||
|
||||
# A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
|
||||
attr_reader :alert
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# ID of customer for which the alert triggered
|
||||
attr_reader :customer
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The value triggering the alert
|
||||
attr_reader :value
|
||||
end
|
||||
end
|
||||
end
|
54
lib/stripe/resources/billing/credit_balance_summary.rb
Normal file
54
lib/stripe/resources/billing/credit_balance_summary.rb
Normal file
@ -0,0 +1,54 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Billing
|
||||
# Indicates the billing credit balance for billing credits granted to a customer.
|
||||
class CreditBalanceSummary < SingletonAPIResource
|
||||
OBJECT_NAME = "billing.credit_balance_summary"
|
||||
def self.object_name
|
||||
"billing.credit_balance_summary"
|
||||
end
|
||||
|
||||
class Balance < Stripe::StripeObject
|
||||
class AvailableBalance < Stripe::StripeObject
|
||||
class Monetary < Stripe::StripeObject
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# A positive integer representing the amount.
|
||||
attr_reader :value
|
||||
end
|
||||
# The monetary amount.
|
||||
attr_reader :monetary
|
||||
# The type of this amount. We currently only support `monetary` billing credits.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class LedgerBalance < Stripe::StripeObject
|
||||
class Monetary < Stripe::StripeObject
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# A positive integer representing the amount.
|
||||
attr_reader :value
|
||||
end
|
||||
# The monetary amount.
|
||||
attr_reader :monetary
|
||||
# The type of this amount. We currently only support `monetary` billing credits.
|
||||
attr_reader :type
|
||||
end
|
||||
# Attribute for field available_balance
|
||||
attr_reader :available_balance
|
||||
# Attribute for field ledger_balance
|
||||
attr_reader :ledger_balance
|
||||
end
|
||||
# The billing credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry.
|
||||
attr_reader :balances
|
||||
# The customer the balance is for.
|
||||
attr_reader :customer
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
end
|
||||
end
|
||||
end
|
133
lib/stripe/resources/billing/credit_balance_transaction.rb
Normal file
133
lib/stripe/resources/billing/credit_balance_transaction.rb
Normal file
@ -0,0 +1,133 @@
|
||||
# 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
|
||||
|
||||
class Credit < Stripe::StripeObject
|
||||
class Amount < Stripe::StripeObject
|
||||
class Monetary < Stripe::StripeObject
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# A positive integer representing the amount.
|
||||
attr_reader :value
|
||||
end
|
||||
# The monetary amount.
|
||||
attr_reader :monetary
|
||||
# The type of this amount. We currently only support `monetary` billing credits.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class CreditsApplicationInvoiceVoided < Stripe::StripeObject
|
||||
# The invoice to which the reinstated billing credits were originally applied.
|
||||
attr_reader :invoice
|
||||
# The invoice line item to which the reinstated billing credits were originally applied.
|
||||
attr_reader :invoice_line_item
|
||||
end
|
||||
# Attribute for field amount
|
||||
attr_reader :amount
|
||||
# Details of the invoice to which the reinstated credits were originally applied. Only present if `type` is `credits_application_invoice_voided`.
|
||||
attr_reader :credits_application_invoice_voided
|
||||
# The type of credit transaction.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class Debit < Stripe::StripeObject
|
||||
class Amount < Stripe::StripeObject
|
||||
class Monetary < Stripe::StripeObject
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# A positive integer representing the amount.
|
||||
attr_reader :value
|
||||
end
|
||||
# The monetary amount.
|
||||
attr_reader :monetary
|
||||
# The type of this amount. We currently only support `monetary` billing credits.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class CreditsApplied < Stripe::StripeObject
|
||||
# The invoice to which the billing credits were applied.
|
||||
attr_reader :invoice
|
||||
# The invoice line item to which the billing credits were applied.
|
||||
attr_reader :invoice_line_item
|
||||
end
|
||||
# Attribute for field amount
|
||||
attr_reader :amount
|
||||
# Details of how the billing credits were applied to an invoice. Only present if `type` is `credits_applied`.
|
||||
attr_reader :credits_applied
|
||||
# The type of debit transaction.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# The credit grant for which to fetch credit balance transactions.
|
||||
attr_accessor :credit_grant
|
||||
# The customer for which to fetch credit balance transactions.
|
||||
attr_accessor :customer
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(
|
||||
credit_grant: nil,
|
||||
customer: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
limit: nil,
|
||||
starting_after: nil
|
||||
)
|
||||
@credit_grant = credit_grant
|
||||
@customer = customer
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Credit details for this credit balance transaction. Only present if type is `credit`.
|
||||
attr_reader :credit
|
||||
# The credit grant associated with this credit balance transaction.
|
||||
attr_reader :credit_grant
|
||||
# Debit details for this credit balance transaction. Only present if type is `debit`.
|
||||
attr_reader :debit
|
||||
# The effective time of this credit balance transaction.
|
||||
attr_reader :effective_at
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# ID of the test clock this credit balance transaction belongs to.
|
||||
attr_reader :test_clock
|
||||
# The type of credit balance transaction (credit or debit).
|
||||
attr_reader :type
|
||||
|
||||
# Retrieve a list of credit balance transactions.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/billing/credit_balance_transactions",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
307
lib/stripe/resources/billing/credit_grant.rb
Normal file
307
lib/stripe/resources/billing/credit_grant.rb
Normal file
@ -0,0 +1,307 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Billing
|
||||
# A credit grant is an API resource that documents the allocation of some billing credits to a customer.
|
||||
#
|
||||
# Related guide: [Billing credits](https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits)
|
||||
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
|
||||
|
||||
class Amount < Stripe::StripeObject
|
||||
class Monetary < Stripe::StripeObject
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# A positive integer representing the amount.
|
||||
attr_reader :value
|
||||
end
|
||||
# The monetary amount.
|
||||
attr_reader :monetary
|
||||
# The type of this amount. We currently only support `monetary` billing credits.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class ApplicabilityConfig < Stripe::StripeObject
|
||||
class Scope < Stripe::StripeObject
|
||||
class Price < Stripe::StripeObject
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
end
|
||||
# The price type that credit grants can apply to. We currently only support the `metered` price type. This refers to prices that have a [Billing Meter](https://docs.stripe.com/api/billing/meter) attached to them. Cannot be used in combination with `prices`.
|
||||
attr_reader :price_type
|
||||
# The prices that credit grants can apply to. We currently only support `metered` prices. This refers to prices that have a [Billing Meter](https://docs.stripe.com/api/billing/meter) attached to them. Cannot be used in combination with `price_type`.
|
||||
attr_reader :prices
|
||||
end
|
||||
# Attribute for field scope
|
||||
attr_reader :scope
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# Only return credit grants for this customer.
|
||||
attr_accessor :customer
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(
|
||||
customer: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
limit: nil,
|
||||
starting_after: nil
|
||||
)
|
||||
@customer = customer
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class Amount < Stripe::RequestParams
|
||||
class Monetary < Stripe::RequestParams
|
||||
# Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `value` parameter.
|
||||
attr_accessor :currency
|
||||
# A positive integer representing the amount of the credit grant.
|
||||
attr_accessor :value
|
||||
|
||||
def initialize(currency: nil, value: nil)
|
||||
@currency = currency
|
||||
@value = value
|
||||
end
|
||||
end
|
||||
# The monetary amount.
|
||||
attr_accessor :monetary
|
||||
# Specify the type of this amount. We currently only support `monetary` billing credits.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(monetary: nil, type: nil)
|
||||
@monetary = monetary
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
|
||||
class ApplicabilityConfig < Stripe::RequestParams
|
||||
class Scope < Stripe::RequestParams
|
||||
class Price < Stripe::RequestParams
|
||||
# The price ID this credit grant should apply to.
|
||||
attr_accessor :id
|
||||
|
||||
def initialize(id: nil)
|
||||
@id = id
|
||||
end
|
||||
end
|
||||
# The price type that credit grants can apply to. We currently only support the `metered` price type. Cannot be used in combination with `prices`.
|
||||
attr_accessor :price_type
|
||||
# A list of prices that the credit grant can apply to. We currently only support the `metered` prices. Cannot be used in combination with `price_type`.
|
||||
attr_accessor :prices
|
||||
|
||||
def initialize(price_type: nil, prices: nil)
|
||||
@price_type = price_type
|
||||
@prices = prices
|
||||
end
|
||||
end
|
||||
# Specify the scope of this applicability config.
|
||||
attr_accessor :scope
|
||||
|
||||
def initialize(scope: nil)
|
||||
@scope = scope
|
||||
end
|
||||
end
|
||||
# Amount of this credit grant.
|
||||
attr_accessor :amount
|
||||
# Configuration specifying what this credit grant applies to. We currently only support `metered` prices that have a [Billing Meter](https://docs.stripe.com/api/billing/meter) attached to them.
|
||||
attr_accessor :applicability_config
|
||||
# The category of this credit grant.
|
||||
attr_accessor :category
|
||||
# ID of the customer to receive the billing credits.
|
||||
attr_accessor :customer
|
||||
# The time when the billing credits become effective-when they're eligible for use. It defaults to the current timestamp if not specified.
|
||||
attr_accessor :effective_at
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# The time when the billing credits expire. If not specified, the billing credits don't expire.
|
||||
attr_accessor :expires_at
|
||||
# Set of key-value pairs that you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format.
|
||||
attr_accessor :metadata
|
||||
# A descriptive name shown in the Dashboard.
|
||||
attr_accessor :name
|
||||
# The desired priority for applying this credit grant. If not specified, it will be set to the default value of 50. The highest priority is 0 and the lowest is 100.
|
||||
attr_accessor :priority
|
||||
|
||||
def initialize(
|
||||
amount: nil,
|
||||
applicability_config: nil,
|
||||
category: nil,
|
||||
customer: nil,
|
||||
effective_at: nil,
|
||||
expand: nil,
|
||||
expires_at: nil,
|
||||
metadata: nil,
|
||||
name: nil,
|
||||
priority: nil
|
||||
)
|
||||
@amount = amount
|
||||
@applicability_config = applicability_config
|
||||
@category = category
|
||||
@customer = customer
|
||||
@effective_at = effective_at
|
||||
@expand = expand
|
||||
@expires_at = expires_at
|
||||
@metadata = metadata
|
||||
@name = name
|
||||
@priority = priority
|
||||
end
|
||||
end
|
||||
|
||||
class UpdateParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# The time when the billing credits created by this credit grant expire. If set to empty, the billing credits never expire.
|
||||
attr_accessor :expires_at
|
||||
# Set of key-value pairs you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format.
|
||||
attr_accessor :metadata
|
||||
|
||||
def initialize(expand: nil, expires_at: nil, metadata: nil)
|
||||
@expand = expand
|
||||
@expires_at = expires_at
|
||||
@metadata = metadata
|
||||
end
|
||||
end
|
||||
|
||||
class ExpireParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
|
||||
class VoidGrantParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
# Attribute for field amount
|
||||
attr_reader :amount
|
||||
# Attribute for field applicability_config
|
||||
attr_reader :applicability_config
|
||||
# The category of this credit grant. This is for tracking purposes and isn't displayed to the customer.
|
||||
attr_reader :category
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# ID of the customer receiving the billing credits.
|
||||
attr_reader :customer
|
||||
# The time when the billing credits become effective-when they're eligible for use.
|
||||
attr_reader :effective_at
|
||||
# The time when the billing credits expire. If not present, the billing credits don't expire.
|
||||
attr_reader :expires_at
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
attr_reader :metadata
|
||||
# A descriptive name shown in dashboard.
|
||||
attr_reader :name
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The priority for applying this credit grant. The highest priority is 0 and the lowest is 100.
|
||||
attr_reader :priority
|
||||
# ID of the test clock this credit grant belongs to.
|
||||
attr_reader :test_clock
|
||||
# Time at which the object was last updated. Measured in seconds since the Unix epoch.
|
||||
attr_reader :updated
|
||||
# The time when this credit grant was voided. If not present, the credit grant hasn't been voided.
|
||||
attr_reader :voided_at
|
||||
|
||||
# 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(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/billing/credit_grants",
|
||||
params: params,
|
||||
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
|
254
lib/stripe/resources/billing/meter.rb
Normal file
254
lib/stripe/resources/billing/meter.rb
Normal file
@ -0,0 +1,254 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Billing
|
||||
# Meters specify how to aggregate meter events over a billing period. Meter events represent the actions that customers take in your system. Meters attach to prices and form the basis of the bill.
|
||||
#
|
||||
# Related guide: [Usage based billing](https://docs.stripe.com/billing/subscriptions/usage-based)
|
||||
class Meter < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
extend Stripe::APIOperations::List
|
||||
extend Stripe::APIOperations::NestedResource
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "billing.meter"
|
||||
def self.object_name
|
||||
"billing.meter"
|
||||
end
|
||||
|
||||
nested_resource_class_methods :event_summary,
|
||||
operations: %i[list],
|
||||
resource_plural: "event_summaries"
|
||||
|
||||
class CustomerMapping < Stripe::StripeObject
|
||||
# The key in the meter event payload to use for mapping the event to a customer.
|
||||
attr_reader :event_payload_key
|
||||
# The method for mapping a meter event to a customer.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class DefaultAggregation < Stripe::StripeObject
|
||||
# Specifies how events are aggregated.
|
||||
attr_reader :formula
|
||||
end
|
||||
|
||||
class StatusTransitions < Stripe::StripeObject
|
||||
# The time the meter was deactivated, if any. Measured in seconds since Unix epoch.
|
||||
attr_reader :deactivated_at
|
||||
end
|
||||
|
||||
class ValueSettings < Stripe::StripeObject
|
||||
# The key in the meter event payload to use as the value for this meter.
|
||||
attr_reader :event_payload_key
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
# Filter results to only include meters with the given status.
|
||||
attr_accessor :status
|
||||
|
||||
def initialize(
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
limit: nil,
|
||||
starting_after: nil,
|
||||
status: nil
|
||||
)
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
@status = status
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class CustomerMapping < Stripe::RequestParams
|
||||
# The key in the meter event payload to use for mapping the event to a customer.
|
||||
attr_accessor :event_payload_key
|
||||
# The method for mapping a meter event to a customer. Must be `by_id`.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(event_payload_key: nil, type: nil)
|
||||
@event_payload_key = event_payload_key
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
|
||||
class DefaultAggregation < Stripe::RequestParams
|
||||
# Specifies how events are aggregated. Allowed values are `count` to count the number of events, `sum` to sum each event's value and `last` to take the last event's value in the window.
|
||||
attr_accessor :formula
|
||||
|
||||
def initialize(formula: nil)
|
||||
@formula = formula
|
||||
end
|
||||
end
|
||||
|
||||
class ValueSettings < Stripe::RequestParams
|
||||
# The key in the usage event payload to use as the value for this meter. For example, if the event payload contains usage on a `bytes_used` field, then set the event_payload_key to "bytes_used".
|
||||
attr_accessor :event_payload_key
|
||||
|
||||
def initialize(event_payload_key: nil)
|
||||
@event_payload_key = event_payload_key
|
||||
end
|
||||
end
|
||||
# Fields that specify how to map a meter event to a customer.
|
||||
attr_accessor :customer_mapping
|
||||
# The default settings to aggregate a meter's events with.
|
||||
attr_accessor :default_aggregation
|
||||
# The meter’s name. Not visible to the customer.
|
||||
attr_accessor :display_name
|
||||
# The name of the meter event to record usage for. Corresponds with the `event_name` field on meter events.
|
||||
attr_accessor :event_name
|
||||
# The time window to pre-aggregate meter events for, if any.
|
||||
attr_accessor :event_time_window
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Fields that specify how to calculate a meter event's value.
|
||||
attr_accessor :value_settings
|
||||
|
||||
def initialize(
|
||||
customer_mapping: nil,
|
||||
default_aggregation: nil,
|
||||
display_name: nil,
|
||||
event_name: nil,
|
||||
event_time_window: nil,
|
||||
expand: nil,
|
||||
value_settings: nil
|
||||
)
|
||||
@customer_mapping = customer_mapping
|
||||
@default_aggregation = default_aggregation
|
||||
@display_name = display_name
|
||||
@event_name = event_name
|
||||
@event_time_window = event_time_window
|
||||
@expand = expand
|
||||
@value_settings = value_settings
|
||||
end
|
||||
end
|
||||
|
||||
class UpdateParams < Stripe::RequestParams
|
||||
# The meter’s name. Not visible to the customer.
|
||||
attr_accessor :display_name
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(display_name: nil, expand: nil)
|
||||
@display_name = display_name
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
|
||||
class DeactivateParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
|
||||
class ReactivateParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Attribute for field customer_mapping
|
||||
attr_reader :customer_mapping
|
||||
# Attribute for field default_aggregation
|
||||
attr_reader :default_aggregation
|
||||
# The meter's name.
|
||||
attr_reader :display_name
|
||||
# The name of the meter event to record usage for. Corresponds with the `event_name` field on meter events.
|
||||
attr_reader :event_name
|
||||
# The time window to pre-aggregate meter events for, if any.
|
||||
attr_reader :event_time_window
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The meter's status.
|
||||
attr_reader :status
|
||||
# Attribute for field status_transitions
|
||||
attr_reader :status_transitions
|
||||
# Time at which the object was last updated. Measured in seconds since the Unix epoch.
|
||||
attr_reader :updated
|
||||
# Attribute for field value_settings
|
||||
attr_reader :value_settings
|
||||
|
||||
# Creates a billing meter.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(method: :post, path: "/v1/billing/meters", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# When a meter is deactivated, no more meter events will be accepted for this meter. You can't attach a deactivated meter to a price.
|
||||
def deactivate(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/meters/%<id>s/deactivate", { id: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# When a meter is deactivated, no more meter events will be accepted for this meter. You can't attach a deactivated meter to a price.
|
||||
def self.deactivate(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/meters/%<id>s/deactivate", { id: CGI.escape(id) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Retrieve a list of billing meters.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/billing/meters", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price.
|
||||
def reactivate(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/meters/%<id>s/reactivate", { id: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price.
|
||||
def self.reactivate(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/meters/%<id>s/reactivate", { id: CGI.escape(id) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Updates a billing meter.
|
||||
def self.update(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing/meters/%<id>s", { id: CGI.escape(id) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
61
lib/stripe/resources/billing/meter_event.rb
Normal file
61
lib/stripe/resources/billing/meter_event.rb
Normal file
@ -0,0 +1,61 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Billing
|
||||
# Meter events represent actions that customers take in your system. You can use meter events to bill a customer based on their usage. Meter events are associated with billing meters, which define both the contents of the event's payload and how to aggregate those events.
|
||||
class MeterEvent < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
||||
OBJECT_NAME = "billing.meter_event"
|
||||
def self.object_name
|
||||
"billing.meter_event"
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
# The name of the meter event. Corresponds with the `event_name` field on a meter.
|
||||
attr_accessor :event_name
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A unique identifier for the event. If not provided, one is generated. We recommend using UUID-like identifiers. We will enforce uniqueness within a rolling period of at least 24 hours. The enforcement of uniqueness primarily addresses issues arising from accidental retries or other problems occurring within extremely brief time intervals. This approach helps prevent duplicate entries and ensures data integrity in high-frequency operations.
|
||||
attr_accessor :identifier
|
||||
# The payload of the event. This must contain the fields corresponding to a meter's `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and `value_settings.event_payload_key` (default is `value`). Read more about the [payload](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides).
|
||||
attr_accessor :payload
|
||||
# The time of the event. Measured in seconds since the Unix epoch. Must be within the past 35 calendar days or up to 5 minutes in the future. Defaults to current timestamp if not specified.
|
||||
attr_accessor :timestamp
|
||||
|
||||
def initialize(event_name: nil, expand: nil, identifier: nil, payload: nil, timestamp: nil)
|
||||
@event_name = event_name
|
||||
@expand = expand
|
||||
@identifier = identifier
|
||||
@payload = payload
|
||||
@timestamp = timestamp
|
||||
end
|
||||
end
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# The name of the meter event. Corresponds with the `event_name` field on a meter.
|
||||
attr_reader :event_name
|
||||
# A unique identifier for the event.
|
||||
attr_reader :identifier
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The payload of the event. This contains the fields corresponding to a meter's `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and `value_settings.event_payload_key` (default is `value`). Read more about the [payload](https://stripe.com/docs/billing/subscriptions/usage-based/recording-usage#payload-key-overrides).
|
||||
attr_reader :payload
|
||||
# The timestamp passed in when creating the event. Measured in seconds since the Unix epoch.
|
||||
attr_reader :timestamp
|
||||
|
||||
# Creates a billing meter event.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "/v1/billing/meter_events",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
69
lib/stripe/resources/billing/meter_event_adjustment.rb
Normal file
69
lib/stripe/resources/billing/meter_event_adjustment.rb
Normal file
@ -0,0 +1,69 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Billing
|
||||
# A billing meter event adjustment is a resource that allows you to cancel a meter event. For example, you might create a billing meter event adjustment to cancel a meter event that was created in error or attached to the wrong customer.
|
||||
class MeterEventAdjustment < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
||||
OBJECT_NAME = "billing.meter_event_adjustment"
|
||||
def self.object_name
|
||||
"billing.meter_event_adjustment"
|
||||
end
|
||||
|
||||
class Cancel < Stripe::StripeObject
|
||||
# Unique identifier for the event.
|
||||
attr_reader :identifier
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class Cancel < Stripe::RequestParams
|
||||
# Unique identifier for the event. You can only cancel events within 24 hours of Stripe receiving them.
|
||||
attr_accessor :identifier
|
||||
|
||||
def initialize(identifier: nil)
|
||||
@identifier = identifier
|
||||
end
|
||||
end
|
||||
# Specifies which event to cancel.
|
||||
attr_accessor :cancel
|
||||
# The name of the meter event. Corresponds with the `event_name` field on a meter.
|
||||
attr_accessor :event_name
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(cancel: nil, event_name: nil, expand: nil, type: nil)
|
||||
@cancel = cancel
|
||||
@event_name = event_name
|
||||
@expand = expand
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
# Specifies which event to cancel.
|
||||
attr_reader :cancel
|
||||
# The name of the meter event. Corresponds with the `event_name` field on a meter.
|
||||
attr_reader :event_name
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The meter event adjustment's status.
|
||||
attr_reader :status
|
||||
# Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet.
|
||||
attr_reader :type
|
||||
|
||||
# Creates a billing meter event adjustment.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "/v1/billing/meter_event_adjustments",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
32
lib/stripe/resources/billing/meter_event_summary.rb
Normal file
32
lib/stripe/resources/billing/meter_event_summary.rb
Normal file
@ -0,0 +1,32 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Billing
|
||||
# A billing meter event summary represents an aggregated view of a customer's billing meter events within a specified timeframe. It indicates how much
|
||||
# usage was accrued by a customer for that period.
|
||||
#
|
||||
# Note: Meters events are aggregated asynchronously so the meter event summaries provide an eventually consistent view of the reported usage.
|
||||
class MeterEventSummary < APIResource
|
||||
OBJECT_NAME = "billing.meter_event_summary"
|
||||
def self.object_name
|
||||
"billing.meter_event_summary"
|
||||
end
|
||||
|
||||
# Aggregated value of all the events within `start_time` (inclusive) and `end_time` (inclusive). The aggregation strategy is defined on meter via `default_aggregation`.
|
||||
attr_reader :aggregated_value
|
||||
# End timestamp for this event summary (exclusive). Must be aligned with minute boundaries.
|
||||
attr_reader :end_time
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# The meter associated with this event summary.
|
||||
attr_reader :meter
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Start timestamp for this event summary (inclusive). Must be aligned with minute boundaries.
|
||||
attr_reader :start_time
|
||||
end
|
||||
end
|
||||
end
|
601
lib/stripe/resources/billing_portal/configuration.rb
Normal file
601
lib/stripe/resources/billing_portal/configuration.rb
Normal file
@ -0,0 +1,601 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module BillingPortal
|
||||
# A portal configuration describes the functionality and behavior of a portal session.
|
||||
class Configuration < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
extend Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "billing_portal.configuration"
|
||||
def self.object_name
|
||||
"billing_portal.configuration"
|
||||
end
|
||||
|
||||
class BusinessProfile < Stripe::StripeObject
|
||||
# The messaging shown to customers in the portal.
|
||||
attr_reader :headline
|
||||
# A link to the business’s publicly available privacy policy.
|
||||
attr_reader :privacy_policy_url
|
||||
# A link to the business’s publicly available terms of service.
|
||||
attr_reader :terms_of_service_url
|
||||
end
|
||||
|
||||
class Features < Stripe::StripeObject
|
||||
class CustomerUpdate < Stripe::StripeObject
|
||||
# The types of customer updates that are supported. When empty, customers are not updateable.
|
||||
attr_reader :allowed_updates
|
||||
# Whether the feature is enabled.
|
||||
attr_reader :enabled
|
||||
end
|
||||
|
||||
class InvoiceHistory < Stripe::StripeObject
|
||||
# Whether the feature is enabled.
|
||||
attr_reader :enabled
|
||||
end
|
||||
|
||||
class PaymentMethodUpdate < Stripe::StripeObject
|
||||
# Whether the feature is enabled.
|
||||
attr_reader :enabled
|
||||
end
|
||||
|
||||
class SubscriptionCancel < Stripe::StripeObject
|
||||
class CancellationReason < Stripe::StripeObject
|
||||
# Whether the feature is enabled.
|
||||
attr_reader :enabled
|
||||
# Which cancellation reasons will be given as options to the customer.
|
||||
attr_reader :options
|
||||
end
|
||||
# Attribute for field cancellation_reason
|
||||
attr_reader :cancellation_reason
|
||||
# Whether the feature is enabled.
|
||||
attr_reader :enabled
|
||||
# Whether to cancel subscriptions immediately or at the end of the billing period.
|
||||
attr_reader :mode
|
||||
# Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`.
|
||||
attr_reader :proration_behavior
|
||||
end
|
||||
|
||||
class SubscriptionUpdate < Stripe::StripeObject
|
||||
class Product < Stripe::StripeObject
|
||||
# The list of price IDs which, when subscribed to, a subscription can be updated.
|
||||
attr_reader :prices
|
||||
# The product ID.
|
||||
attr_reader :product
|
||||
end
|
||||
|
||||
class ScheduleAtPeriodEnd < Stripe::StripeObject
|
||||
class Condition < Stripe::StripeObject
|
||||
# The type of condition.
|
||||
attr_reader :type
|
||||
end
|
||||
# List of conditions. When any condition is true, an update will be scheduled at the end of the current period.
|
||||
attr_reader :conditions
|
||||
end
|
||||
# The types of subscription updates that are supported for items listed in the `products` attribute. When empty, subscriptions are not updateable.
|
||||
attr_reader :default_allowed_updates
|
||||
# Whether the feature is enabled.
|
||||
attr_reader :enabled
|
||||
# The list of up to 10 products that support subscription updates.
|
||||
attr_reader :products
|
||||
# Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. Defaults to a value of `none` if you don't set it during creation.
|
||||
attr_reader :proration_behavior
|
||||
# Attribute for field schedule_at_period_end
|
||||
attr_reader :schedule_at_period_end
|
||||
end
|
||||
# Attribute for field customer_update
|
||||
attr_reader :customer_update
|
||||
# Attribute for field invoice_history
|
||||
attr_reader :invoice_history
|
||||
# Attribute for field payment_method_update
|
||||
attr_reader :payment_method_update
|
||||
# Attribute for field subscription_cancel
|
||||
attr_reader :subscription_cancel
|
||||
# Attribute for field subscription_update
|
||||
attr_reader :subscription_update
|
||||
end
|
||||
|
||||
class LoginPage < Stripe::StripeObject
|
||||
# If `true`, a shareable `url` will be generated that will take your customers to a hosted login page for the customer portal.
|
||||
#
|
||||
# If `false`, the previously generated `url`, if any, will be deactivated.
|
||||
attr_reader :enabled
|
||||
# A shareable URL to the hosted portal login page. Your customers will be able to log in with their [email](https://stripe.com/docs/api/customers/object#customer_object-email) and receive a link to their customer portal.
|
||||
attr_reader :url
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# Only return configurations that are active or inactive (e.g., pass `true` to only list active configurations).
|
||||
attr_accessor :active
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Only return the default or non-default configurations (e.g., pass `true` to only list the default configuration).
|
||||
attr_accessor :is_default
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(
|
||||
active: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
is_default: nil,
|
||||
limit: nil,
|
||||
starting_after: nil
|
||||
)
|
||||
@active = active
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@is_default = is_default
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class BusinessProfile < Stripe::RequestParams
|
||||
# The messaging shown to customers in the portal.
|
||||
attr_accessor :headline
|
||||
# A link to the business’s publicly available privacy policy.
|
||||
attr_accessor :privacy_policy_url
|
||||
# A link to the business’s publicly available terms of service.
|
||||
attr_accessor :terms_of_service_url
|
||||
|
||||
def initialize(headline: nil, privacy_policy_url: nil, terms_of_service_url: nil)
|
||||
@headline = headline
|
||||
@privacy_policy_url = privacy_policy_url
|
||||
@terms_of_service_url = terms_of_service_url
|
||||
end
|
||||
end
|
||||
|
||||
class Features < Stripe::RequestParams
|
||||
class CustomerUpdate < Stripe::RequestParams
|
||||
# The types of customer updates that are supported. When empty, customers are not updateable.
|
||||
attr_accessor :allowed_updates
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
|
||||
def initialize(allowed_updates: nil, enabled: nil)
|
||||
@allowed_updates = allowed_updates
|
||||
@enabled = enabled
|
||||
end
|
||||
end
|
||||
|
||||
class InvoiceHistory < Stripe::RequestParams
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
|
||||
def initialize(enabled: nil)
|
||||
@enabled = enabled
|
||||
end
|
||||
end
|
||||
|
||||
class PaymentMethodUpdate < Stripe::RequestParams
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
|
||||
def initialize(enabled: nil)
|
||||
@enabled = enabled
|
||||
end
|
||||
end
|
||||
|
||||
class SubscriptionCancel < Stripe::RequestParams
|
||||
class CancellationReason < Stripe::RequestParams
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
# Which cancellation reasons will be given as options to the customer.
|
||||
attr_accessor :options
|
||||
|
||||
def initialize(enabled: nil, options: nil)
|
||||
@enabled = enabled
|
||||
@options = options
|
||||
end
|
||||
end
|
||||
# Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer
|
||||
attr_accessor :cancellation_reason
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
# Whether to cancel subscriptions immediately or at the end of the billing period.
|
||||
attr_accessor :mode
|
||||
# Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period.
|
||||
attr_accessor :proration_behavior
|
||||
|
||||
def initialize(
|
||||
cancellation_reason: nil,
|
||||
enabled: nil,
|
||||
mode: nil,
|
||||
proration_behavior: nil
|
||||
)
|
||||
@cancellation_reason = cancellation_reason
|
||||
@enabled = enabled
|
||||
@mode = mode
|
||||
@proration_behavior = proration_behavior
|
||||
end
|
||||
end
|
||||
|
||||
class SubscriptionUpdate < Stripe::RequestParams
|
||||
class Product < Stripe::RequestParams
|
||||
# The list of price IDs for the product that a subscription can be updated to.
|
||||
attr_accessor :prices
|
||||
# The product id.
|
||||
attr_accessor :product
|
||||
|
||||
def initialize(prices: nil, product: nil)
|
||||
@prices = prices
|
||||
@product = product
|
||||
end
|
||||
end
|
||||
|
||||
class ScheduleAtPeriodEnd < Stripe::RequestParams
|
||||
class Condition < Stripe::RequestParams
|
||||
# The type of condition.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(type: nil)
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
# List of conditions. When any condition is true, the update will be scheduled at the end of the current period.
|
||||
attr_accessor :conditions
|
||||
|
||||
def initialize(conditions: nil)
|
||||
@conditions = conditions
|
||||
end
|
||||
end
|
||||
# The types of subscription updates that are supported. When empty, subscriptions are not updateable.
|
||||
attr_accessor :default_allowed_updates
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of up to 10 products that support subscription updates.
|
||||
attr_accessor :products
|
||||
# Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`.
|
||||
attr_accessor :proration_behavior
|
||||
# Setting to control when an update should be scheduled at the end of the period instead of applying immediately.
|
||||
attr_accessor :schedule_at_period_end
|
||||
|
||||
def initialize(
|
||||
default_allowed_updates: nil,
|
||||
enabled: nil,
|
||||
products: nil,
|
||||
proration_behavior: nil,
|
||||
schedule_at_period_end: nil
|
||||
)
|
||||
@default_allowed_updates = default_allowed_updates
|
||||
@enabled = enabled
|
||||
@products = products
|
||||
@proration_behavior = proration_behavior
|
||||
@schedule_at_period_end = schedule_at_period_end
|
||||
end
|
||||
end
|
||||
# Information about updating the customer details in the portal.
|
||||
attr_accessor :customer_update
|
||||
# Information about showing the billing history in the portal.
|
||||
attr_accessor :invoice_history
|
||||
# Information about updating payment methods in the portal.
|
||||
attr_accessor :payment_method_update
|
||||
# Information about canceling subscriptions in the portal.
|
||||
attr_accessor :subscription_cancel
|
||||
# Information about updating subscriptions in the portal.
|
||||
attr_accessor :subscription_update
|
||||
|
||||
def initialize(
|
||||
customer_update: nil,
|
||||
invoice_history: nil,
|
||||
payment_method_update: nil,
|
||||
subscription_cancel: nil,
|
||||
subscription_update: nil
|
||||
)
|
||||
@customer_update = customer_update
|
||||
@invoice_history = invoice_history
|
||||
@payment_method_update = payment_method_update
|
||||
@subscription_cancel = subscription_cancel
|
||||
@subscription_update = subscription_update
|
||||
end
|
||||
end
|
||||
|
||||
class LoginPage < Stripe::RequestParams
|
||||
# Set to `true` to generate a shareable URL [`login_page.url`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-login_page-url) that will take your customers to a hosted login page for the customer portal.
|
||||
attr_accessor :enabled
|
||||
|
||||
def initialize(enabled: nil)
|
||||
@enabled = enabled
|
||||
end
|
||||
end
|
||||
# The business information shown to customers in the portal.
|
||||
attr_accessor :business_profile
|
||||
# The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session.
|
||||
attr_accessor :default_return_url
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Information about the features available in the portal.
|
||||
attr_accessor :features
|
||||
# The hosted login page for this configuration. Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share).
|
||||
attr_accessor :login_page
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
|
||||
def initialize(
|
||||
business_profile: nil,
|
||||
default_return_url: nil,
|
||||
expand: nil,
|
||||
features: nil,
|
||||
login_page: nil,
|
||||
metadata: nil
|
||||
)
|
||||
@business_profile = business_profile
|
||||
@default_return_url = default_return_url
|
||||
@expand = expand
|
||||
@features = features
|
||||
@login_page = login_page
|
||||
@metadata = metadata
|
||||
end
|
||||
end
|
||||
|
||||
class UpdateParams < Stripe::RequestParams
|
||||
class BusinessProfile < Stripe::RequestParams
|
||||
# The messaging shown to customers in the portal.
|
||||
attr_accessor :headline
|
||||
# A link to the business’s publicly available privacy policy.
|
||||
attr_accessor :privacy_policy_url
|
||||
# A link to the business’s publicly available terms of service.
|
||||
attr_accessor :terms_of_service_url
|
||||
|
||||
def initialize(headline: nil, privacy_policy_url: nil, terms_of_service_url: nil)
|
||||
@headline = headline
|
||||
@privacy_policy_url = privacy_policy_url
|
||||
@terms_of_service_url = terms_of_service_url
|
||||
end
|
||||
end
|
||||
|
||||
class Features < Stripe::RequestParams
|
||||
class CustomerUpdate < Stripe::RequestParams
|
||||
# The types of customer updates that are supported. When empty, customers are not updateable.
|
||||
attr_accessor :allowed_updates
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
|
||||
def initialize(allowed_updates: nil, enabled: nil)
|
||||
@allowed_updates = allowed_updates
|
||||
@enabled = enabled
|
||||
end
|
||||
end
|
||||
|
||||
class InvoiceHistory < Stripe::RequestParams
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
|
||||
def initialize(enabled: nil)
|
||||
@enabled = enabled
|
||||
end
|
||||
end
|
||||
|
||||
class PaymentMethodUpdate < Stripe::RequestParams
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
|
||||
def initialize(enabled: nil)
|
||||
@enabled = enabled
|
||||
end
|
||||
end
|
||||
|
||||
class SubscriptionCancel < Stripe::RequestParams
|
||||
class CancellationReason < Stripe::RequestParams
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
# Which cancellation reasons will be given as options to the customer.
|
||||
attr_accessor :options
|
||||
|
||||
def initialize(enabled: nil, options: nil)
|
||||
@enabled = enabled
|
||||
@options = options
|
||||
end
|
||||
end
|
||||
# Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer
|
||||
attr_accessor :cancellation_reason
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
# Whether to cancel subscriptions immediately or at the end of the billing period.
|
||||
attr_accessor :mode
|
||||
# Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period.
|
||||
attr_accessor :proration_behavior
|
||||
|
||||
def initialize(
|
||||
cancellation_reason: nil,
|
||||
enabled: nil,
|
||||
mode: nil,
|
||||
proration_behavior: nil
|
||||
)
|
||||
@cancellation_reason = cancellation_reason
|
||||
@enabled = enabled
|
||||
@mode = mode
|
||||
@proration_behavior = proration_behavior
|
||||
end
|
||||
end
|
||||
|
||||
class SubscriptionUpdate < Stripe::RequestParams
|
||||
class Product < Stripe::RequestParams
|
||||
# The list of price IDs for the product that a subscription can be updated to.
|
||||
attr_accessor :prices
|
||||
# The product id.
|
||||
attr_accessor :product
|
||||
|
||||
def initialize(prices: nil, product: nil)
|
||||
@prices = prices
|
||||
@product = product
|
||||
end
|
||||
end
|
||||
|
||||
class ScheduleAtPeriodEnd < Stripe::RequestParams
|
||||
class Condition < Stripe::RequestParams
|
||||
# The type of condition.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(type: nil)
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
# List of conditions. When any condition is true, the update will be scheduled at the end of the current period.
|
||||
attr_accessor :conditions
|
||||
|
||||
def initialize(conditions: nil)
|
||||
@conditions = conditions
|
||||
end
|
||||
end
|
||||
# The types of subscription updates that are supported. When empty, subscriptions are not updateable.
|
||||
attr_accessor :default_allowed_updates
|
||||
# Whether the feature is enabled.
|
||||
attr_accessor :enabled
|
||||
# The list of up to 10 products that support subscription updates.
|
||||
attr_accessor :products
|
||||
# Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`.
|
||||
attr_accessor :proration_behavior
|
||||
# Setting to control when an update should be scheduled at the end of the period instead of applying immediately.
|
||||
attr_accessor :schedule_at_period_end
|
||||
|
||||
def initialize(
|
||||
default_allowed_updates: nil,
|
||||
enabled: nil,
|
||||
products: nil,
|
||||
proration_behavior: nil,
|
||||
schedule_at_period_end: nil
|
||||
)
|
||||
@default_allowed_updates = default_allowed_updates
|
||||
@enabled = enabled
|
||||
@products = products
|
||||
@proration_behavior = proration_behavior
|
||||
@schedule_at_period_end = schedule_at_period_end
|
||||
end
|
||||
end
|
||||
# Information about updating the customer details in the portal.
|
||||
attr_accessor :customer_update
|
||||
# Information about showing the billing history in the portal.
|
||||
attr_accessor :invoice_history
|
||||
# Information about updating payment methods in the portal.
|
||||
attr_accessor :payment_method_update
|
||||
# Information about canceling subscriptions in the portal.
|
||||
attr_accessor :subscription_cancel
|
||||
# Information about updating subscriptions in the portal.
|
||||
attr_accessor :subscription_update
|
||||
|
||||
def initialize(
|
||||
customer_update: nil,
|
||||
invoice_history: nil,
|
||||
payment_method_update: nil,
|
||||
subscription_cancel: nil,
|
||||
subscription_update: nil
|
||||
)
|
||||
@customer_update = customer_update
|
||||
@invoice_history = invoice_history
|
||||
@payment_method_update = payment_method_update
|
||||
@subscription_cancel = subscription_cancel
|
||||
@subscription_update = subscription_update
|
||||
end
|
||||
end
|
||||
|
||||
class LoginPage < Stripe::RequestParams
|
||||
# Set to `true` to generate a shareable URL [`login_page.url`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-login_page-url) that will take your customers to a hosted login page for the customer portal.
|
||||
#
|
||||
# Set to `false` to deactivate the `login_page.url`.
|
||||
attr_accessor :enabled
|
||||
|
||||
def initialize(enabled: nil)
|
||||
@enabled = enabled
|
||||
end
|
||||
end
|
||||
# Whether the configuration is active and can be used to create portal sessions.
|
||||
attr_accessor :active
|
||||
# The business information shown to customers in the portal.
|
||||
attr_accessor :business_profile
|
||||
# The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session.
|
||||
attr_accessor :default_return_url
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Information about the features available in the portal.
|
||||
attr_accessor :features
|
||||
# The hosted login page for this configuration. Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share).
|
||||
attr_accessor :login_page
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
|
||||
def initialize(
|
||||
active: nil,
|
||||
business_profile: nil,
|
||||
default_return_url: nil,
|
||||
expand: nil,
|
||||
features: nil,
|
||||
login_page: nil,
|
||||
metadata: nil
|
||||
)
|
||||
@active = active
|
||||
@business_profile = business_profile
|
||||
@default_return_url = default_return_url
|
||||
@expand = expand
|
||||
@features = features
|
||||
@login_page = login_page
|
||||
@metadata = metadata
|
||||
end
|
||||
end
|
||||
# Whether the configuration is active and can be used to create portal sessions.
|
||||
attr_reader :active
|
||||
# ID of the Connect Application that created the configuration.
|
||||
attr_reader :application
|
||||
# Attribute for field business_profile
|
||||
attr_reader :business_profile
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session.
|
||||
attr_reader :default_return_url
|
||||
# Attribute for field features
|
||||
attr_reader :features
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Whether the configuration is the default. If `true`, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session.
|
||||
attr_reader :is_default
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# Attribute for field login_page
|
||||
attr_reader :login_page
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
attr_reader :metadata
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Time at which the object was last updated. Measured in seconds since the Unix epoch.
|
||||
attr_reader :updated
|
||||
|
||||
# Creates a configuration that describes the functionality and behavior of a PortalSession
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "/v1/billing_portal/configurations",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Returns a list of configurations that describe the functionality of the customer portal.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/billing_portal/configurations",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Updates a configuration that describes the functionality of the customer portal.
|
||||
def self.update(configuration, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/billing_portal/configurations/%<configuration>s", { configuration: CGI.escape(configuration) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
310
lib/stripe/resources/billing_portal/session.rb
Normal file
310
lib/stripe/resources/billing_portal/session.rb
Normal file
@ -0,0 +1,310 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module BillingPortal
|
||||
# The Billing customer portal is a Stripe-hosted UI for subscription and
|
||||
# billing management.
|
||||
#
|
||||
# A portal configuration describes the functionality and features that you
|
||||
# want to provide to your customers through the portal.
|
||||
#
|
||||
# A portal session describes the instantiation of the customer portal for
|
||||
# a particular customer. By visiting the session's URL, the customer
|
||||
# can manage their subscriptions and billing details. For security reasons,
|
||||
# sessions are short-lived and will expire if the customer does not visit the URL.
|
||||
# Create sessions on-demand when customers intend to manage their subscriptions
|
||||
# and billing details.
|
||||
#
|
||||
# Related guide: [Customer management](https://docs.stripe.com/customer-management)
|
||||
class Session < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
|
||||
OBJECT_NAME = "billing_portal.session"
|
||||
def self.object_name
|
||||
"billing_portal.session"
|
||||
end
|
||||
|
||||
class Flow < Stripe::StripeObject
|
||||
class AfterCompletion < Stripe::StripeObject
|
||||
class HostedConfirmation < Stripe::StripeObject
|
||||
# A custom message to display to the customer after the flow is completed.
|
||||
attr_reader :custom_message
|
||||
end
|
||||
|
||||
class Redirect < Stripe::StripeObject
|
||||
# The URL the customer will be redirected to after the flow is completed.
|
||||
attr_reader :return_url
|
||||
end
|
||||
# Configuration when `after_completion.type=hosted_confirmation`.
|
||||
attr_reader :hosted_confirmation
|
||||
# Configuration when `after_completion.type=redirect`.
|
||||
attr_reader :redirect
|
||||
# The specified type of behavior after the flow is completed.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class SubscriptionCancel < Stripe::StripeObject
|
||||
class Retention < Stripe::StripeObject
|
||||
class CouponOffer < Stripe::StripeObject
|
||||
# The ID of the coupon to be offered.
|
||||
attr_reader :coupon
|
||||
end
|
||||
# Configuration when `retention.type=coupon_offer`.
|
||||
attr_reader :coupon_offer
|
||||
# Type of retention strategy that will be used.
|
||||
attr_reader :type
|
||||
end
|
||||
# Specify a retention strategy to be used in the cancellation flow.
|
||||
attr_reader :retention
|
||||
# The ID of the subscription to be canceled.
|
||||
attr_reader :subscription
|
||||
end
|
||||
|
||||
class SubscriptionUpdate < Stripe::StripeObject
|
||||
# The ID of the subscription to be updated.
|
||||
attr_reader :subscription
|
||||
end
|
||||
|
||||
class SubscriptionUpdateConfirm < Stripe::StripeObject
|
||||
class Discount < Stripe::StripeObject
|
||||
# The ID of the coupon to apply to this subscription update.
|
||||
attr_reader :coupon
|
||||
# The ID of a promotion code to apply to this subscription update.
|
||||
attr_reader :promotion_code
|
||||
end
|
||||
|
||||
class Item < Stripe::StripeObject
|
||||
# The ID of the [subscription item](https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id) to be updated.
|
||||
attr_reader :id
|
||||
# The price the customer should subscribe to through this flow. The price must also be included in the configuration's [`features.subscription_update.products`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-products).
|
||||
attr_reader :price
|
||||
# [Quantity](https://stripe.com/docs/subscriptions/quantities) for this item that the customer should subscribe to through this flow.
|
||||
attr_reader :quantity
|
||||
end
|
||||
# The coupon or promotion code to apply to this subscription update. Currently, only up to one may be specified.
|
||||
attr_reader :discounts
|
||||
# The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow. Currently, only up to one may be specified and subscriptions with multiple items are not updatable.
|
||||
attr_reader :items
|
||||
# The ID of the subscription to be updated.
|
||||
attr_reader :subscription
|
||||
end
|
||||
# Attribute for field after_completion
|
||||
attr_reader :after_completion
|
||||
# Configuration when `flow.type=subscription_cancel`.
|
||||
attr_reader :subscription_cancel
|
||||
# Configuration when `flow.type=subscription_update`.
|
||||
attr_reader :subscription_update
|
||||
# Configuration when `flow.type=subscription_update_confirm`.
|
||||
attr_reader :subscription_update_confirm
|
||||
# Type of flow that the customer will go through.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class FlowData < Stripe::RequestParams
|
||||
class AfterCompletion < Stripe::RequestParams
|
||||
class HostedConfirmation < Stripe::RequestParams
|
||||
# A custom message to display to the customer after the flow is completed.
|
||||
attr_accessor :custom_message
|
||||
|
||||
def initialize(custom_message: nil)
|
||||
@custom_message = custom_message
|
||||
end
|
||||
end
|
||||
|
||||
class Redirect < Stripe::RequestParams
|
||||
# The URL the customer will be redirected to after the flow is completed.
|
||||
attr_accessor :return_url
|
||||
|
||||
def initialize(return_url: nil)
|
||||
@return_url = return_url
|
||||
end
|
||||
end
|
||||
# Configuration when `after_completion.type=hosted_confirmation`.
|
||||
attr_accessor :hosted_confirmation
|
||||
# Configuration when `after_completion.type=redirect`.
|
||||
attr_accessor :redirect
|
||||
# The specified behavior after the flow is completed.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(hosted_confirmation: nil, redirect: nil, type: nil)
|
||||
@hosted_confirmation = hosted_confirmation
|
||||
@redirect = redirect
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
|
||||
class SubscriptionCancel < Stripe::RequestParams
|
||||
class Retention < Stripe::RequestParams
|
||||
class CouponOffer < Stripe::RequestParams
|
||||
# The ID of the coupon to be offered.
|
||||
attr_accessor :coupon
|
||||
|
||||
def initialize(coupon: nil)
|
||||
@coupon = coupon
|
||||
end
|
||||
end
|
||||
# Configuration when `retention.type=coupon_offer`.
|
||||
attr_accessor :coupon_offer
|
||||
# Type of retention strategy to use with the customer.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(coupon_offer: nil, type: nil)
|
||||
@coupon_offer = coupon_offer
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
# Specify a retention strategy to be used in the cancellation flow.
|
||||
attr_accessor :retention
|
||||
# The ID of the subscription to be canceled.
|
||||
attr_accessor :subscription
|
||||
|
||||
def initialize(retention: nil, subscription: nil)
|
||||
@retention = retention
|
||||
@subscription = subscription
|
||||
end
|
||||
end
|
||||
|
||||
class SubscriptionUpdate < Stripe::RequestParams
|
||||
# The ID of the subscription to be updated.
|
||||
attr_accessor :subscription
|
||||
|
||||
def initialize(subscription: nil)
|
||||
@subscription = subscription
|
||||
end
|
||||
end
|
||||
|
||||
class SubscriptionUpdateConfirm < Stripe::RequestParams
|
||||
class Discount < Stripe::RequestParams
|
||||
# The ID of the coupon to apply to this subscription update.
|
||||
attr_accessor :coupon
|
||||
# The ID of a promotion code to apply to this subscription update.
|
||||
attr_accessor :promotion_code
|
||||
|
||||
def initialize(coupon: nil, promotion_code: nil)
|
||||
@coupon = coupon
|
||||
@promotion_code = promotion_code
|
||||
end
|
||||
end
|
||||
|
||||
class Item < Stripe::RequestParams
|
||||
# The ID of the [subscription item](https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id) to be updated.
|
||||
attr_accessor :id
|
||||
# The price the customer should subscribe to through this flow. The price must also be included in the configuration's [`features.subscription_update.products`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-products).
|
||||
attr_accessor :price
|
||||
# [Quantity](https://stripe.com/docs/subscriptions/quantities) for this item that the customer should subscribe to through this flow.
|
||||
attr_accessor :quantity
|
||||
|
||||
def initialize(id: nil, price: nil, quantity: nil)
|
||||
@id = id
|
||||
@price = price
|
||||
@quantity = quantity
|
||||
end
|
||||
end
|
||||
# The coupon or promotion code to apply to this subscription update. Currently, only up to one may be specified.
|
||||
attr_accessor :discounts
|
||||
# The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow. Currently, only up to one may be specified and subscriptions with multiple items are not updatable.
|
||||
attr_accessor :items
|
||||
# The ID of the subscription to be updated.
|
||||
attr_accessor :subscription
|
||||
|
||||
def initialize(discounts: nil, items: nil, subscription: nil)
|
||||
@discounts = discounts
|
||||
@items = items
|
||||
@subscription = subscription
|
||||
end
|
||||
end
|
||||
# Behavior after the flow is completed.
|
||||
attr_accessor :after_completion
|
||||
# Configuration when `flow_data.type=subscription_cancel`.
|
||||
attr_accessor :subscription_cancel
|
||||
# Configuration when `flow_data.type=subscription_update`.
|
||||
attr_accessor :subscription_update
|
||||
# Configuration when `flow_data.type=subscription_update_confirm`.
|
||||
attr_accessor :subscription_update_confirm
|
||||
# Type of flow that the customer will go through.
|
||||
attr_accessor :type
|
||||
|
||||
def initialize(
|
||||
after_completion: nil,
|
||||
subscription_cancel: nil,
|
||||
subscription_update: nil,
|
||||
subscription_update_confirm: nil,
|
||||
type: nil
|
||||
)
|
||||
@after_completion = after_completion
|
||||
@subscription_cancel = subscription_cancel
|
||||
@subscription_update = subscription_update
|
||||
@subscription_update_confirm = subscription_update_confirm
|
||||
@type = type
|
||||
end
|
||||
end
|
||||
# The ID of an existing [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration.
|
||||
attr_accessor :configuration
|
||||
# The ID of an existing customer.
|
||||
attr_accessor :customer
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
|
||||
attr_accessor :flow_data
|
||||
# The IETF language tag of the locale customer portal is displayed in. If blank or auto, the customer’s `preferred_locales` or browser’s locale is used.
|
||||
attr_accessor :locale
|
||||
# The `on_behalf_of` account to use for this session. When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal. For more information, see the [docs](https://stripe.com/docs/connect/separate-charges-and-transfers#settlement-merchant). Use the [Accounts API](https://stripe.com/docs/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account's branding settings, which the portal displays.
|
||||
attr_accessor :on_behalf_of
|
||||
# The default URL to redirect customers to when they click on the portal's link to return to your website.
|
||||
attr_accessor :return_url
|
||||
|
||||
def initialize(
|
||||
configuration: nil,
|
||||
customer: nil,
|
||||
expand: nil,
|
||||
flow_data: nil,
|
||||
locale: nil,
|
||||
on_behalf_of: nil,
|
||||
return_url: nil
|
||||
)
|
||||
@configuration = configuration
|
||||
@customer = customer
|
||||
@expand = expand
|
||||
@flow_data = flow_data
|
||||
@locale = locale
|
||||
@on_behalf_of = on_behalf_of
|
||||
@return_url = return_url
|
||||
end
|
||||
end
|
||||
# The configuration used by this session, describing the features available.
|
||||
attr_reader :configuration
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# The ID of the customer for this session.
|
||||
attr_reader :customer
|
||||
# Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
|
||||
attr_reader :flow
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customer’s `preferred_locales` or browser’s locale is used.
|
||||
attr_reader :locale
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal. For more information, see the [docs](https://stripe.com/docs/connect/separate-charges-and-transfers#settlement-merchant). Use the [Accounts API](https://stripe.com/docs/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account's branding settings, which the portal displays.
|
||||
attr_reader :on_behalf_of
|
||||
# The URL to redirect customers to when they click on the portal's link to return to your website.
|
||||
attr_reader :return_url
|
||||
# The short-lived URL of the session that gives customers access to the customer portal.
|
||||
attr_reader :url
|
||||
|
||||
# Creates a session of the customer portal.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: "/v1/billing_portal/sessions",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
123
lib/stripe/resources/capability.rb
Normal file
123
lib/stripe/resources/capability.rb
Normal file
@ -0,0 +1,123 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# This is an object representing a capability for a Stripe account.
|
||||
#
|
||||
# Related guide: [Account capabilities](https://stripe.com/docs/connect/account-capabilities)
|
||||
class Capability < APIResource
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "capability"
|
||||
def self.object_name
|
||||
"capability"
|
||||
end
|
||||
|
||||
class FutureRequirements < Stripe::StripeObject
|
||||
class Alternative < Stripe::StripeObject
|
||||
# Fields that can be provided to satisfy all fields in `original_fields_due`.
|
||||
attr_reader :alternative_fields_due
|
||||
# Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`.
|
||||
attr_reader :original_fields_due
|
||||
end
|
||||
|
||||
class Error < Stripe::StripeObject
|
||||
# The code for the type of error.
|
||||
attr_reader :code
|
||||
# An informative message that indicates the error type and provides additional details about the error.
|
||||
attr_reader :reason
|
||||
# The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
|
||||
attr_reader :requirement
|
||||
end
|
||||
# Fields that are due and can be satisfied by providing the corresponding alternative fields instead.
|
||||
attr_reader :alternatives
|
||||
# Date on which `future_requirements` becomes the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on the capability's enablement state prior to transitioning.
|
||||
attr_reader :current_deadline
|
||||
# Fields that need to be collected to keep the capability enabled. If not collected by `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash.
|
||||
attr_reader :currently_due
|
||||
# This is typed as an enum for consistency with `requirements.disabled_reason`, but it safe to assume `future_requirements.disabled_reason` is null because fields in `future_requirements` will never disable the account.
|
||||
attr_reader :disabled_reason
|
||||
# Fields that are `currently_due` and need to be collected again because validation or verification failed.
|
||||
attr_reader :errors
|
||||
# Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well.
|
||||
attr_reader :eventually_due
|
||||
# Fields that weren't collected by `requirements.current_deadline`. These fields need to be collected to enable the capability on the account. New fields will never appear here; `future_requirements.past_due` will always be a subset of `requirements.past_due`.
|
||||
attr_reader :past_due
|
||||
# Fields that might become required depending on the results of verification or review. It's an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due` or `currently_due`. Fields might appear in `eventually_due` or `currently_due` and in `pending_verification` if verification fails but another verification is still pending.
|
||||
attr_reader :pending_verification
|
||||
end
|
||||
|
||||
class Requirements < Stripe::StripeObject
|
||||
class Alternative < Stripe::StripeObject
|
||||
# Fields that can be provided to satisfy all fields in `original_fields_due`.
|
||||
attr_reader :alternative_fields_due
|
||||
# Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`.
|
||||
attr_reader :original_fields_due
|
||||
end
|
||||
|
||||
class Error < Stripe::StripeObject
|
||||
# The code for the type of error.
|
||||
attr_reader :code
|
||||
# An informative message that indicates the error type and provides additional details about the error.
|
||||
attr_reader :reason
|
||||
# The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
|
||||
attr_reader :requirement
|
||||
end
|
||||
# Fields that are due and can be satisfied by providing the corresponding alternative fields instead.
|
||||
attr_reader :alternatives
|
||||
# The date by which all required account information must be both submitted and verified. This includes fields listed in `currently_due` as well as those in `pending_verification`. If any required information is missing or unverified by this date, the account may be disabled. Note that `current_deadline` may change if additional `currently_due` requirements are requested.
|
||||
attr_reader :current_deadline
|
||||
# Fields that need to be collected to keep the capability enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled.
|
||||
attr_reader :currently_due
|
||||
# Description of why the capability is disabled. [Learn more about handling verification issues](https://stripe.com/docs/connect/handling-api-verification).
|
||||
attr_reader :disabled_reason
|
||||
# Fields that are `currently_due` and need to be collected again because validation or verification failed.
|
||||
attr_reader :errors
|
||||
# Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set.
|
||||
attr_reader :eventually_due
|
||||
# Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the capability on the account.
|
||||
attr_reader :past_due
|
||||
# Fields that might become required depending on the results of verification or review. It's an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. Fields might appear in `eventually_due`, `currently_due`, or `past_due` and in `pending_verification` if verification fails but another verification is still pending.
|
||||
attr_reader :pending_verification
|
||||
end
|
||||
# The account for which the capability enables functionality.
|
||||
attr_reader :account
|
||||
# Attribute for field future_requirements
|
||||
attr_reader :future_requirements
|
||||
# The identifier for the capability.
|
||||
attr_reader :id
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Whether the capability has been requested.
|
||||
attr_reader :requested
|
||||
# Time at which the capability was requested. Measured in seconds since the Unix epoch.
|
||||
attr_reader :requested_at
|
||||
# Attribute for field requirements
|
||||
attr_reader :requirements
|
||||
# The status of the capability.
|
||||
attr_reader :status
|
||||
|
||||
def resource_url
|
||||
if !respond_to?(:account) || account.nil?
|
||||
raise NotImplementedError,
|
||||
"Capabilities cannot be accessed without an account ID."
|
||||
end
|
||||
"#{Account.resource_url}/#{CGI.escape(account)}/capabilities" \
|
||||
"/#{CGI.escape(id)}"
|
||||
end
|
||||
|
||||
def self.retrieve(_id, _opts = {})
|
||||
raise NotImplementedError,
|
||||
"Capabilities cannot be retrieve without an account ID. " \
|
||||
"Retrieve a capability using Account.retrieve_capability(" \
|
||||
"'account_id', 'capability_id')`"
|
||||
end
|
||||
|
||||
def self.update(_id, _params = nil, _opts = nil)
|
||||
raise NotImplementedError,
|
||||
"Capabilities cannot be updated without an account ID. Update a " \
|
||||
"capability using `Account.update_capability('account_id', " \
|
||||
"'capability_id', update_params)`"
|
||||
end
|
||||
end
|
||||
end
|
146
lib/stripe/resources/card.rb
Normal file
146
lib/stripe/resources/card.rb
Normal file
@ -0,0 +1,146 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# You can store multiple cards on a customer in order to charge the customer
|
||||
# later. You can also store multiple debit cards on a recipient in order to
|
||||
# transfer to those cards later.
|
||||
#
|
||||
# Related guide: [Card payments with Sources](https://stripe.com/docs/sources/cards)
|
||||
class Card < APIResource
|
||||
include Stripe::APIOperations::Delete
|
||||
extend Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "card"
|
||||
def self.object_name
|
||||
"card"
|
||||
end
|
||||
|
||||
class Networks < Stripe::StripeObject
|
||||
# The preferred network for co-branded cards. Can be `cartes_bancaires`, `mastercard`, `visa` or `invalid_preference` if requested network is not valid for the card.
|
||||
attr_reader :preferred
|
||||
end
|
||||
# Attribute for field account
|
||||
attr_reader :account
|
||||
# City/District/Suburb/Town/Village.
|
||||
attr_reader :address_city
|
||||
# Billing address country, if provided when creating card.
|
||||
attr_reader :address_country
|
||||
# Address line 1 (Street address/PO Box/Company name).
|
||||
attr_reader :address_line1
|
||||
# If `address_line1` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
|
||||
attr_reader :address_line1_check
|
||||
# Address line 2 (Apartment/Suite/Unit/Building).
|
||||
attr_reader :address_line2
|
||||
# State/County/Province/Region.
|
||||
attr_reader :address_state
|
||||
# ZIP or postal code.
|
||||
attr_reader :address_zip
|
||||
# If `address_zip` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
|
||||
attr_reader :address_zip_check
|
||||
# This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”.
|
||||
attr_reader :allow_redisplay
|
||||
# A set of available payout methods for this card. Only values from this set should be passed as the `method` when creating a payout.
|
||||
attr_reader :available_payout_methods
|
||||
# Card brand. Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `Girocard`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
|
||||
attr_reader :brand
|
||||
# Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.
|
||||
attr_reader :country
|
||||
# Three-letter [ISO code for currency](https://www.iso.org/iso-4217-currency-codes.html) in lowercase. Must be a [supported currency](https://docs.stripe.com/currencies). Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. This property is only available when returned as an [External Account](/api/external_account_cards/object) where [controller.is_controller](/api/accounts/object#account_object-controller-is_controller) is `true`.
|
||||
attr_reader :currency
|
||||
# The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
|
||||
attr_reader :customer
|
||||
# If a CVC was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see [Check if a card is valid without a charge](https://support.stripe.com/questions/check-if-a-card-is-valid-without-a-charge).
|
||||
attr_reader :cvc_check
|
||||
# Whether this card is the default external account for its currency. This property is only available for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts.
|
||||
attr_reader :default_for_currency
|
||||
# A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.)
|
||||
attr_reader :description
|
||||
# (For tokenized numbers only.) The last four digits of the device account number.
|
||||
attr_reader :dynamic_last4
|
||||
# Two-digit number representing the card's expiration month.
|
||||
attr_reader :exp_month
|
||||
# Four-digit number representing the card's expiration year.
|
||||
attr_reader :exp_year
|
||||
# Uniquely identifies this particular card number. You can use this attribute to check whether two customers who’ve signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
|
||||
#
|
||||
# *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.*
|
||||
attr_reader :fingerprint
|
||||
# Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`.
|
||||
attr_reader :funding
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Issuer identification number of the card. (For internal use only and not typically available in standard API requests.)
|
||||
attr_reader :iin
|
||||
# The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.)
|
||||
attr_reader :issuer
|
||||
# The last four digits of the card.
|
||||
attr_reader :last4
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
attr_reader :metadata
|
||||
# Cardholder name.
|
||||
attr_reader :name
|
||||
# Attribute for field networks
|
||||
attr_reader :networks
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Status of a card based on the card issuer.
|
||||
attr_reader :regulated_status
|
||||
# For external accounts that are cards, possible values are `new` and `errored`. If a payout fails, the status is set to `errored` and [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) are stopped until account details are updated.
|
||||
attr_reader :status
|
||||
# If the card number is tokenized, this is the method that was used. Can be `android_pay` (includes Google Pay), `apple_pay`, `masterpass`, `visa_checkout`, or null.
|
||||
attr_reader :tokenization_method
|
||||
# Always true for a deleted object
|
||||
attr_reader :deleted
|
||||
|
||||
def resource_url
|
||||
if respond_to?(:customer) && !customer.nil? && !customer.empty?
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
||||
elsif respond_to?(:account) && !account.nil? && !account.empty?
|
||||
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.update(_id, _params = nil, _opts = nil)
|
||||
raise NotImplementedError,
|
||||
"Card cannot be updated without a customer ID or an account ID. " \
|
||||
"Update a card using `Customer.update_source('customer_id', " \
|
||||
"'card_id', update_params)` or `Account.update_external_account(" \
|
||||
"'account_id', 'card_id', update_params)`"
|
||||
end
|
||||
|
||||
def self.retrieve(_id, _opts = nil)
|
||||
raise NotImplementedError,
|
||||
"Card cannot be retrieved without a customer ID or an account " \
|
||||
"ID. Retrieve a card using `Customer.retrieve_source(" \
|
||||
"'customer_id', 'card_id')` or " \
|
||||
"`Account.retrieve_external_account('account_id', 'card_id')`"
|
||||
end
|
||||
|
||||
def self.delete(id, params = {}, opts = {})
|
||||
raise NotImplementedError,
|
||||
"Card cannot be deleted without a customer ID or an account " \
|
||||
"ID. Delete a card using `Customer.delete_source(" \
|
||||
"'customer_id', 'card_id')` or " \
|
||||
"`Account.delete_external_account('account_id', 'card_id')`"
|
||||
end
|
||||
|
||||
def delete(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: resource_url.to_s,
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
def self.list(params = {}, opts = {})
|
||||
raise NotImplementedError,
|
||||
"Cards cannot be listed without a customer ID or an account " \
|
||||
"ID. List cards using `Customer.list_sources(" \
|
||||
"'customer_id')` or " \
|
||||
"`Account.list_external_accounts('account_id')`"
|
||||
end
|
||||
end
|
||||
end
|
43
lib/stripe/resources/cash_balance.rb
Normal file
43
lib/stripe/resources/cash_balance.rb
Normal file
@ -0,0 +1,43 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# A customer's `Cash balance` represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account.
|
||||
class CashBalance < APIResource
|
||||
OBJECT_NAME = "cash_balance"
|
||||
def self.object_name
|
||||
"cash_balance"
|
||||
end
|
||||
|
||||
class Settings < Stripe::StripeObject
|
||||
# The configuration for how funds that land in the customer cash balance are reconciled.
|
||||
attr_reader :reconciliation_mode
|
||||
# A flag to indicate if reconciliation mode returned is the user's default or is specific to this customer cash balance
|
||||
attr_reader :using_merchant_default
|
||||
end
|
||||
# A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
|
||||
attr_reader :available
|
||||
# The ID of the customer whose cash balance this object represents.
|
||||
attr_reader :customer
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Attribute for field settings
|
||||
attr_reader :settings
|
||||
|
||||
def resource_url
|
||||
if !respond_to?(:customer) || customer.nil?
|
||||
raise NotImplementedError,
|
||||
"Customer Cash Balance cannot be accessed without a customer ID."
|
||||
end
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/cash_balance"
|
||||
end
|
||||
|
||||
def self.retrieve(_id, _opts = {})
|
||||
raise NotImplementedError,
|
||||
"Customer Cash Balance cannot be retrieved without a customer ID. " \
|
||||
"Retrieve a Customer Cash Balance using `Customer.retrieve_cash_balance('cus_123')`"
|
||||
end
|
||||
end
|
||||
end
|
1703
lib/stripe/resources/charge.rb
Normal file
1703
lib/stripe/resources/charge.rb
Normal file
File diff suppressed because it is too large
Load Diff
3680
lib/stripe/resources/checkout/session.rb
Normal file
3680
lib/stripe/resources/checkout/session.rb
Normal file
File diff suppressed because it is too large
Load Diff
234
lib/stripe/resources/climate/order.rb
Normal file
234
lib/stripe/resources/climate/order.rb
Normal file
@ -0,0 +1,234 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Climate
|
||||
# Orders represent your intent to purchase a particular Climate product. When you create an order, the
|
||||
# payment is deducted from your merchant balance.
|
||||
class Order < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
extend Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "climate.order"
|
||||
def self.object_name
|
||||
"climate.order"
|
||||
end
|
||||
|
||||
class Beneficiary < Stripe::StripeObject
|
||||
# Publicly displayable name for the end beneficiary of carbon removal.
|
||||
attr_reader :public_name
|
||||
end
|
||||
|
||||
class DeliveryDetail < Stripe::StripeObject
|
||||
class Location < Stripe::StripeObject
|
||||
# The city where the supplier is located.
|
||||
attr_reader :city
|
||||
# Two-letter ISO code representing the country where the supplier is located.
|
||||
attr_reader :country
|
||||
# The geographic latitude where the supplier is located.
|
||||
attr_reader :latitude
|
||||
# The geographic longitude where the supplier is located.
|
||||
attr_reader :longitude
|
||||
# The state/county/province/region where the supplier is located.
|
||||
attr_reader :region
|
||||
end
|
||||
# Time at which the delivery occurred. Measured in seconds since the Unix epoch.
|
||||
attr_reader :delivered_at
|
||||
# Specific location of this delivery.
|
||||
attr_reader :location
|
||||
# Quantity of carbon removal supplied by this delivery.
|
||||
attr_reader :metric_tons
|
||||
# Once retired, a URL to the registry entry for the tons from this delivery.
|
||||
attr_reader :registry_url
|
||||
# A supplier of carbon removal.
|
||||
attr_reader :supplier
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(ending_before: nil, expand: nil, limit: nil, starting_after: nil)
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class Beneficiary < Stripe::RequestParams
|
||||
# Publicly displayable name for the end beneficiary of carbon removal.
|
||||
attr_accessor :public_name
|
||||
|
||||
def initialize(public_name: nil)
|
||||
@public_name = public_name
|
||||
end
|
||||
end
|
||||
# Requested amount of carbon removal units. Either this or `metric_tons` must be specified.
|
||||
attr_accessor :amount
|
||||
# Publicly sharable reference for the end beneficiary of carbon removal. Assumed to be the Stripe account if not set.
|
||||
attr_accessor :beneficiary
|
||||
# Request currency for the order as a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a supported [settlement currency for your account](https://stripe.com/docs/currencies). If omitted, the account's default currency will be used.
|
||||
attr_accessor :currency
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
# Requested number of tons for the order. Either this or `amount` must be specified.
|
||||
attr_accessor :metric_tons
|
||||
# Unique identifier of the Climate product.
|
||||
attr_accessor :product
|
||||
|
||||
def initialize(
|
||||
amount: nil,
|
||||
beneficiary: nil,
|
||||
currency: nil,
|
||||
expand: nil,
|
||||
metadata: nil,
|
||||
metric_tons: nil,
|
||||
product: nil
|
||||
)
|
||||
@amount = amount
|
||||
@beneficiary = beneficiary
|
||||
@currency = currency
|
||||
@expand = expand
|
||||
@metadata = metadata
|
||||
@metric_tons = metric_tons
|
||||
@product = product
|
||||
end
|
||||
end
|
||||
|
||||
class UpdateParams < Stripe::RequestParams
|
||||
class Beneficiary < Stripe::RequestParams
|
||||
# Publicly displayable name for the end beneficiary of carbon removal.
|
||||
attr_accessor :public_name
|
||||
|
||||
def initialize(public_name: nil)
|
||||
@public_name = public_name
|
||||
end
|
||||
end
|
||||
# Publicly sharable reference for the end beneficiary of carbon removal. Assumed to be the Stripe account if not set.
|
||||
attr_accessor :beneficiary
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
|
||||
def initialize(beneficiary: nil, expand: nil, metadata: nil)
|
||||
@beneficiary = beneficiary
|
||||
@expand = expand
|
||||
@metadata = metadata
|
||||
end
|
||||
end
|
||||
|
||||
class CancelParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
# Total amount of [Frontier](https://frontierclimate.com/)'s service fees in the currency's smallest unit.
|
||||
attr_reader :amount_fees
|
||||
# Total amount of the carbon removal in the currency's smallest unit.
|
||||
attr_reader :amount_subtotal
|
||||
# Total amount of the order including fees in the currency's smallest unit.
|
||||
attr_reader :amount_total
|
||||
# Attribute for field beneficiary
|
||||
attr_reader :beneficiary
|
||||
# Time at which the order was canceled. Measured in seconds since the Unix epoch.
|
||||
attr_reader :canceled_at
|
||||
# Reason for the cancellation of this order.
|
||||
attr_reader :cancellation_reason
|
||||
# For delivered orders, a URL to a delivery certificate for the order.
|
||||
attr_reader :certificate
|
||||
# Time at which the order was confirmed. Measured in seconds since the Unix epoch.
|
||||
attr_reader :confirmed_at
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order.
|
||||
attr_reader :currency
|
||||
# Time at which the order's expected_delivery_year was delayed. Measured in seconds since the Unix epoch.
|
||||
attr_reader :delayed_at
|
||||
# Time at which the order was delivered. Measured in seconds since the Unix epoch.
|
||||
attr_reader :delivered_at
|
||||
# Details about the delivery of carbon removal for this order.
|
||||
attr_reader :delivery_details
|
||||
# The year this order is expected to be delivered.
|
||||
attr_reader :expected_delivery_year
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
attr_reader :metadata
|
||||
# Quantity of carbon removal that is included in this order.
|
||||
attr_reader :metric_tons
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Unique ID for the Climate `Product` this order is purchasing.
|
||||
attr_reader :product
|
||||
# Time at which the order's product was substituted for a different product. Measured in seconds since the Unix epoch.
|
||||
attr_reader :product_substituted_at
|
||||
# The current status of this order.
|
||||
attr_reader :status
|
||||
|
||||
# Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
|
||||
# reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
|
||||
# might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
|
||||
# provides 90 days advance notice and refunds the amount_total.
|
||||
def cancel(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/climate/orders/%<order>s/cancel", { order: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
|
||||
# reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
|
||||
# might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
|
||||
# provides 90 days advance notice and refunds the amount_total.
|
||||
def self.cancel(order, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/climate/orders/%<order>s/cancel", { order: CGI.escape(order) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Creates a Climate order object for a given Climate product. The order will be processed immediately
|
||||
# after creation and payment will be deducted your Stripe balance.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(method: :post, path: "/v1/climate/orders", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# Lists all Climate order objects. The orders are returned sorted by creation date, with the
|
||||
# most recently created orders appearing first.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/climate/orders", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# Updates the specified order by setting the values of the parameters passed.
|
||||
def self.update(order, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/climate/orders/%<order>s", { order: CGI.escape(order) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
74
lib/stripe/resources/climate/product.rb
Normal file
74
lib/stripe/resources/climate/product.rb
Normal file
@ -0,0 +1,74 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Climate
|
||||
# A Climate product represents a type of carbon removal unit available for reservation.
|
||||
# You can retrieve it to see the current price and availability.
|
||||
class Product < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
OBJECT_NAME = "climate.product"
|
||||
def self.object_name
|
||||
"climate.product"
|
||||
end
|
||||
|
||||
class CurrentPricesPerMetricTon < Stripe::StripeObject
|
||||
# Fees for one metric ton of carbon removal in the currency's smallest unit.
|
||||
attr_reader :amount_fees
|
||||
# Subtotal for one metric ton of carbon removal (excluding fees) in the currency's smallest unit.
|
||||
attr_reader :amount_subtotal
|
||||
# Total for one metric ton of carbon removal (including fees) in the currency's smallest unit.
|
||||
attr_reader :amount_total
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(ending_before: nil, expand: nil, limit: nil, starting_after: nil)
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Current prices for a metric ton of carbon removal in a currency's smallest unit.
|
||||
attr_reader :current_prices_per_metric_ton
|
||||
# The year in which the carbon removal is expected to be delivered.
|
||||
attr_reader :delivery_year
|
||||
# Unique identifier for the object. For convenience, Climate product IDs are human-readable strings
|
||||
# that start with `climsku_`. See [carbon removal inventory](https://stripe.com/docs/climate/orders/carbon-removal-inventory)
|
||||
# for a list of available carbon removal products.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# The quantity of metric tons available for reservation.
|
||||
attr_reader :metric_tons_available
|
||||
# The Climate product's name.
|
||||
attr_reader :name
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The carbon removal suppliers that fulfill orders for this Climate product.
|
||||
attr_reader :suppliers
|
||||
|
||||
# Lists all available Climate product objects.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/climate/products",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
71
lib/stripe/resources/climate/supplier.rb
Normal file
71
lib/stripe/resources/climate/supplier.rb
Normal file
@ -0,0 +1,71 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
module Climate
|
||||
# A supplier of carbon removal.
|
||||
class Supplier < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
OBJECT_NAME = "climate.supplier"
|
||||
def self.object_name
|
||||
"climate.supplier"
|
||||
end
|
||||
|
||||
class Location < Stripe::StripeObject
|
||||
# The city where the supplier is located.
|
||||
attr_reader :city
|
||||
# Two-letter ISO code representing the country where the supplier is located.
|
||||
attr_reader :country
|
||||
# The geographic latitude where the supplier is located.
|
||||
attr_reader :latitude
|
||||
# The geographic longitude where the supplier is located.
|
||||
attr_reader :longitude
|
||||
# The state/county/province/region where the supplier is located.
|
||||
attr_reader :region
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(ending_before: nil, expand: nil, limit: nil, starting_after: nil)
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Link to a webpage to learn more about the supplier.
|
||||
attr_reader :info_url
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# The locations in which this supplier operates.
|
||||
attr_reader :locations
|
||||
# Name of this carbon removal supplier.
|
||||
attr_reader :name
|
||||
# String representing the object’s type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# The scientific pathway used for carbon removal.
|
||||
attr_reader :removal_pathway
|
||||
|
||||
# Lists all available Climate supplier objects.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/climate/suppliers",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
1498
lib/stripe/resources/confirmation_token.rb
Normal file
1498
lib/stripe/resources/confirmation_token.rb
Normal file
File diff suppressed because it is too large
Load Diff
24
lib/stripe/resources/connect_collection_transfer.rb
Normal file
24
lib/stripe/resources/connect_collection_transfer.rb
Normal file
@ -0,0 +1,24 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
class ConnectCollectionTransfer < APIResource
|
||||
OBJECT_NAME = "connect_collection_transfer"
|
||||
def self.object_name
|
||||
"connect_collection_transfer"
|
||||
end
|
||||
|
||||
# Amount transferred, in cents (or local equivalent).
|
||||
attr_reader :amount
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# ID of the account that funds are being collected for.
|
||||
attr_reader :destination
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
end
|
||||
end
|
78
lib/stripe/resources/country_spec.rb
Normal file
78
lib/stripe/resources/country_spec.rb
Normal file
@ -0,0 +1,78 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Stripe needs to collect certain pieces of information about each account
|
||||
# created. These requirements can differ depending on the account's country. The
|
||||
# Country Specs API makes these rules available to your integration.
|
||||
#
|
||||
# You can also view the information from this API call as [an online
|
||||
# guide](https://docs.stripe.com/docs/connect/required-verification-information).
|
||||
class CountrySpec < APIResource
|
||||
extend Stripe::APIOperations::List
|
||||
|
||||
OBJECT_NAME = "country_spec"
|
||||
def self.object_name
|
||||
"country_spec"
|
||||
end
|
||||
|
||||
class VerificationFields < Stripe::StripeObject
|
||||
class Company < Stripe::StripeObject
|
||||
# Additional fields which are only required for some users.
|
||||
attr_reader :additional
|
||||
# Fields which every account must eventually provide.
|
||||
attr_reader :minimum
|
||||
end
|
||||
|
||||
class Individual < Stripe::StripeObject
|
||||
# Additional fields which are only required for some users.
|
||||
attr_reader :additional
|
||||
# Fields which every account must eventually provide.
|
||||
attr_reader :minimum
|
||||
end
|
||||
# Attribute for field company
|
||||
attr_reader :company
|
||||
# Attribute for field individual
|
||||
attr_reader :individual
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(ending_before: nil, expand: nil, limit: nil, starting_after: nil)
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
# The default currency for this country. This applies to both payment methods and bank accounts.
|
||||
attr_reader :default_currency
|
||||
# Unique identifier for the object. Represented as the ISO country code for this country.
|
||||
attr_reader :id
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Currencies that can be accepted in the specific country (for transfers).
|
||||
attr_reader :supported_bank_account_currencies
|
||||
# Currencies that can be accepted in the specified country (for payments).
|
||||
attr_reader :supported_payment_currencies
|
||||
# Payment methods available in the specified country. You may need to enable some payment methods (e.g., [ACH](https://stripe.com/docs/ach)) on your account before they appear in this list. The `stripe` payment method refers to [charging through your platform](https://stripe.com/docs/connect/destination-charges).
|
||||
attr_reader :supported_payment_methods
|
||||
# Countries that can accept transfers from the specified country.
|
||||
attr_reader :supported_transfer_countries
|
||||
# Attribute for field verification_fields
|
||||
attr_reader :verification_fields
|
||||
|
||||
# Lists all Country Spec objects available in the API.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/country_specs", params: params, opts: opts)
|
||||
end
|
||||
end
|
||||
end
|
249
lib/stripe/resources/coupon.rb
Normal file
249
lib/stripe/resources/coupon.rb
Normal file
@ -0,0 +1,249 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# A coupon contains information about a percent-off or amount-off discount you
|
||||
# might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices),
|
||||
# [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents).
|
||||
class Coupon < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
include Stripe::APIOperations::Delete
|
||||
extend Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "coupon"
|
||||
def self.object_name
|
||||
"coupon"
|
||||
end
|
||||
|
||||
class AppliesTo < Stripe::StripeObject
|
||||
# A list of product IDs this coupon applies to
|
||||
attr_reader :products
|
||||
end
|
||||
|
||||
class CurrencyOptions < Stripe::StripeObject
|
||||
# Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer.
|
||||
attr_reader :amount_off
|
||||
end
|
||||
|
||||
class DeleteParams < Stripe::RequestParams; end
|
||||
|
||||
class UpdateParams < Stripe::RequestParams
|
||||
class CurrencyOptions < Stripe::RequestParams
|
||||
# A positive integer representing the amount to subtract from an invoice total.
|
||||
attr_accessor :amount_off
|
||||
|
||||
def initialize(amount_off: nil)
|
||||
@amount_off = amount_off
|
||||
end
|
||||
end
|
||||
# Coupons defined in each available currency option (only supported if the coupon is amount-based). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_accessor :currency_options
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
# Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set.
|
||||
attr_accessor :name
|
||||
|
||||
def initialize(currency_options: nil, expand: nil, metadata: nil, name: nil)
|
||||
@currency_options = currency_options
|
||||
@expand = expand
|
||||
@metadata = metadata
|
||||
@name = name
|
||||
end
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
class Created < Stripe::RequestParams
|
||||
# Minimum value to filter by (exclusive)
|
||||
attr_accessor :gt
|
||||
# Minimum value to filter by (inclusive)
|
||||
attr_accessor :gte
|
||||
# Maximum value to filter by (exclusive)
|
||||
attr_accessor :lt
|
||||
# Maximum value to filter by (inclusive)
|
||||
attr_accessor :lte
|
||||
|
||||
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
|
||||
@gt = gt
|
||||
@gte = gte
|
||||
@lt = lt
|
||||
@lte = lte
|
||||
end
|
||||
end
|
||||
# A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
|
||||
attr_accessor :created
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(created: nil, ending_before: nil, expand: nil, limit: nil, starting_after: nil)
|
||||
@created = created
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class AppliesTo < Stripe::RequestParams
|
||||
# An array of Product IDs that this Coupon will apply to.
|
||||
attr_accessor :products
|
||||
|
||||
def initialize(products: nil)
|
||||
@products = products
|
||||
end
|
||||
end
|
||||
|
||||
class CurrencyOptions < Stripe::RequestParams
|
||||
# A positive integer representing the amount to subtract from an invoice total.
|
||||
attr_accessor :amount_off
|
||||
|
||||
def initialize(amount_off: nil)
|
||||
@amount_off = amount_off
|
||||
end
|
||||
end
|
||||
# A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed).
|
||||
attr_accessor :amount_off
|
||||
# A hash containing directions for what this Coupon will apply discounts to.
|
||||
attr_accessor :applies_to
|
||||
# Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `amount_off` parameter (required if `amount_off` is passed).
|
||||
attr_accessor :currency
|
||||
# Coupons defined in each available currency option (only supported if `amount_off` is passed). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_accessor :currency_options
|
||||
# Specifies how long the discount will be in effect if used on a subscription. Defaults to `once`.
|
||||
attr_accessor :duration
|
||||
# Required only if `duration` is `repeating`, in which case it must be a positive integer that specifies the number of months the discount will be in effect.
|
||||
attr_accessor :duration_in_months
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Unique string of your choice that will be used to identify this coupon when applying it to a customer. If you don't want to specify a particular code, you can leave the ID blank and we'll generate a random code for you.
|
||||
attr_accessor :id
|
||||
# A positive integer specifying the number of times the coupon can be redeemed before it's no longer valid. For example, you might have a 50% off coupon that the first 20 readers of your blog can use.
|
||||
attr_accessor :max_redemptions
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
# Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set.
|
||||
attr_accessor :name
|
||||
# A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amount_off` is not passed).
|
||||
attr_accessor :percent_off
|
||||
# Unix timestamp specifying the last time at which the coupon can be redeemed. After the redeem_by date, the coupon can no longer be applied to new customers.
|
||||
attr_accessor :redeem_by
|
||||
|
||||
def initialize(
|
||||
amount_off: nil,
|
||||
applies_to: nil,
|
||||
currency: nil,
|
||||
currency_options: nil,
|
||||
duration: nil,
|
||||
duration_in_months: nil,
|
||||
expand: nil,
|
||||
id: nil,
|
||||
max_redemptions: nil,
|
||||
metadata: nil,
|
||||
name: nil,
|
||||
percent_off: nil,
|
||||
redeem_by: nil
|
||||
)
|
||||
@amount_off = amount_off
|
||||
@applies_to = applies_to
|
||||
@currency = currency
|
||||
@currency_options = currency_options
|
||||
@duration = duration
|
||||
@duration_in_months = duration_in_months
|
||||
@expand = expand
|
||||
@id = id
|
||||
@max_redemptions = max_redemptions
|
||||
@metadata = metadata
|
||||
@name = name
|
||||
@percent_off = percent_off
|
||||
@redeem_by = redeem_by
|
||||
end
|
||||
end
|
||||
# Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer.
|
||||
attr_reader :amount_off
|
||||
# Attribute for field applies_to
|
||||
attr_reader :applies_to
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# If `amount_off` has been set, the three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the amount to take off.
|
||||
attr_reader :currency
|
||||
# Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency_options
|
||||
# One of `forever`, `once`, or `repeating`. Describes how long a customer who applies this coupon will get the discount.
|
||||
attr_reader :duration
|
||||
# If `duration` is `repeating`, the number of months the coupon applies. Null if coupon `duration` is `forever` or `once`.
|
||||
attr_reader :duration_in_months
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
|
||||
attr_reader :max_redemptions
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
attr_reader :metadata
|
||||
# Name of the coupon displayed to customers on for instance invoices or receipts.
|
||||
attr_reader :name
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a $ (or local equivalent)100 invoice $ (or local equivalent)50 instead.
|
||||
attr_reader :percent_off
|
||||
# Date after which the coupon can no longer be redeemed.
|
||||
attr_reader :redeem_by
|
||||
# Number of times this coupon has been applied to a customer.
|
||||
attr_reader :times_redeemed
|
||||
# Taking account of the above properties, whether this coupon can still be applied to a customer.
|
||||
attr_reader :valid
|
||||
# Always true for a deleted object
|
||||
attr_reader :deleted
|
||||
|
||||
# You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.
|
||||
#
|
||||
# A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(method: :post, path: "/v1/coupons", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.
|
||||
def self.delete(coupon, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: format("/v1/coupons/%<coupon>s", { coupon: CGI.escape(coupon) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.
|
||||
def delete(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :delete,
|
||||
path: format("/v1/coupons/%<coupon>s", { coupon: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Returns a list of your coupons.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/coupons", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
|
||||
def self.update(coupon, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/coupons/%<coupon>s", { coupon: CGI.escape(coupon) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
733
lib/stripe/resources/credit_note.rb
Normal file
733
lib/stripe/resources/credit_note.rb
Normal file
@ -0,0 +1,733 @@
|
||||
# File generated from our OpenAPI spec
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Stripe
|
||||
# Issue a credit note to adjust an invoice's amount after the invoice is finalized.
|
||||
#
|
||||
# Related guide: [Credit notes](https://stripe.com/docs/billing/invoices/credit-notes)
|
||||
class CreditNote < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
extend Stripe::APIOperations::List
|
||||
include Stripe::APIOperations::Save
|
||||
|
||||
OBJECT_NAME = "credit_note"
|
||||
def self.object_name
|
||||
"credit_note"
|
||||
end
|
||||
|
||||
class DiscountAmount < Stripe::StripeObject
|
||||
# The amount, in cents (or local equivalent), of the discount.
|
||||
attr_reader :amount
|
||||
# The discount that was applied to get this discount amount.
|
||||
attr_reader :discount
|
||||
end
|
||||
|
||||
class PretaxCreditAmount < Stripe::StripeObject
|
||||
# The amount, in cents (or local equivalent), of the pretax credit amount.
|
||||
attr_reader :amount
|
||||
# The credit balance transaction that was applied to get this pretax credit amount.
|
||||
attr_reader :credit_balance_transaction
|
||||
# The discount that was applied to get this pretax credit amount.
|
||||
attr_reader :discount
|
||||
# Type of the pretax credit amount referenced.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class Refund < Stripe::StripeObject
|
||||
# Amount of the refund that applies to this credit note, in cents (or local equivalent).
|
||||
attr_reader :amount_refunded
|
||||
# ID of the refund.
|
||||
attr_reader :refund
|
||||
end
|
||||
|
||||
class ShippingCost < Stripe::StripeObject
|
||||
class Tax < Stripe::StripeObject
|
||||
# Amount of tax applied for this rate.
|
||||
attr_reader :amount
|
||||
# Tax rates can be applied to [invoices](/invoicing/taxes/tax-rates), [subscriptions](/billing/taxes/tax-rates) and [Checkout Sessions](/payments/checkout/use-manual-tax-rates) to collect tax.
|
||||
#
|
||||
# Related guide: [Tax rates](/billing/taxes/tax-rates)
|
||||
attr_reader :rate
|
||||
# The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
|
||||
attr_reader :taxability_reason
|
||||
# The amount on which tax is calculated, in cents (or local equivalent).
|
||||
attr_reader :taxable_amount
|
||||
end
|
||||
# Total shipping cost before any taxes are applied.
|
||||
attr_reader :amount_subtotal
|
||||
# Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0.
|
||||
attr_reader :amount_tax
|
||||
# Total shipping cost after taxes are applied.
|
||||
attr_reader :amount_total
|
||||
# The ID of the ShippingRate for this invoice.
|
||||
attr_reader :shipping_rate
|
||||
# The taxes applied to the shipping rate.
|
||||
attr_reader :taxes
|
||||
end
|
||||
|
||||
class TotalTax < Stripe::StripeObject
|
||||
class TaxRateDetails < Stripe::StripeObject
|
||||
# Attribute for field tax_rate
|
||||
attr_reader :tax_rate
|
||||
end
|
||||
# The amount of the tax, in cents (or local equivalent).
|
||||
attr_reader :amount
|
||||
# Whether this tax is inclusive or exclusive.
|
||||
attr_reader :tax_behavior
|
||||
# Additional details about the tax rate. Only present when `type` is `tax_rate_details`.
|
||||
attr_reader :tax_rate_details
|
||||
# The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
|
||||
attr_reader :taxability_reason
|
||||
# The amount on which tax is calculated, in cents (or local equivalent).
|
||||
attr_reader :taxable_amount
|
||||
# The type of tax information.
|
||||
attr_reader :type
|
||||
end
|
||||
|
||||
class ListParams < Stripe::RequestParams
|
||||
class Created < Stripe::RequestParams
|
||||
# Minimum value to filter by (exclusive)
|
||||
attr_accessor :gt
|
||||
# Minimum value to filter by (inclusive)
|
||||
attr_accessor :gte
|
||||
# Maximum value to filter by (exclusive)
|
||||
attr_accessor :lt
|
||||
# Maximum value to filter by (inclusive)
|
||||
attr_accessor :lte
|
||||
|
||||
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
|
||||
@gt = gt
|
||||
@gte = gte
|
||||
@lt = lt
|
||||
@lte = lte
|
||||
end
|
||||
end
|
||||
# Only return credit notes that were created during the given date interval.
|
||||
attr_accessor :created
|
||||
# Only return credit notes for the customer specified by this customer ID.
|
||||
attr_accessor :customer
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Only return credit notes for the invoice specified by this invoice ID.
|
||||
attr_accessor :invoice
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(
|
||||
created: nil,
|
||||
customer: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
invoice: nil,
|
||||
limit: nil,
|
||||
starting_after: nil
|
||||
)
|
||||
@created = created
|
||||
@customer = customer
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@invoice = invoice
|
||||
@limit = limit
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class CreateParams < Stripe::RequestParams
|
||||
class Line < Stripe::RequestParams
|
||||
class TaxAmount < Stripe::RequestParams
|
||||
# The amount, in cents (or local equivalent), of the tax.
|
||||
attr_accessor :amount
|
||||
# The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
|
||||
attr_accessor :tax_rate
|
||||
# The amount on which tax is calculated, in cents (or local equivalent).
|
||||
attr_accessor :taxable_amount
|
||||
|
||||
def initialize(amount: nil, tax_rate: nil, taxable_amount: nil)
|
||||
@amount = amount
|
||||
@tax_rate = tax_rate
|
||||
@taxable_amount = taxable_amount
|
||||
end
|
||||
end
|
||||
# The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive
|
||||
attr_accessor :amount
|
||||
# The description of the credit note line item. Only valid when the `type` is `custom_line_item`.
|
||||
attr_accessor :description
|
||||
# The invoice line item to credit. Only valid when the `type` is `invoice_line_item`.
|
||||
attr_accessor :invoice_line_item
|
||||
# The line item quantity to credit.
|
||||
attr_accessor :quantity
|
||||
# A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
|
||||
attr_accessor :tax_amounts
|
||||
# The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
|
||||
attr_accessor :tax_rates
|
||||
# Type of the credit note line item, one of `invoice_line_item` or `custom_line_item`
|
||||
attr_accessor :type
|
||||
# The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`.
|
||||
attr_accessor :unit_amount
|
||||
# Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
|
||||
attr_accessor :unit_amount_decimal
|
||||
|
||||
def initialize(
|
||||
amount: nil,
|
||||
description: nil,
|
||||
invoice_line_item: nil,
|
||||
quantity: nil,
|
||||
tax_amounts: nil,
|
||||
tax_rates: nil,
|
||||
type: nil,
|
||||
unit_amount: nil,
|
||||
unit_amount_decimal: nil
|
||||
)
|
||||
@amount = amount
|
||||
@description = description
|
||||
@invoice_line_item = invoice_line_item
|
||||
@quantity = quantity
|
||||
@tax_amounts = tax_amounts
|
||||
@tax_rates = tax_rates
|
||||
@type = type
|
||||
@unit_amount = unit_amount
|
||||
@unit_amount_decimal = unit_amount_decimal
|
||||
end
|
||||
end
|
||||
|
||||
class Refund < Stripe::RequestParams
|
||||
# Amount of the refund that applies to this credit note, in cents (or local equivalent). Defaults to the entire refund amount.
|
||||
attr_accessor :amount_refunded
|
||||
# ID of an existing refund to link this credit note to.
|
||||
attr_accessor :refund
|
||||
|
||||
def initialize(amount_refunded: nil, refund: nil)
|
||||
@amount_refunded = amount_refunded
|
||||
@refund = refund
|
||||
end
|
||||
end
|
||||
|
||||
class ShippingCost < Stripe::RequestParams
|
||||
# The ID of the shipping rate to use for this order.
|
||||
attr_accessor :shipping_rate
|
||||
|
||||
def initialize(shipping_rate: nil)
|
||||
@shipping_rate = shipping_rate
|
||||
end
|
||||
end
|
||||
# The integer amount in cents (or local equivalent) representing the total amount of the credit note.
|
||||
attr_accessor :amount
|
||||
# The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
|
||||
attr_accessor :credit_amount
|
||||
# The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
|
||||
attr_accessor :effective_at
|
||||
# Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`.
|
||||
attr_accessor :email_type
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# ID of the invoice.
|
||||
attr_accessor :invoice
|
||||
# Line items that make up the credit note.
|
||||
attr_accessor :lines
|
||||
# The credit note's memo appears on the credit note PDF.
|
||||
attr_accessor :memo
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
# The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
|
||||
attr_accessor :out_of_band_amount
|
||||
# Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
|
||||
attr_accessor :reason
|
||||
# The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
|
||||
attr_accessor :refund_amount
|
||||
# Refunds to link to this credit note.
|
||||
attr_accessor :refunds
|
||||
# When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
|
||||
attr_accessor :shipping_cost
|
||||
|
||||
def initialize(
|
||||
amount: nil,
|
||||
credit_amount: nil,
|
||||
effective_at: nil,
|
||||
email_type: nil,
|
||||
expand: nil,
|
||||
invoice: nil,
|
||||
lines: nil,
|
||||
memo: nil,
|
||||
metadata: nil,
|
||||
out_of_band_amount: nil,
|
||||
reason: nil,
|
||||
refund_amount: nil,
|
||||
refunds: nil,
|
||||
shipping_cost: nil
|
||||
)
|
||||
@amount = amount
|
||||
@credit_amount = credit_amount
|
||||
@effective_at = effective_at
|
||||
@email_type = email_type
|
||||
@expand = expand
|
||||
@invoice = invoice
|
||||
@lines = lines
|
||||
@memo = memo
|
||||
@metadata = metadata
|
||||
@out_of_band_amount = out_of_band_amount
|
||||
@reason = reason
|
||||
@refund_amount = refund_amount
|
||||
@refunds = refunds
|
||||
@shipping_cost = shipping_cost
|
||||
end
|
||||
end
|
||||
|
||||
class UpdateParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# Credit note memo.
|
||||
attr_accessor :memo
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
|
||||
def initialize(expand: nil, memo: nil, metadata: nil)
|
||||
@expand = expand
|
||||
@memo = memo
|
||||
@metadata = metadata
|
||||
end
|
||||
end
|
||||
|
||||
class PreviewParams < Stripe::RequestParams
|
||||
class Line < Stripe::RequestParams
|
||||
class TaxAmount < Stripe::RequestParams
|
||||
# The amount, in cents (or local equivalent), of the tax.
|
||||
attr_accessor :amount
|
||||
# The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
|
||||
attr_accessor :tax_rate
|
||||
# The amount on which tax is calculated, in cents (or local equivalent).
|
||||
attr_accessor :taxable_amount
|
||||
|
||||
def initialize(amount: nil, tax_rate: nil, taxable_amount: nil)
|
||||
@amount = amount
|
||||
@tax_rate = tax_rate
|
||||
@taxable_amount = taxable_amount
|
||||
end
|
||||
end
|
||||
# The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive
|
||||
attr_accessor :amount
|
||||
# The description of the credit note line item. Only valid when the `type` is `custom_line_item`.
|
||||
attr_accessor :description
|
||||
# The invoice line item to credit. Only valid when the `type` is `invoice_line_item`.
|
||||
attr_accessor :invoice_line_item
|
||||
# The line item quantity to credit.
|
||||
attr_accessor :quantity
|
||||
# A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
|
||||
attr_accessor :tax_amounts
|
||||
# The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
|
||||
attr_accessor :tax_rates
|
||||
# Type of the credit note line item, one of `invoice_line_item` or `custom_line_item`
|
||||
attr_accessor :type
|
||||
# The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`.
|
||||
attr_accessor :unit_amount
|
||||
# Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
|
||||
attr_accessor :unit_amount_decimal
|
||||
|
||||
def initialize(
|
||||
amount: nil,
|
||||
description: nil,
|
||||
invoice_line_item: nil,
|
||||
quantity: nil,
|
||||
tax_amounts: nil,
|
||||
tax_rates: nil,
|
||||
type: nil,
|
||||
unit_amount: nil,
|
||||
unit_amount_decimal: nil
|
||||
)
|
||||
@amount = amount
|
||||
@description = description
|
||||
@invoice_line_item = invoice_line_item
|
||||
@quantity = quantity
|
||||
@tax_amounts = tax_amounts
|
||||
@tax_rates = tax_rates
|
||||
@type = type
|
||||
@unit_amount = unit_amount
|
||||
@unit_amount_decimal = unit_amount_decimal
|
||||
end
|
||||
end
|
||||
|
||||
class Refund < Stripe::RequestParams
|
||||
# Amount of the refund that applies to this credit note, in cents (or local equivalent). Defaults to the entire refund amount.
|
||||
attr_accessor :amount_refunded
|
||||
# ID of an existing refund to link this credit note to.
|
||||
attr_accessor :refund
|
||||
|
||||
def initialize(amount_refunded: nil, refund: nil)
|
||||
@amount_refunded = amount_refunded
|
||||
@refund = refund
|
||||
end
|
||||
end
|
||||
|
||||
class ShippingCost < Stripe::RequestParams
|
||||
# The ID of the shipping rate to use for this order.
|
||||
attr_accessor :shipping_rate
|
||||
|
||||
def initialize(shipping_rate: nil)
|
||||
@shipping_rate = shipping_rate
|
||||
end
|
||||
end
|
||||
# The integer amount in cents (or local equivalent) representing the total amount of the credit note.
|
||||
attr_accessor :amount
|
||||
# The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
|
||||
attr_accessor :credit_amount
|
||||
# The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
|
||||
attr_accessor :effective_at
|
||||
# Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`.
|
||||
attr_accessor :email_type
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# ID of the invoice.
|
||||
attr_accessor :invoice
|
||||
# Line items that make up the credit note.
|
||||
attr_accessor :lines
|
||||
# The credit note's memo appears on the credit note PDF.
|
||||
attr_accessor :memo
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
# The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
|
||||
attr_accessor :out_of_band_amount
|
||||
# Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
|
||||
attr_accessor :reason
|
||||
# The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
|
||||
attr_accessor :refund_amount
|
||||
# Refunds to link to this credit note.
|
||||
attr_accessor :refunds
|
||||
# When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
|
||||
attr_accessor :shipping_cost
|
||||
|
||||
def initialize(
|
||||
amount: nil,
|
||||
credit_amount: nil,
|
||||
effective_at: nil,
|
||||
email_type: nil,
|
||||
expand: nil,
|
||||
invoice: nil,
|
||||
lines: nil,
|
||||
memo: nil,
|
||||
metadata: nil,
|
||||
out_of_band_amount: nil,
|
||||
reason: nil,
|
||||
refund_amount: nil,
|
||||
refunds: nil,
|
||||
shipping_cost: nil
|
||||
)
|
||||
@amount = amount
|
||||
@credit_amount = credit_amount
|
||||
@effective_at = effective_at
|
||||
@email_type = email_type
|
||||
@expand = expand
|
||||
@invoice = invoice
|
||||
@lines = lines
|
||||
@memo = memo
|
||||
@metadata = metadata
|
||||
@out_of_band_amount = out_of_band_amount
|
||||
@reason = reason
|
||||
@refund_amount = refund_amount
|
||||
@refunds = refunds
|
||||
@shipping_cost = shipping_cost
|
||||
end
|
||||
end
|
||||
|
||||
class ListPreviewLineItemsParams < Stripe::RequestParams
|
||||
class Line < Stripe::RequestParams
|
||||
class TaxAmount < Stripe::RequestParams
|
||||
# The amount, in cents (or local equivalent), of the tax.
|
||||
attr_accessor :amount
|
||||
# The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
|
||||
attr_accessor :tax_rate
|
||||
# The amount on which tax is calculated, in cents (or local equivalent).
|
||||
attr_accessor :taxable_amount
|
||||
|
||||
def initialize(amount: nil, tax_rate: nil, taxable_amount: nil)
|
||||
@amount = amount
|
||||
@tax_rate = tax_rate
|
||||
@taxable_amount = taxable_amount
|
||||
end
|
||||
end
|
||||
# The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive
|
||||
attr_accessor :amount
|
||||
# The description of the credit note line item. Only valid when the `type` is `custom_line_item`.
|
||||
attr_accessor :description
|
||||
# The invoice line item to credit. Only valid when the `type` is `invoice_line_item`.
|
||||
attr_accessor :invoice_line_item
|
||||
# The line item quantity to credit.
|
||||
attr_accessor :quantity
|
||||
# A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
|
||||
attr_accessor :tax_amounts
|
||||
# The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
|
||||
attr_accessor :tax_rates
|
||||
# Type of the credit note line item, one of `invoice_line_item` or `custom_line_item`
|
||||
attr_accessor :type
|
||||
# The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`.
|
||||
attr_accessor :unit_amount
|
||||
# Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
|
||||
attr_accessor :unit_amount_decimal
|
||||
|
||||
def initialize(
|
||||
amount: nil,
|
||||
description: nil,
|
||||
invoice_line_item: nil,
|
||||
quantity: nil,
|
||||
tax_amounts: nil,
|
||||
tax_rates: nil,
|
||||
type: nil,
|
||||
unit_amount: nil,
|
||||
unit_amount_decimal: nil
|
||||
)
|
||||
@amount = amount
|
||||
@description = description
|
||||
@invoice_line_item = invoice_line_item
|
||||
@quantity = quantity
|
||||
@tax_amounts = tax_amounts
|
||||
@tax_rates = tax_rates
|
||||
@type = type
|
||||
@unit_amount = unit_amount
|
||||
@unit_amount_decimal = unit_amount_decimal
|
||||
end
|
||||
end
|
||||
|
||||
class Refund < Stripe::RequestParams
|
||||
# Amount of the refund that applies to this credit note, in cents (or local equivalent). Defaults to the entire refund amount.
|
||||
attr_accessor :amount_refunded
|
||||
# ID of an existing refund to link this credit note to.
|
||||
attr_accessor :refund
|
||||
|
||||
def initialize(amount_refunded: nil, refund: nil)
|
||||
@amount_refunded = amount_refunded
|
||||
@refund = refund
|
||||
end
|
||||
end
|
||||
|
||||
class ShippingCost < Stripe::RequestParams
|
||||
# The ID of the shipping rate to use for this order.
|
||||
attr_accessor :shipping_rate
|
||||
|
||||
def initialize(shipping_rate: nil)
|
||||
@shipping_rate = shipping_rate
|
||||
end
|
||||
end
|
||||
# The integer amount in cents (or local equivalent) representing the total amount of the credit note.
|
||||
attr_accessor :amount
|
||||
# The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
|
||||
attr_accessor :credit_amount
|
||||
# The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
|
||||
attr_accessor :effective_at
|
||||
# Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`.
|
||||
attr_accessor :email_type
|
||||
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
|
||||
attr_accessor :ending_before
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
# ID of the invoice.
|
||||
attr_accessor :invoice
|
||||
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
|
||||
attr_accessor :limit
|
||||
# Line items that make up the credit note.
|
||||
attr_accessor :lines
|
||||
# The credit note's memo appears on the credit note PDF.
|
||||
attr_accessor :memo
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
|
||||
attr_accessor :metadata
|
||||
# The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
|
||||
attr_accessor :out_of_band_amount
|
||||
# Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
|
||||
attr_accessor :reason
|
||||
# The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
|
||||
attr_accessor :refund_amount
|
||||
# Refunds to link to this credit note.
|
||||
attr_accessor :refunds
|
||||
# When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
|
||||
attr_accessor :shipping_cost
|
||||
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
attr_accessor :starting_after
|
||||
|
||||
def initialize(
|
||||
amount: nil,
|
||||
credit_amount: nil,
|
||||
effective_at: nil,
|
||||
email_type: nil,
|
||||
ending_before: nil,
|
||||
expand: nil,
|
||||
invoice: nil,
|
||||
limit: nil,
|
||||
lines: nil,
|
||||
memo: nil,
|
||||
metadata: nil,
|
||||
out_of_band_amount: nil,
|
||||
reason: nil,
|
||||
refund_amount: nil,
|
||||
refunds: nil,
|
||||
shipping_cost: nil,
|
||||
starting_after: nil
|
||||
)
|
||||
@amount = amount
|
||||
@credit_amount = credit_amount
|
||||
@effective_at = effective_at
|
||||
@email_type = email_type
|
||||
@ending_before = ending_before
|
||||
@expand = expand
|
||||
@invoice = invoice
|
||||
@limit = limit
|
||||
@lines = lines
|
||||
@memo = memo
|
||||
@metadata = metadata
|
||||
@out_of_band_amount = out_of_band_amount
|
||||
@reason = reason
|
||||
@refund_amount = refund_amount
|
||||
@refunds = refunds
|
||||
@shipping_cost = shipping_cost
|
||||
@starting_after = starting_after
|
||||
end
|
||||
end
|
||||
|
||||
class VoidCreditNoteParams < Stripe::RequestParams
|
||||
# Specifies which fields in the response should be expanded.
|
||||
attr_accessor :expand
|
||||
|
||||
def initialize(expand: nil)
|
||||
@expand = expand
|
||||
end
|
||||
end
|
||||
# The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax.
|
||||
attr_reader :amount
|
||||
# This is the sum of all the shipping amounts.
|
||||
attr_reader :amount_shipping
|
||||
# Time at which the object was created. Measured in seconds since the Unix epoch.
|
||||
attr_reader :created
|
||||
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
|
||||
attr_reader :currency
|
||||
# ID of the customer.
|
||||
attr_reader :customer
|
||||
# Customer balance transaction related to this credit note.
|
||||
attr_reader :customer_balance_transaction
|
||||
# The integer amount in cents (or local equivalent) representing the total amount of discount that was credited.
|
||||
attr_reader :discount_amount
|
||||
# The aggregate amounts calculated per discount for all line items.
|
||||
attr_reader :discount_amounts
|
||||
# The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
|
||||
attr_reader :effective_at
|
||||
# Unique identifier for the object.
|
||||
attr_reader :id
|
||||
# ID of the invoice.
|
||||
attr_reader :invoice
|
||||
# Line items that make up the credit note
|
||||
attr_reader :lines
|
||||
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
|
||||
attr_reader :livemode
|
||||
# Customer-facing text that appears on the credit note PDF.
|
||||
attr_reader :memo
|
||||
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
|
||||
attr_reader :metadata
|
||||
# A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
|
||||
attr_reader :number
|
||||
# String representing the object's type. Objects of the same type share the same value.
|
||||
attr_reader :object
|
||||
# Amount that was credited outside of Stripe.
|
||||
attr_reader :out_of_band_amount
|
||||
# The link to download the PDF of the credit note.
|
||||
attr_reader :pdf
|
||||
# The amount of the credit note that was refunded to the customer, credited to the customer's balance, credited outside of Stripe, or any combination thereof.
|
||||
attr_reader :post_payment_amount
|
||||
# The amount of the credit note by which the invoice's `amount_remaining` and `amount_due` were reduced.
|
||||
attr_reader :pre_payment_amount
|
||||
# The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
|
||||
attr_reader :pretax_credit_amounts
|
||||
# Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
|
||||
attr_reader :reason
|
||||
# Refunds related to this credit note.
|
||||
attr_reader :refunds
|
||||
# The details of the cost of shipping, including the ShippingRate applied to the invoice.
|
||||
attr_reader :shipping_cost
|
||||
# Status of this credit note, one of `issued` or `void`. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
|
||||
attr_reader :status
|
||||
# The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
|
||||
attr_reader :subtotal
|
||||
# The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding all tax and invoice level discounts.
|
||||
attr_reader :subtotal_excluding_tax
|
||||
# The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax and all discount.
|
||||
attr_reader :total
|
||||
# The integer amount in cents (or local equivalent) representing the total amount of the credit note, excluding tax, but including discounts.
|
||||
attr_reader :total_excluding_tax
|
||||
# The aggregate tax information for all line items.
|
||||
attr_reader :total_taxes
|
||||
# Type of this credit note, one of `pre_payment` or `post_payment`. A `pre_payment` credit note means it was issued when the invoice was open. A `post_payment` credit note means it was issued when the invoice was paid.
|
||||
attr_reader :type
|
||||
# The time that the credit note was voided.
|
||||
attr_reader :voided_at
|
||||
|
||||
# Issue a credit note to adjust the amount of a finalized invoice. A credit note will first reduce the invoice's amount_remaining (and amount_due), but not below zero.
|
||||
# This amount is indicated by the credit note's pre_payment_amount. The excess amount is indicated by post_payment_amount, and it can result in any combination of the following:
|
||||
#
|
||||
#
|
||||
# Refunds: create a new refund (using refund_amount) or link existing refunds (using refunds).
|
||||
# Customer balance credit: credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when it's finalized.
|
||||
# Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).
|
||||
#
|
||||
#
|
||||
# The sum of refunds, customer balance credits, and outside of Stripe credits must equal the post_payment_amount.
|
||||
#
|
||||
# You may issue multiple credit notes for an invoice. Each credit note may increment the invoice's pre_payment_credit_notes_amount,
|
||||
# post_payment_credit_notes_amount, or both, depending on the invoice's amount_remaining at the time of credit note creation.
|
||||
def self.create(params = {}, opts = {})
|
||||
request_stripe_object(method: :post, path: "/v1/credit_notes", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# Returns a list of credit notes.
|
||||
def self.list(params = {}, opts = {})
|
||||
request_stripe_object(method: :get, path: "/v1/credit_notes", params: params, opts: opts)
|
||||
end
|
||||
|
||||
# When retrieving a credit note preview, you'll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.
|
||||
def self.list_preview_line_items(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/credit_notes/preview/lines",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Get a preview of a credit note without creating it.
|
||||
def self.preview(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :get,
|
||||
path: "/v1/credit_notes/preview",
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Updates an existing credit note.
|
||||
def self.update(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/credit_notes/%<id>s", { id: CGI.escape(id) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Marks a credit note as void. Learn more about [voiding credit notes](https://docs.stripe.com/docs/billing/invoices/credit-notes#voiding).
|
||||
def void_credit_note(params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
end
|
||||
|
||||
# Marks a credit note as void. Learn more about [voiding credit notes](https://docs.stripe.com/docs/billing/invoices/credit-notes#voiding).
|
||||
def self.void_credit_note(id, params = {}, opts = {})
|
||||
request_stripe_object(
|
||||
method: :post,
|
||||
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
|
||||
params: params,
|
||||
opts: opts
|
||||
)
|
||||
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