stripe 6.3.0 → 6.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Makefile +1 -1
  4. data/OPENAPI_VERSION +1 -1
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/create.rb +6 -2
  7. data/lib/stripe/api_operations/delete.rb +12 -7
  8. data/lib/stripe/api_operations/list.rb +6 -9
  9. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  10. data/lib/stripe/api_operations/request.rb +10 -0
  11. data/lib/stripe/api_operations/save.rb +6 -3
  12. data/lib/stripe/api_operations/search.rb +6 -9
  13. data/lib/stripe/api_resource.rb +1 -1
  14. data/lib/stripe/resources/account.rb +28 -8
  15. data/lib/stripe/resources/apps/secret.rb +10 -12
  16. data/lib/stripe/resources/charge.rb +10 -3
  17. data/lib/stripe/resources/checkout/session.rb +10 -3
  18. data/lib/stripe/resources/credit_note.rb +22 -7
  19. data/lib/stripe/resources/customer.rb +66 -25
  20. data/lib/stripe/resources/dispute.rb +10 -3
  21. data/lib/stripe/resources/financial_connections/account.rb +30 -7
  22. data/lib/stripe/resources/identity/verification_session.rb +20 -5
  23. data/lib/stripe/resources/invoice.rb +62 -15
  24. data/lib/stripe/resources/issuing/authorization.rb +20 -5
  25. data/lib/stripe/resources/issuing/card.rb +10 -3
  26. data/lib/stripe/resources/issuing/dispute.rb +10 -3
  27. data/lib/stripe/resources/order.rb +40 -9
  28. data/lib/stripe/resources/payment_intent.rb +60 -13
  29. data/lib/stripe/resources/payment_link.rb +10 -3
  30. data/lib/stripe/resources/payment_method.rb +20 -5
  31. data/lib/stripe/resources/payout.rb +20 -5
  32. data/lib/stripe/resources/quote.rb +50 -11
  33. data/lib/stripe/resources/refund.rb +19 -5
  34. data/lib/stripe/resources/review.rb +10 -3
  35. data/lib/stripe/resources/setup_intent.rb +30 -7
  36. data/lib/stripe/resources/source.rb +16 -6
  37. data/lib/stripe/resources/subscription.rb +10 -3
  38. data/lib/stripe/resources/subscription_item.rb +6 -2
  39. data/lib/stripe/resources/subscription_schedule.rb +20 -5
  40. data/lib/stripe/resources/terminal/reader.rb +49 -11
  41. data/lib/stripe/resources/test_helpers/test_clock.rb +10 -3
  42. data/lib/stripe/resources/topup.rb +10 -3
  43. data/lib/stripe/resources/transfer.rb +10 -3
  44. data/lib/stripe/resources/treasury/financial_account.rb +20 -5
  45. data/lib/stripe/resources/treasury/inbound_transfer.rb +39 -9
  46. data/lib/stripe/resources/treasury/outbound_payment.rb +39 -9
  47. data/lib/stripe/resources/treasury/outbound_transfer.rb +43 -9
  48. data/lib/stripe/resources/treasury/received_credit.rb +5 -6
  49. data/lib/stripe/resources/treasury/received_debit.rb +5 -6
  50. data/lib/stripe/util.rb +29 -3
  51. data/lib/stripe/version.rb +1 -1
  52. metadata +2 -2
@@ -8,14 +8,10 @@ module Stripe
8
8
 
9
9
  OBJECT_NAME = "financial_connections.account"
10
10
 
11
- custom_method :disconnect, http_verb: :post
12
- custom_method :list_owners, http_verb: :get, http_path: "owners"
13
- custom_method :refresh_account, http_verb: :post, http_path: "refresh"
14
-
15
11
  def disconnect(params = {}, opts = {})
16
12
  request_stripe_object(
17
13
  method: :post,
18
- path: resource_url + "/disconnect",
14
+ path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(self["id"]) }),
19
15
  params: params,
20
16
  opts: opts
21
17
  )
@@ -24,7 +20,7 @@ module Stripe
24
20
  def list_owners(params = {}, opts = {})
25
21
  request_stripe_object(
26
22
  method: :get,
27
- path: resource_url + "/owners",
23
+ path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(self["id"]) }),
28
24
  params: params,
29
25
  opts: opts
30
26
  )
@@ -33,7 +29,34 @@ module Stripe
33
29
  def refresh_account(params = {}, opts = {})
