Skip to content

Commit

Permalink
[STRIPE]: added new action to retrieve subscription item
Browse files Browse the repository at this point in the history
  • Loading branch information
panikingginoo12 authored and ypkang committed Oct 12, 2023
1 parent 97ea65a commit cee102b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jaseci_core/jaseci/extens/act_lib/stripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ def subscription_item_create_usage_record(
)


@jaseci_action()
def subscription_item_retrieve(subscription_item_id: str, **kwargs):
"""retrieve subscription item"""

return stripe().SubscriptionItem.retrieve(subscription_item_id, **kwargs)


@jaseci_action()
def checkout_session_create(success_url: str, mode: str, **kwargs):
return stripe().checkout.Session.create(
Expand Down
7 changes: 7 additions & 0 deletions jaseci_core/jaseci/tests/fixtures/stripe.jac
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ walker list_usage_report {
stripe.subscription_item_list_usage_record_summaries(subscription_item_id, limit=1);
}

walker subscription_item_retrieve {
has subscription_item_id = "si_1MTgMQCZO78n7fsZqu1dk6nD";
can stripe.subscription_item_retrieve;

stripe.subscription_item_retrieve(subscription_item_id);
}

walker create_checkout_session {
has success_url = "https://example.com/success", cancel_url = "https://example.com/cancel", line_items = [{"price": "price_H5ggYwtDq4fbrJ","quantity": 12}], mode = "payment";
can stripe.checkout_session_create;
Expand Down
5 changes: 5 additions & 0 deletions jaseci_core/jaseci/tests/test_stripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def setUpClass(cls):
stripe.Invoice.retrieve = Mock()
stripe.SubscriptionItem.create_usage_record = Mock()
stripe.SubscriptionItem.list_usage_record_summaries = Mock()
stripe.SubscriptionItem.retrieve = Mock()
stripe.checkout.Session.create = Mock()
stripe.billing_portal.Session.create = Mock()

Expand Down Expand Up @@ -204,6 +205,10 @@ def test_stripe_create_usage_report(self, ret):
def test_stripe_list_usage_report(self, ret):
stripe.SubscriptionItem.list_usage_record_summaries.assert_called()

@jac_testcase("stripe.jac", "subscription_item_retrieve")
def test_stripe_subscription_item_retrieve(self, ret):
stripe.SubscriptionItem.retrieve.assert_called()

@jac_testcase("stripe.jac", "create_checkout_session")
def test_stripe_create_checkout_session(self, ret):
stripe.checkout.Session.create.assert_called_once_with(
Expand Down

0 comments on commit cee102b

Please sign in to comment.