Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: Receipt page modify payment method to display DPM
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed Apr 9, 2024
1 parent 7ec5d77 commit 71ac11b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ecommerce/extensions/checkout/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,16 @@ def test_get_payment_method_credit_card_purchase(self):
payment_method = ReceiptResponseView().get_payment_method(order)
self.assertEqual(payment_method, '{} {}'.format(source.card_type, source.label))

def test_get_payment_method_stripe_dynamic_payment_methods_purchase(self):
"""
Dynamic Payment Method type (source label) should be displayed as the Payment method
when Stripe DPM was used to purchase a product.
"""
order = self.create_order()
source = factories.SourceFactory(order=order, card_type=None, label='Stripe affirm')
payment_method = ReceiptResponseView().get_payment_method(order)
self.assertEqual(payment_method, source.label)

@patch('ecommerce.extensions.checkout.views.fetch_enterprise_learner_data')
@responses.activate
def test_get_receipt_for_existing_order(self, mock_learner_data):
Expand Down
2 changes: 2 additions & 0 deletions ecommerce/extensions/checkout/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def get_payment_method(self, order):
type=source.get_card_type_display(),
number=source.label
)
elif source.label:
return source.label
return source.source_type.name
return None

Expand Down

0 comments on commit 71ac11b

Please sign in to comment.