34
30
  request_stripe_object(
35
31
  method: :post,
36
- path: resource_url + "/refresh",
32
+ path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(self["id"]) }),
33
+ params: params,
34
+ opts: opts
35
+ )
36
+ end
37
+
38
+ def self.disconnect(account, params = {}, opts = {})
39
+ request_stripe_object(
40
+ method: :post,
41
+ path: format("/v1/financial_connections/accounts/%<account>s/disconnect", { account: CGI.escape(account) }),
42
+ params: params,
43
+ opts: opts
44
+ )
45
+ end
46
+
47
+ def self.list_owners(account, params = {}, opts = {})
48
+ request_stripe_object(
49
+ method: :get,
50
+ path: format("/v1/financial_connections/accounts/%<account>s/owners", { account: CGI.escape(account) }),
51
+ params: params,
52
+ opts: opts
53
+ )
54
+ end
55
+
56
+ def self.refresh_account(account, params = {}, opts = {})
57
+ request_stripe_object(
58
+ method: :post,
59
+ path: format("/v1/financial_connections/accounts/%<account>s/refresh", { account: CGI.escape(account) }),
37
60
  params: params,
38
61
  opts: opts
39
62
  )
@@ -10,13 +10,10 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "identity.verification_session"
12
12
 
13
- custom_method :cancel, http_verb: :post
14
- custom_method :redact, http_verb: :post
15
-
16
13
  def cancel(params = {}, opts = {})
17
14
  request_stripe_object(
18
15
  method: :post,
19
- path: resource_url + "/cancel",
16
+ path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(self["id"]) }),
20
17
  params: params,
21
18
  opts: opts
22
19
  )
@@ -25,7 +22,25 @@ module Stripe
25
22
  def redact(params = {}, opts = {})
26
23
  request_stripe_object(
27
24
  method: :post,
28
- path: resource_url + "/redact",
25
+ path: format("/v1/identity/verification_sessions/%<session>s/redact", { session: CGI.escape(self["id"]) }),
26
+ params: params,
27
+ opts: opts
28
+ )
29
+ end
30
+
31
+ def self.cancel(session, params = {}, opts = {})
32
+ request_stripe_object(
33
+ method: :post,
34
+ path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
35
+ params: params,
36
+ opts: opts
37
+ )
38
+ end
39
+
40
+ def self.redact(session, params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :post,
43
+ path: format("/v1/identity/verification_sessions/%<session>s/redact", { session: CGI.escape(session) }),
29
44
  params: params,
30
45
  opts: opts
31
46
  )
@@ -11,16 +11,10 @@ module Stripe
11
11
 
12
12
  OBJECT_NAME = "invoice"
13
13
 
14
- custom_method :finalize_invoice, http_verb: :post, http_path: "finalize"
15
- custom_method :mark_uncollectible, http_verb: :post
16
- custom_method :pay, http_verb: :post
17
- custom_method :send_invoice, http_verb: :post, http_path: "send"
18
- custom_method :void_invoice, http_verb: :post, http_path: "void"
19
-
20
14
  def finalize_invoice(params = {}, opts = {})
21
15
  request_stripe_object(
22
16
  method: :post,
23
- path: resource_url + "/finalize",
17
+ path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(self["id"]) }),
24
18
  params: params,
25
19
  opts: opts
26
20
  )
@@ -29,7 +23,7 @@ module Stripe
29
23
  def mark_uncollectible(params = {}, opts = {})
30
24
  request_stripe_object(
31
25
  method: :post,
32
- path: resource_url + "/mark_uncollectible",
26
+ path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(self["id"]) }),
33
27
  params: params,
34
28
  opts: opts
35
29
  )
@@ -38,7 +32,7 @@ module Stripe
38
32
  def pay(params = {}, opts = {})
39
33
  request_stripe_object(
40
34
  method: :post,
41
- path: resource_url + "/pay",
35
+ path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(self["id"]) }),
42
36
  params: params,
43
37
  opts: opts
44
38
  )
@@ -47,7 +41,7 @@ module Stripe
47
41
  def send_invoice(params = {}, opts = {})
48
42
  request_stripe_object(
49
43
  method: :post,
50
- path: resource_url + "/send",
44
+ path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(self["id"]) }),
51
45
  params: params,
52
46
  opts: opts
53
47
  )
@@ -56,20 +50,73 @@ module Stripe
56
50
  def void_invoice(params = {}, opts = {})
57
51
  request_stripe_object(
58
52
  method: :post,
59
- path: resource_url + "/void",
53
+ path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(self["id"]) }),
54
+ params: params,
55
+ opts: opts
56
+ )
57
+ end
58
+
59
+ def self.finalize_invoice(invoice, params = {}, opts = {})
60
+ request_stripe_object(
61
+ method: :post,
62
+ path: format("/v1/invoices/%<invoice>s/finalize", { invoice: CGI.escape(invoice) }),
63
+ params: params,
64
+ opts: opts
65
+ )
66
+ end
67
+
68
+ def self.mark_uncollectible(invoice, params = {}, opts = {})
69
+ request_stripe_object(
70
+ method: :post,
71
+ path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(invoice) }),
72
+ params: params,
73
+ opts: opts
74
+ )
75
+ end
76
+
77
+ def self.pay(invoice, params = {}, opts = {})
78
+ request_stripe_object(
79
+ method: :post,
80
+ path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(invoice) }),
81
+ params: params,
82
+ opts: opts
83
+ )
84
+ end
85
+
86
+ def self.send_invoice(invoice, params = {}, opts = {})
87
+ request_stripe_object(
88
+ method: :post,
89
+ path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(invoice) }),
90
+ params: params,
91
+ opts: opts
92
+ )
93
+ end
94
+
95
+ def self.void_invoice(invoice, params = {}, opts = {})
96
+ request_stripe_object(
97
+ method: :post,
98
+ path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
60
99
  params: params,
61
100
  opts: opts
62
101
  )
63
102
  end
64
103
 
65
104
  def self.upcoming(params, opts = {})
66
- resp, opts = execute_resource_request(:get, resource_url + "/upcoming", params, opts)
67
- Util.convert_to_stripe_object(resp.data, opts)
105
+ request_stripe_object(
106
+ method: :get,
107
+ path: resource_url + "/upcoming",
108
+ params: params,
109
+ opts: opts
110
+ )
68
111
  end
69
112
 
70
113
  def self.list_upcoming_line_items(params, opts = {})
71
- resp, opts = execute_resource_request(:get, resource_url + "/upcoming/lines", params, opts)
72
- Util.convert_to_stripe_object(resp.data, opts)
114
+ request_stripe_object(
115
+ method: :get,
116
+ path: resource_url + "/upcoming/lines",
117
+ params: params,
118
+ opts: opts
119
+ )
73
120
  end
74
121
 
75
122
  def self.search(params = {}, opts = {})
@@ -9,13 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "issuing.authorization"
11
11
 
12
- custom_method :approve, http_verb: :post
13
- custom_method :decline, http_verb: :post
14
-
15
12
  def approve(params = {}, opts = {})
16
13
  request_stripe_object(
17
14
  method: :post,
18
- path: resource_url + "/approve",
15
+ path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(self["id"]) }),
19
16
  params: params,
20
17
  opts: opts
21
18
  )
@@ -24,7 +21,25 @@ module Stripe
24
21
  def decline(params = {}, opts = {})
25
22
  request_stripe_object(
26
23
  method: :post,
27
- path: resource_url + "/decline",
24
+ path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.approve(authorization, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(authorization) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.decline(authorization, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(authorization) }),
28
43
  params: params,
29
44
  opts: opts
30
45
  )
@@ -10,12 +10,19 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "issuing.card"
12
12
 
13
- custom_method :details, http_verb: :get
14
-
15
13
  def details(params = {}, opts = {})
16
14
  request_stripe_object(
17
15
  method: :get,
18
- path: resource_url + "/details",
16
+ path: format("/v1/issuing/cards/%<card>s/details", { card: CGI.escape(self["id"]) }),
17
+ params: params,
18
+ opts: opts
19
+ )
20
+ end
21
+
22
+ def self.details(card, params = {}, opts = {})
23
+ request_stripe_object(
24
+ method: :get,
25
+ path: format("/v1/issuing/cards/%<card>s/details", { card: CGI.escape(card) }),
19
26
  params: params,
20
27
  opts: opts
21
28
  )
@@ -10,12 +10,19 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "issuing.dispute"
12
12
 
13
- custom_method :submit, http_verb: :post
14
-
15
13
  def submit(params = {}, opts = {})
16
14
  request_stripe_object(
17
15
  method: :post,
18
- path: resource_url + "/submit",
16
+ path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(self["id"]) }),
17
+ params: params,
18
+ opts: opts
19
+ )
20
+ end
21
+
22
+ def self.submit(dispute, params = {}, opts = {})
23
+ request_stripe_object(
24
+ method: :post,
25
+ path: format("/v1/issuing/disputes/%<dispute>s/submit", { dispute: CGI.escape(dispute) }),
19
26
  params: params,
20
27
  opts: opts
21
28
  )
