Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates for beta branch #1093

Merged
merged 10 commits into from
Jul 7, 2022
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction`
* Add support for `retrieve_payment_method` method on resource `Customer`
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`



## 6.0.0 - 2022-05-09
* [#1056](https://github.com/stripe/stripe-ruby/pull/1056) API Updates
Expand All @@ -45,7 +43,6 @@
## 5.55.0 - 2022-05-05
* [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`


## 5.54.0 - 2022-05-03
* [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
Expand Down Expand Up @@ -1076,3 +1073,4 @@ Identical to 1.56.0 above. I incorrectly cut a patch-level release.
<!--
# vim: set tw=0:
-->

2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v161
v163
2 changes: 1 addition & 1 deletion lib/stripe/api_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

module Stripe
module ApiVersion
CURRENT = "2020-08-27"
CURRENT = "2020-08-27; server_side_confirmation_beta=v1"
end
end
16 changes: 8 additions & 8 deletions lib/stripe/resources/credit_note.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ def void_credit_note(params = {}, opts = {})
)
end

def self.void_credit_note(id, params = {}, opts = {})
def self.list_preview_line_items(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
method: :get,
path: "/v1/credit_notes/preview/lines",
params: params,
opts: opts
)
end

def self.preview(params, opts = {})
def self.preview(params = {}, opts = {})
request_stripe_object(
method: :get,
path: resource_url + "/preview",
path: "/v1/credit_notes/preview",
params: params,
opts: opts
)
end

def self.list_preview_line_items(params, opts = {})
def self.void_credit_note(id, params = {}, opts = {})
request_stripe_object(
method: :get,
path: resource_url + "/preview/lines",
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
params: params,
opts: opts
)
Expand Down
3 changes: 1 addition & 2 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ def self.retrieve_payment_method(
)
end

custom_method :delete_discount, http_verb: :delete, http_path: "discount"

save_nested_resource :source
nested_resource_class_methods :source,
operations: %i[create retrieve update delete list]
Expand All @@ -87,6 +85,7 @@ def self.retrieve_payment_method(
class << self
alias detach_source delete_source
end
custom_method :delete_discount, http_verb: :delete, http_path: "discount"

# Deletes a discount associated with the customer.
#
Expand Down
28 changes: 14 additions & 14 deletions lib/stripe/resources/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,55 +65,55 @@ def self.finalize_invoice(invoice, params = {}, opts = {})
)
end

def self.mark_uncollectible(invoice, params = {}, opts = {})
def self.list_upcoming_line_items(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(invoice) }),
method: :get,
path: "/v1/invoices/upcoming/lines",
params: params,
opts: opts
)
end

def self.pay(invoice, params = {}, opts = {})
def self.mark_uncollectible(invoice, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(invoice) }),
path: format("/v1/invoices/%<invoice>s/mark_uncollectible", { invoice: CGI.escape(invoice) }),
params: params,
opts: opts
)
end

def self.send_invoice(invoice, params = {}, opts = {})
def self.pay(invoice, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(invoice) }),
path: format("/v1/invoices/%<invoice>s/pay", { invoice: CGI.escape(invoice) }),
params: params,
opts: opts
)
end

def self.void_invoice(invoice, params = {}, opts = {})
def self.send_invoice(invoice, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
path: format("/v1/invoices/%<invoice>s/send", { invoice: CGI.escape(invoice) }),
params: params,
opts: opts
)
end

def self.upcoming(params, opts = {})
def self.upcoming(params = {}, opts = {})
request_stripe_object(
method: :get,
path: resource_url + "/upcoming",
path: "/v1/invoices/upcoming",
params: params,
opts: opts
)
end

def self.list_upcoming_line_items(params, opts = {})
def self.void_invoice(invoice, params = {}, opts = {})
request_stripe_object(
method: :get,
path: resource_url + "/upcoming/lines",
method: :post,
path: format("/v1/invoices/%<invoice>s/void", { invoice: CGI.escape(invoice) }),
params: params,
opts: opts
)
Expand Down
21 changes: 21 additions & 0 deletions test/stripe/generated_examples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,12 @@ class CodegennedExampleTest < Test::Unit::TestCase
assert_requested :post, "#{Stripe.api_base}/v1/invoices/in_xxxxxxxxxxxxx/send?"
end
end
context "Invoice.upcoming" do
should "support requests with args: customer" do
Stripe::Invoice.upcoming({ customer: "cus_9utnxg47pWjV1e" })
assert_requested :get, "#{Stripe.api_base}/v1/invoices/upcoming?customer=cus_9utnxg47pWjV1e"
end
end
context "Invoice.update" do
should "support requests with args: metadata, id" do
Stripe::Invoice.update(
Expand Down Expand Up @@ -1401,6 +1407,21 @@ class CodegennedExampleTest < Test::Unit::TestCase
end
end
context "Price.create" do
should "support requests with args: unit_amount, currency, currency_options, recurring, product" do
Stripe::Price.create(
{
unit_amount: 2000,
currency: "usd",
currency_options: {
uah: { unit_amount: 5000 },
eur: { unit_amount: 1800 },
},
recurring: { interval: "month" },
product: "prod_xxxxxxxxxxxxx",
}
)
assert_requested :post, "#{Stripe.api_base}/v1/prices"
end
should "support requests with args: unit_amount, currency, recurring, product" do
Stripe::Price.create(
{
Expand Down