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

Unify request sending and result parsing logic #832

Conversation

pakrym-stripe
Copy link
Contributor

@pakrym-stripe pakrym-stripe commented Jun 30, 2022

Unify request sending logic into a single method and call it from all the places we make requests from.

@pakrym-stripe pakrym-stripe changed the base branch from master to sdk-release/next-major July 1, 2022 21:53
pakrym-stripe and others added 4 commits July 1, 2022 15:00
…ng_and_result_parsing_logic

# Conflicts:
#	stripe/api_resources/account.py
#	stripe/api_resources/apps/secret.py
#	stripe/api_resources/charge.py
#	stripe/api_resources/checkout/session.py
#	stripe/api_resources/credit_note.py
#	stripe/api_resources/customer.py
#	stripe/api_resources/dispute.py
#	stripe/api_resources/financial_connections/account.py
#	stripe/api_resources/identity/verification_session.py
#	stripe/api_resources/invoice.py
#	stripe/api_resources/issuing/authorization.py
#	stripe/api_resources/issuing/card.py
#	stripe/api_resources/issuing/dispute.py
#	stripe/api_resources/order.py
#	stripe/api_resources/payment_intent.py
#	stripe/api_resources/payment_link.py
#	stripe/api_resources/payment_method.py
#	stripe/api_resources/payout.py
#	stripe/api_resources/quote.py
#	stripe/api_resources/refund.py
#	stripe/api_resources/review.py
#	stripe/api_resources/setup_intent.py
#	stripe/api_resources/subscription_schedule.py
#	stripe/api_resources/terminal/reader.py
#	stripe/api_resources/test_helpers/test_clock.py
#	stripe/api_resources/topup.py
#	stripe/api_resources/transfer.py
#	stripe/api_resources/treasury/financial_account.py
#	stripe/api_resources/treasury/inbound_transfer.py
#	stripe/api_resources/treasury/outbound_payment.py
#	stripe/api_resources/treasury/outbound_transfer.py
#	stripe/api_resources/treasury/received_credit.py
#	stripe/api_resources/treasury/received_debit.py
#	tests/test_generated_examples.py
@pakrym-stripe pakrym-stripe changed the title [WIP] Unify request sending and result parsing logic Unify request sending and result parsing logic Jul 11, 2022
@pakrym-stripe
Copy link
Contributor Author

r? @dcr-stripe

Copy link
Contributor

@dcr-stripe dcr-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall! Just one comment!

Comment on lines +242 to +243
method_,
url_,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Why the _ suffix here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah just saw https://github.com/stripe/stripe-python/pull/832/files#diff-4656b48a9a21bc574de7c8bfb7e0aaa00241eb172da79110b30d6615685b64f3R101-R102 - can we carry over that comment here + in api_resource so we don't accidentally remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@pakrym-stripe
Copy link
Contributor Author

Removed some outdated tests for APIs that were removed from the next major.

r? @dcr-stripe

…ng_and_result_parsing_logic

# Conflicts:
#	stripe/api_resources/checkout/session.py
#	stripe/api_resources/credit_note.py
#	stripe/api_resources/invoice.py
#	stripe/api_resources/source.py
Copy link
Contributor

@dcr-stripe dcr-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@pakrym-stripe pakrym-stripe merged commit 15595c6 into sdk-release/next-major Jul 12, 2022
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Aug 19, 2022
4.0.2 - 2022-08-03
* Fix issue where auto_paging_iter failed on nested list objects.

4.0.1 - 2022-08-02
* Fix incorrect handling of additional request parameters
  * Fixes issue where using special parameter like `api_key`, `idempotency_key`, `stripe_version`, `stripe_account`, `headers` can cause a `Received unknown parameter error`.

4.0.0 - 2022-08-02

Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the SDK, read more detailed description at https://github.com/stripe/stripe-python/wiki/Migration-guide-for-v4. For changes to the Stripe products, read more at https://stripe.com/docs/upgrades#2022-08-01.

"⚠️" symbol highlights breaking changes.

* API Updates
* Next major release changes
* API Updates. Add Price.create tests.
* API Updates. Use auto-generation for credit_note and invoice methods.

⚠️ Removed
- Removed deprecated `AlipayAccount`, `BitcoinReceiver`, `BitcoinTransaction`, `IssuerFraudRecord`, `Recipient`, `RecipientTransfer`, and  `ThreeDSecure` classes.
- Removed deprecated `Charge.update_dispute` and `Charge.close_dispute` methods that were using legacy REST API endpoint. Prefer [Dispute.modify](https://stripe.com/docs/api/disputes/update?lang=python) and [Dispute.close](https://stripe.com/docs/api/disputes/close?lang=python)
- Removed deprecated `Card.details` method and `CardDetails` resource. The REST API endpoint is not longer supported.
- Removed the deprecated `Source.source_transactions` method. Prefer `SubscriptionItem.list_source_transactions`
- Removed the deprecated `SubscriptionItem.usage_record_summaries` method. Prefer `SubscriptionItem.list_usage_record_summaries`
- Removed the deprecated `Charge.refund` method. Prefer [Refund.create](https://stripe.com/docs/api/refunds/create)

⚠️ Changed
- To be consistent with other resource methods, `ApplicationFee.refund` returns an instance of `ApplicationFee` and doesn't mutate the instance of `ApplicationFee`.
- To be consistent with other resource methods, the `Customer.delete_discount` no longer resets the `discount` property to `None` and returns the deleted discount instead. If you were relying on this behavior, reset the discount property manually:
- The `LineItem` resource now inherits from `StripeObject` as it has no methods of it's own.
- To be consistent with other resource methods, the `Subscription.delete_discount` returns an instance of deleted discount and doesn't mutate the instance of `Subscription`.
- Update the CA certificate bundle.
- Request sending logic unified across standard and custom methods (stripe/stripe-python#832)
@remi-stripe remi-stripe deleted the pakrym/Unify_request_sending_and_result_parsing_logic branch September 28, 2023 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants