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

[STRIPE]: added new action to retrieve a list of customer #1230

Closed
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
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 @@ -74,6 +74,13 @@ def customer_delete(customer_id: str, **kwargs):
return stripe().Customer.delete(customer_id, **kwargs)


@jaseci_action()
def customer_list(**kwargs):
"""retrieve list of customers"""

return stripe().Customer.list(**kwargs)


@jaseci_action()
def payment_method_attach(payment_method_id: str, customer_id: str, **kwargs):
"""retrieve customer list of invoices"""
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 @@ -193,4 +193,11 @@ walker create_billing_portal_session {
customer="cus_O7ECcoZCZFwinb",
return_url="https://example.com/account"
);
}

walker list_customer {
has email="test12@gmail.com", limit=12;
can stripe.customer_list;

stripe.customer_list(email=email, limit=limit);
}
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 @@ -27,6 +27,7 @@ def setUpClass(cls):
stripe.Customer.create = Mock()
stripe.Customer.retrieve = Mock()
stripe.Customer.delete = Mock()
stripe.Customer.list = Mock()
stripe.PaymentMethod.list = Mock()
stripe.PaymentMethod.attach = Mock()
stripe.PaymentMethod.detach = Mock()
Expand Down Expand Up @@ -84,6 +85,10 @@ def test_stripe_get_customer(self, ret):
def test_stripe_delete_customer(self, ret):
stripe.Customer.delete.assert_called_once_with("cus_NBsqL1C1GrrHYM")

@jac_testcase("stripe.jac", "list_customer")
def test_stripe_list_customer(self, ret):
stripe.Customer.list.assert_called_once_with(email="test12@gmail.com", limit=12)

@jac_testcase("stripe.jac", "attach_payment_method")
def test_stripe_attach_payment_method(self, ret):
stripe.PaymentMethod.list.assert_called_once_with(customer="cus_NBsqL1C1GrrHYM")
Expand Down