Skip to content

Commit

Permalink
API Updates for beta branch (#931)
Browse files Browse the repository at this point in the history
* Pass params into logger.{info,debug} (#913)

* Pass params into logger.{info,debug}

* API Updates (#920)

* Codegen for openapi v223

* Bump version to 5.1.0

* Revert "Pass params into logger.{info,debug} (#913)" (#923)

This reverts commit c45cc1d.

* Bump version to 5.1.1

* Codegen for openapi v225

* Bump version to 5.2.0

* Set version to 5.2.0 to simplify merge

* Reset version to 5.2.0b1

* Codegen for openapi v232

* Format

---------

Co-authored-by: Annie Li <anniel@stripe.com>
Co-authored-by: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 24, 2023
1 parent be2da42 commit bc3ba70
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 48 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
@@ -1,11 +1,18 @@
# Changelog

## 5.2.0 - 2023-02-16
* [#924](https://github.com/stripe/stripe-python/pull/924) API Updates
* Add support for `refund_payment` method on resource `Terminal.Reader`

## 5.2.0b1 - 2023-02-02
* [#921](https://github.com/stripe/stripe-python/pull/921) API Updates for beta branch
* Updated stable APIs to the latest version
* Add support for new resource `FinancialConnections.Transaction`
* Add support for `list` method on resource `Transaction`

## 5.1.1 - 2023-02-06
* [#923](https://github.com/stripe/stripe-python/pull/923) Bugfix: revert "Pass params into logger.{info,debug}"

## 5.1.0 - 2023-02-02
* [#920](https://github.com/stripe/stripe-python/pull/920) API Updates
* Add support for `resume` method on resource `Subscription`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
@@ -1 +1 @@
v223
v232
10 changes: 6 additions & 4 deletions stripe/api_resources/account.py
Expand Up @@ -35,11 +35,13 @@ class Account(
):
"""
This is an object representing a Stripe account. You can retrieve it to see
properties on the account like its current e-mail address or if the account is
enabled yet to make live charges.
properties on the account like its current requirements or if the account is
enabled to make live charges or receive payouts.
Some properties, marked below, are available only to platforms that want to
[create and manage Express or Custom accounts](https://stripe.com/docs/connect/accounts).
For Custom accounts, the properties below are always returned. For other accounts, some properties are returned until that
account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links)
for a Standard or Express account, some parameters are no longer returned. These are marked as **Custom Only** or **Custom and Express**
below. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts).
"""

OBJECT_NAME = "account"
Expand Down
4 changes: 2 additions & 2 deletions stripe/api_resources/checkout/session.py
Expand Up @@ -19,8 +19,8 @@ class Session(CreateableAPIResource, ListableAPIResource):
[PaymentIntent](https://stripe.com/docs/api/payment_intents) or an active
[Subscription](https://stripe.com/docs/api/subscriptions).
You can create a Checkout Session on your server and pass its ID to the
client to begin Checkout.
You can create a Checkout Session on your server and redirect to its URL
to begin Checkout.
Related guide: [Checkout Quickstart](https://stripe.com/docs/checkout/quickstart).
"""
Expand Down
16 changes: 10 additions & 6 deletions stripe/api_resources/invoice_item.py
Expand Up @@ -15,13 +15,17 @@ class InvoiceItem(
UpdateableAPIResource,
):
"""
Sometimes you want to add a charge or credit to a customer, but actually
charge or credit the customer's card only at the end of a regular billing
cycle. This is useful for combining several charges (to minimize
per-transaction fees), or for having Stripe tabulate your usage-based billing
totals.
Invoice Items represent the component lines of an [invoice](https://stripe.com/docs/api/invoices). An invoice item is added to an
invoice by creating or updating it with an `invoice` field, at which point it will be included as
[an invoice line item](https://stripe.com/docs/api/invoices/line_item) within
[invoice.lines](https://stripe.com/docs/api/invoices/object#invoice_object-lines).
Related guide: [Subscription Invoices](https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items).
Invoice Items can be created before you are ready to actually send the invoice. This can be particularly useful when combined
with a [subscription](https://stripe.com/docs/api/subscriptions). Sometimes you want to add a charge or credit to a customer, but actually charge
or credit the customer's card only at the end of a regular billing cycle. This is useful for combining several charges
(to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals.
Related guides: [Integrate with the Invoicing API](https://stripe.com/docs/invoicing/integration), [Subscription Invoices](https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items).
"""

OBJECT_NAME = "invoiceitem"
95 changes: 60 additions & 35 deletions tests/test_generated_examples.py
Expand Up @@ -489,17 +489,6 @@ def test_account_capability_update(self, request_mock):
"/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments",
)

def test_subscription_resume(self, request_mock):
stripe.Subscription.resume(
"sub_xxxxxxxxxxxxx",
proration_date=1675400000,
proration_behavior="always_invoice",
)
request_mock.assert_requested(
"post",
"/v1/subscriptions/sub_xxxxxxxxxxxxx/resume",
)

def test_account_person_retrieve(self, request_mock):
stripe.Account.retrieve_person(
"acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx"
Expand Down Expand Up @@ -552,6 +541,10 @@ def test_applicationfee_feerefund_update(self, request_mock):
"/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx",
)

def test_apps_secret_list2(self, request_mock):
stripe.apps.Secret.list(scope={"type": "account"}, limit=2)
request_mock.assert_requested("get", "/v1/apps/secrets")

def test_apps_secret_create2(self, request_mock):
stripe.apps.Secret.create(
name="my-api-key",
Expand Down Expand Up @@ -631,7 +624,7 @@ def test_charge_create(self, request_mock):
amount=2000,
currency="usd",
source="tok_xxxx",
description="My First Test Charge (created for API docs)",
description="My First Test Charge (created for API docs at https://www.stripe.com/docs/api)",
)
request_mock.assert_requested("post", "/v1/charges")

Expand Down Expand Up @@ -663,7 +656,6 @@ def test_checkout_session_list(self, request_mock):
def test_checkout_session_create2(self, request_mock):
stripe.checkout.Session.create(
success_url="https://example.com/success",
cancel_url="https://example.com/cancel",
line_items=[{"price": "price_xxxxxxxxxxxxx", "quantity": 2}],
mode="payment",
)
Expand Down Expand Up @@ -762,7 +754,7 @@ def test_customer_list2(self, request_mock):

def test_customer_create(self, request_mock):
stripe.Customer.create(
description="My First Test Customer (created for API docs)",
description="My First Test Customer (created for API docs at https://www.stripe.com/docs/api)",
)
request_mock.assert_requested("post", "/v1/customers")

Expand Down Expand Up @@ -895,6 +887,13 @@ def test_financial_connections_account_retrieve2(self, request_mock):
"/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx",
)

def test_financial_connections_account_disconnect2(self, request_mock):
stripe.financial_connections.Account.disconnect("fca_xxxxxxxxxxxxx")
request_mock.assert_requested(
"post",
"/v1/financial_connections/accounts/fca_xxxxxxxxxxxxx/disconnect",
)

def test_financial_connections_account_list_owners2(self, request_mock):
stripe.financial_connections.Account.list_owners(
"fca_xxxxxxxxxxxxx",
Expand Down Expand Up @@ -1031,6 +1030,10 @@ def test_invoice_retrieve(self, request_mock):
stripe.Invoice.retrieve("in_xxxxxxxxxxxxx")
request_mock.assert_requested("get", "/v1/invoices/in_xxxxxxxxxxxxx")

def test_invoice_retrieve2(self, request_mock):
stripe.Invoice.retrieve("in_xxxxxxxxxxxxx", expand=["customer"])
request_mock.assert_requested("get", "/v1/invoices/in_xxxxxxxxxxxxx")

def test_invoice_update(self, request_mock):
stripe.Invoice.modify(
"in_xxxxxxxxxxxxx", metadata={"order_id": "6735"}
Expand Down Expand Up @@ -1239,7 +1242,7 @@ def test_paymentintent_create2(self, request_mock):
stripe.PaymentIntent.create(
amount=2000,
currency="usd",
payment_method_types=["card"],
automatic_payment_methods={"enabled": True},
)
request_mock.assert_requested("post", "/v1/payment_intents")

Expand Down Expand Up @@ -1300,6 +1303,16 @@ def test_paymentintent_increment_authorization(self, request_mock):
"/v1/payment_intents/pi_xxxxxxxxxxxxx/increment_authorization",
)

def test_paymentintent_verify_microdeposits2(self, request_mock):
stripe.PaymentIntent.verify_microdeposits(
"pi_xxxxxxxxxxxxx",
amounts=[32, 45],
)
request_mock.assert_requested(
"post",
"/v1/payment_intents/pi_xxxxxxxxxxxxx/verify_microdeposits",
)

def test_paymentintent_search(self, request_mock):
stripe.PaymentIntent.search(
query="status:'succeeded' AND metadata['order_id']:'6735'",
Expand Down Expand Up @@ -1339,8 +1352,8 @@ def test_paymentmethod_create(self, request_mock):
type="card",
card={
"number": "4242424242424242",
"exp_month": 5,
"exp_year": 2023,
"exp_month": 8,
"exp_year": 2024,
"cvc": "314",
},
)
Expand Down Expand Up @@ -1745,6 +1758,16 @@ def test_setupintent_confirm(self, request_mock):
"/v1/setup_intents/seti_xxxxxxxxxxxxx/confirm",
)

def test_setupintent_verify_microdeposits2(self, request_mock):
stripe.SetupIntent.verify_microdeposits(
"seti_xxxxxxxxxxxxx",
amounts=[32, 45],
)
request_mock.assert_requested(
"post",
"/v1/setup_intents/seti_xxxxxxxxxxxxx/verify_microdeposits",
)

def test_shippingrate_list2(self, request_mock):
stripe.ShippingRate.list(limit=3)
request_mock.assert_requested("get", "/v1/shipping_rates")
Expand Down Expand Up @@ -1841,7 +1864,7 @@ def test_subscriptionschedule_list(self, request_mock):
def test_subscriptionschedule_create(self, request_mock):
stripe.SubscriptionSchedule.create(
customer="cus_xxxxxxxxxxxxx",
start_date=1652909005,
start_date=1676070661,
end_behavior="release",
phases=[
{
Expand Down Expand Up @@ -1997,8 +2020,9 @@ def test_terminal_location_create(self, request_mock):
address={
"line1": "1234 Main Street",
"city": "San Francisco",
"country": "US",
"postal_code": "94111",
"state": "CA",
"country": "US",
},
)
request_mock.assert_requested("post", "/v1/terminal/locations")
Expand Down Expand Up @@ -2077,6 +2101,17 @@ def test_terminal_reader_process_payment_intent(self, request_mock):
"/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_payment_intent",
)

def test_terminal_reader_process_setup_intent(self, request_mock):
stripe.terminal.Reader.process_setup_intent(
"tmr_xxxxxxxxxxxxx",
setup_intent="seti_xxxxxxxxxxxxx",
customer_consent_collected=True,
)
request_mock.assert_requested(
"post",
"/v1/terminal/readers/tmr_xxxxxxxxxxxxx/process_setup_intent",
)

def test_test_helpers_testclock_list2(self, request_mock):
stripe.test_helpers.TestClock.list(limit=3)
request_mock.assert_requested("get", "/v1/test_helpers/test_clocks")
Expand All @@ -2102,7 +2137,7 @@ def test_test_helpers_testclock_retrieve2(self, request_mock):
def test_test_helpers_testclock_advance2(self, request_mock):
stripe.test_helpers.TestClock.advance(
"clock_xxxxxxxxxxxxx",
frozen_time=1652390605,
frozen_time=1675552261,
)
request_mock.assert_requested(
"post",
Expand Down Expand Up @@ -2298,16 +2333,6 @@ def test_treasury_financialaccount_retrieve_features(self, request_mock):
"/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features",
)

def test_treasury_financialaccount_update_features(self, request_mock):
stripe.treasury.FinancialAccount.update_features(
"fa_xxxxxxxxxxxxx",
card_issuing={"requested": False},
)
request_mock.assert_requested(
"post",
"/v1/treasury/financial_accounts/fa_xxxxxxxxxxxxx/features",
)

def test_treasury_inboundtransfer_list(self, request_mock):
stripe.treasury.InboundTransfer.list(
financial_account="fa_xxxxxxxxxxxxx",
Expand Down Expand Up @@ -2351,24 +2376,24 @@ def test_treasury_outboundpayment_create(self, request_mock):
financial_account="fa_xxxxxxxxxxxxx",
amount=10000,
currency="usd",
customer="cu_xxxxxxxxxxxxx",
customer="cus_xxxxxxxxxxxxx",
destination_payment_method="pm_xxxxxxxxxxxxx",
description="OutboundPayment to a 3rd party",
)
request_mock.assert_requested("post", "/v1/treasury/outbound_payments")

def test_treasury_outboundpayment_retrieve(self, request_mock):
stripe.treasury.OutboundPayment.retrieve("obp_xxxxxxxxxxxxx")
stripe.treasury.OutboundPayment.retrieve("bot_xxxxxxxxxxxxx")
request_mock.assert_requested(
"get",
"/v1/treasury/outbound_payments/obp_xxxxxxxxxxxxx",
"/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx",
)

def test_treasury_outboundpayment_cancel(self, request_mock):
stripe.treasury.OutboundPayment.cancel("obp_xxxxxxxxxxxxx")
stripe.treasury.OutboundPayment.cancel("bot_xxxxxxxxxxxxx")
request_mock.assert_requested(
"post",
"/v1/treasury/outbound_payments/obp_xxxxxxxxxxxxx/cancel",
"/v1/treasury/outbound_payments/bot_xxxxxxxxxxxxx/cancel",
)

def test_treasury_outboundtransfer_list(self, request_mock):
Expand Down

0 comments on commit bc3ba70

Please sign in to comment.