Skip to content

Commit 63fbd4e

Browse files
diegomaranhaorenzon
authored andcommitted
Sending only bootcamp data to Hotzapp
close #
1 parent d863712 commit 63fbd4e

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

‎pythonpro/domain/checkout_domain.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,18 @@ def payment_handler_task(payment_id):
6161
else:
6262
email_marketing_facade.remove_tags.delay(user.email, user.id, f'{slug}-refused')
6363
_promote(user, slug)
64-
send_purchase_notification.delay(payment.id)
64+
if slug.startswith('bootcamp'):
65+
send_purchase_notification.delay(payment.id)
6566
elif status == django_pagarme_facade.REFUSED:
6667
user = payment.user
6768
email_marketing_facade.tag_as.delay(user.email, user.id, f'{slug}-refused')
68-
send_purchase_notification.delay(payment.id)
69+
if slug.startswith('bootcamp'):
70+
send_purchase_notification.delay(payment.id)
6971
elif status == django_pagarme_facade.WAITING_PAYMENT:
7072
user = payment.user
7173
email_marketing_facade.tag_as.delay(user.email, user.id, f'{slug}-boleto')
72-
send_purchase_notification.delay(payment.id)
74+
if slug.startswith('bootcamp'):
75+
send_purchase_notification.delay(payment.id)
7376

7477

7578
def _promote(user, slug: str):

‎pythonpro/domain/tests/test_checkout/test_boleto_generation.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ def test_status_code(resp):
6666
assert resp.status_code == 200
6767

6868

69-
def test_send_purchase_notification(resp, send_purchase_notification_mock):
70-
send_purchase_notification_mock.assert_called_once_with(
71-
django_pagarme_facade.find_payment_by_transaction(TRANSACTION_ID).id
72-
)
69+
def test_send_purchase_notification(resp, send_purchase_notification_mock, active_product_item):
70+
if active_product_item.slug.startswith('bootcamp'):
71+
send_purchase_notification_mock.assert_called_once_with(
72+
django_pagarme_facade.find_payment_by_transaction(TRANSACTION_ID).id
73+
)
7374

7475

7576
def test_user_is_created(resp, django_user_model):

‎pythonpro/domain/tests/test_checkout/test_credit_card_payment.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ def test_status_code(resp, active_product_item):
107107
assert resp.url == reverse('django_pagarme:thanks', kwargs={'slug': active_product_item.slug})
108108

109109

110-
def test_send_purchase_notification(resp, send_purchase_notification_mock):
111-
send_purchase_notification_mock.assert_called_once_with(
112-
django_pagarme_facade.find_payment_by_transaction(TRANSACTION_ID).id
113-
)
110+
def test_send_purchase_notification(resp, send_purchase_notification_mock, active_product_item):
111+
if active_product_item.slug.startswith('bootcamp'):
112+
send_purchase_notification_mock.assert_called_once_with(
113+
django_pagarme_facade.find_payment_by_transaction(TRANSACTION_ID).id
114+
)
114115

115116

116117
def test_user_is_created(resp, django_user_model):

0 commit comments

Comments
 (0)