Commit 2a78116b authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Kazuhiko Shiozaki

fixup! erp5_stripe: Use activity to store stripe session in ERP5

We set the module as a source to acquire roles. Also, we need to store request and response in HTTP Exchange.
parent 9e187b9c
......@@ -6,15 +6,15 @@ stripe_payment_session = portal.stripe_payment_session_module.newContent(
expiration_date=expiration_date,
resource=resource,
source_value=portal.restrictedTraverse(source),
causality=causality
)
causality=causality)
http_exchange = portal.system_event_module.newContent(
portal_type="HTTP Exchange",
title="Create Session",
source_value=context,
follow_up_value=stripe_payment_session,
resource_value=portal.portal_categories.http_exchange_resource.stripe.create_session,
)
request=request, response=response)
http_exchange.confirm()
http_exchange.acknowledge()
......
......@@ -598,6 +598,14 @@ class TestStripePaymentSession(ERP5TypeTestCase):
stripe_payment_session = self.portal.portal_catalog.getResultValue(
portal_type="Stripe Payment Session",
reference=session_id)
http_exchange, = stripe_payment_session.getFollowUpRelatedValueList(portal_type="HTTP Exchange")
self.assertIn("line_items", json.loads(http_exchange.getRequest()))
self.assertEqual({
'status': 'open',
'url': 'https://stripe.url',
'object': 'checkout.session',
'id': 'abc321'
}, json.loads(http_exchange.getResponse()))
self._document_to_delete_list.append(stripe_payment_session)
with responses.RequestsMock() as rsps:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment