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 #766

Merged
merged 4 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stripe/api_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from stripe.api_resources.order import Order
from stripe.api_resources.order_return import OrderReturn
from stripe.api_resources.payment_intent import PaymentIntent
from stripe.api_resources.payment_link import PaymentLink
from stripe.api_resources.payment_method import PaymentMethod
from stripe.api_resources.payout import Payout
from stripe.api_resources.person import Person
Expand Down
25 changes: 25 additions & 0 deletions stripe/api_resources/payment_link.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function

from stripe import util
from stripe.api_resources.abstract import CreateableAPIResource
from stripe.api_resources.abstract import ListableAPIResource
from stripe.api_resources.abstract import UpdateableAPIResource
from stripe.api_resources.abstract import custom_method


@custom_method("list_line_items", http_verb="get", http_path="line_items")
class PaymentLink(
CreateableAPIResource,
ListableAPIResource,
UpdateableAPIResource,
):
OBJECT_NAME = "payment_link"

def list_line_items(self, idempotency_key=None, **params):
url = self.instance_url() + "/line_items"
headers = util.populate_headers(idempotency_key)
resp = self.request("get", url, params, headers)
stripe_object = util.convert_to_stripe_object(resp)
stripe_object._retrieve_params = params
return stripe_object
1 change: 1 addition & 0 deletions stripe/object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
api_resources.Order.OBJECT_NAME: api_resources.Order,
api_resources.OrderReturn.OBJECT_NAME: api_resources.OrderReturn,
api_resources.PaymentIntent.OBJECT_NAME: api_resources.PaymentIntent,
api_resources.PaymentLink.OBJECT_NAME: api_resources.PaymentLink,
api_resources.PaymentMethod.OBJECT_NAME: api_resources.PaymentMethod,
api_resources.Payout.OBJECT_NAME: api_resources.Payout,
api_resources.Person.OBJECT_NAME: api_resources.Person,
Expand Down
24 changes: 24 additions & 0 deletions tests/test_generated_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,3 +1601,27 @@ def test_checkout_session_create2(self, request_mock):
],
)
request_mock.assert_requested("post", "/v1/checkout/sessions")

def test_paymentintent_create2(self, request_mock):
Copy link
Contributor

Choose a reason for hiding this comment

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

what's that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A codegenned test from a previous release that didn't affect the stripe-python implementation.

stripe.PaymentIntent.create(
amount=1099,
currency="eur",
automatic_payment_methods={"enabled": True},
)
request_mock.assert_requested("post", "/v1/payment_intents")

def test_paymentlink_create(self, request_mock):
stripe.PaymentLink.create(
line_items=[{"price": "price_xxxxxxxxxxxxx", "quantity": 1}],
)
request_mock.assert_requested("post", "/v1/payment_links")

def test_paymentlink_list_line_items(self, request_mock):
stripe.PaymentLink.list_line_items("pl_xyz")
request_mock.assert_requested(
"get", "/v1/payment_links/pl_xyz/line_items"
)

def test_paymentlink_retrieve(self, request_mock):
stripe.PaymentLink.retrieve("pl_xyz")
request_mock.assert_requested("get", "/v1/payment_links/pl_xyz")