@@ -9,15 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "order"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :list_line_items, http_verb: :get, http_path: "line_items"
14
- custom_method :reopen, http_verb: :post
15
- custom_method :submit, http_verb: :post
16
-
17
12
  def cancel(params = {}, opts = {})
18
13
  request_stripe_object(
19
14
  method: :post,
20
- path: resource_url + "/cancel",
15
+ path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
21
16
  params: params,
22
17
  opts: opts
23
18
  )
@@ -26,7 +21,7 @@ module Stripe
26
21
  def list_line_items(params = {}, opts = {})
27
22
  request_stripe_object(
28
23
  method: :get,
29
- path: resource_url + "/line_items",
24
+ path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(self["id"]) }),
30
25
  params: params,
31
26
  opts: opts
32
27
  )
@@ -35,7 +30,7 @@ module Stripe
35
30
  def reopen(params = {}, opts = {})
36
31
  request_stripe_object(
37
32
  method: :post,
38
- path: resource_url + "/reopen",
33
+ path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(self["id"]) }),
39
34
  params: params,
40
35
  opts: opts
41
36
  )
@@ -44,7 +39,43 @@ module Stripe
44
39
  def submit(params = {}, opts = {})
45
40
  request_stripe_object(
46
41
  method: :post,
47
- path: resource_url + "/submit",
42
+ path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(self["id"]) }),
43
+ params: params,
44
+ opts: opts
45
+ )
46
+ end
47
+
48
+ def self.cancel(id, params = {}, opts = {})
49
+ request_stripe_object(
50
+ method: :post,
51
+ path: format("/v1/orders/%<id>s/cancel", { id: CGI.escape(id) }),
52
+ params: params,
53
+ opts: opts
54
+ )
55
+ end
56
+
57
+ def self.list_line_items(id, params = {}, opts = {})
58
+ request_stripe_object(
59
+ method: :get,
60
+ path: format("/v1/orders/%<id>s/line_items", { id: CGI.escape(id) }),
61
+ params: params,
62
+ opts: opts
63
+ )
64
+ end
65
+
66
+ def self.reopen(id, params = {}, opts = {})
67
+ request_stripe_object(
68
+ method: :post,
69
+ path: format("/v1/orders/%<id>s/reopen", { id: CGI.escape(id) }),
70
+ params: params,
71
+ opts: opts
72
+ )
73
+ end
74
+
75
+ def self.submit(id, params = {}, opts = {})
76
+ request_stripe_object(
77
+ method: :post,
78
+ path: format("/v1/orders/%<id>s/submit", { id: CGI.escape(id) }),
48
79
  params: params,
49
80
  opts: opts
50
81
  )
@@ -10,17 +10,10 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "payment_intent"
12
12
 
13
- custom_method :apply_customer_balance, http_verb: :post
14
- custom_method :cancel, http_verb: :post
15
- custom_method :capture, http_verb: :post
16
- custom_method :confirm, http_verb: :post
17
- custom_method :increment_authorization, http_verb: :post
18
- custom_method :verify_microdeposits, http_verb: :post
19
-
20
13
  def apply_customer_balance(params = {}, opts = {})
21
14
  request_stripe_object(
22
15
  method: :post,
23
- path: resource_url + "/apply_customer_balance",
16
+ path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(self["id"]) }),
24
17
  params: params,
25
18
  opts: opts
26
19
  )
@@ -29,7 +22,7 @@ module Stripe
29
22
  def cancel(params = {}, opts = {})
30
23
  request_stripe_object(
31
24
  method: :post,
32
- path: resource_url + "/cancel",
25
+ path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }),
33
26
  params: params,
34
27
  opts: opts
35
28
  )
@@ -38,7 +31,7 @@ module Stripe
38
31
  def capture(params = {}, opts = {})
39
32
  request_stripe_object(
40
33
  method: :post,
41
- path: resource_url + "/capture",
34
+ path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(self["id"]) }),
42
35
  params: params,
43
36
  opts: opts
44
37
  )
@@ -47,7 +40,7 @@ module Stripe
47
40
  def confirm(params = {}, opts = {})
48
41
  request_stripe_object(
49
42
  method: :post,
50
- path: resource_url + "/confirm",
43
+ path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }),
51
44
  params: params,
52
45
  opts: opts
53
46
  )
@@ -56,7 +49,7 @@ module Stripe
56
49
  def increment_authorization(params = {}, opts = {})
57
50
  request_stripe_object(
58
51
  method: :post,
59
- path: resource_url + "/increment_authorization",
52
+ path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }),
60
53
  params: params,
61
54
  opts: opts
62
55
  )
@@ -65,7 +58,61 @@ module Stripe
65
58
  def verify_microdeposits(params = {}, opts = {})
66
59
  request_stripe_object(
67
60
  method: :post,
68
- path: resource_url + "/verify_microdeposits",
61
+ path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }),
62
+ params: params,
63
+ opts: opts
64
+ )
65
+ end
66
+
67
+ def self.apply_customer_balance(intent, params = {}, opts = {})
68
+ request_stripe_object(
69
+ method: :post,
70
+ path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }),
71
+ params: params,
72
+ opts: opts
73
+ )
74
+ end
75
+
76
+ def self.cancel(intent, params = {}, opts = {})
77
+ request_stripe_object(
78
+ method: :post,
79
+ path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }),
80
+ params: params,
81
+ opts: opts
82
+ )
83
+ end
84
+
85
+ def self.capture(intent, params = {}, opts = {})
86
+ request_stripe_object(
87
+ method: :post,
88
+ path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }),
89
+ params: params,
90
+ opts: opts
91
+ )
92
+ end
93
+
94
+ def self.confirm(intent, params = {}, opts = {})
95
+ request_stripe_object(
96
+ method: :post,
97
+ path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }),
98
+ params: params,
99
+ opts: opts
100
+ )
101
+ end
102
+
103
+ def self.increment_authorization(intent, params = {}, opts = {})
104
+ request_stripe_object(
105
+ method: :post,
106
+ path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }),
107
+ params: params,
108
+ opts: opts
109
+ )
110
+ end
111
+
112
+ def self.verify_microdeposits(intent, params = {}, opts = {})
113
+ request_stripe_object(
114
+ method: :post,
115
+ path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }),
69
116
  params: params,
70
117
  opts: opts
71
118
  )
@@ -9,12 +9,19 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "payment_link"
11
11
 
12
- custom_method :list_line_items, http_verb: :get, http_path: "line_items"
13
-
14
12
  def list_line_items(params = {}, opts = {})
15
13
  request_stripe_object(
16
14
  method: :get,
17
- path: resource_url + "/line_items",
15
+ path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(self["id"]) }),
16
+ params: params,
17
+ opts: opts
18
+ )
19
+ end
20
+
21
+ def self.list_line_items(payment_link, params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :get,
24
+ path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(payment_link) }),
18
25
  params: params,
19
26
  opts: opts
20
27
  )
@@ -9,13 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "payment_method"
11
11
 
12
- custom_method :attach, http_verb: :post
13
- custom_method :detach, http_verb: :post
14
-
15
12
  def attach(params = {}, opts = {})
16
13
  request_stripe_object(
17
14
  method: :post,
18
- path: resource_url + "/attach",
15
+ path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(self["id"]) }),
19
16
  params: params,
20
17
  opts: opts
21
18
  )
@@ -24,7 +21,25 @@ module Stripe
24
21
  def detach(params = {}, opts = {})
25
22
  request_stripe_object(
26
23
  method: :post,
27
- path: resource_url + "/detach",
24
+ path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(self["id"]) }),
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.attach(payment_method, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: format("/v1/payment_methods/%<payment_method>s/attach", { payment_method: CGI.escape(payment_method) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.detach(payment_method, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: format("/v1/payment_methods/%<payment_method>s/detach", { payment_method: CGI.escape(payment_method) }),
28
43
  params: params,
29
44
  opts: opts
30
45
  )
@@ -9,13 +9,10 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "payout"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :reverse, http_verb: :post
14
-
15
12
  def cancel(params = {}, opts = {})
16
13
  request_stripe_object(
17
14
  method: :post,
18
- path: resource_url + "/cancel",
15
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(self["id"]) }),
19
16
  params: params,
20
17
  opts: opts
21
18
  )
@@ -24,7 +21,25 @@ module Stripe
24
21
  def reverse(params = {}, opts = {})
25
22
  request_stripe_object(
26
23
  method: :post,
27
- path: resource_url + "/reverse",
24
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
25
+ params: params,
26
+ opts: opts
27
+ )
28
+ end
29
+
30
+ def self.cancel(payout, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ def self.reverse(payout, params = {}, opts = {})
40
+ request_stripe_object(
41
+ method: :post,
42
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
28
43
  params: params,
29
44
  opts: opts
30
45
  )