-
-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from XaviTorello/feature/add_stripe_billing_e…
…mail Use `Payment.billing_email` as `email` and `receipt_email` for Stripe
- Loading branch information
Showing
3 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ class Payment(Mock): | |
total = 100 | ||
captured_amount = 0 | ||
transaction_id = None | ||
billing_email = "[email protected]" | ||
|
||
def change_status(self, status, message=''): | ||
self.status = status | ||
|
@@ -95,8 +96,30 @@ def test_form_contains_stripe_script(self): | |
form = provider.get_form(payment) | ||
self.assertTrue( | ||
'<script class="stripe-button" data-amount="10000" ' | ||
'data-currency="USD" data-description="payment" data-image="" ' | ||
'data-key="%s" data-name="%s" ' | ||
'data-currency="USD" data-description="payment" data-email="[email protected]" ' | ||
'data-image="" data-key="%s" data-name="%s" ' | ||
'src="https://checkout.stripe.com/checkout.js"></script>' % ( | ||
PUBLIC_KEY, store_name) | ||
in str(form)) | ||
|
||
def test_form_contains_stripe_script_withou_billing_email(self): | ||
""" | ||
If billing email is not set, it should generate the script as expected | ||
""" | ||
payment = Payment() | ||
store_name = 'Test store' | ||
provider = StripeProvider( | ||
name=store_name, | ||
secret_key=SECRET_KEY, public_key=PUBLIC_KEY) | ||
|
||
form = provider.get_form(payment) | ||
|
||
payment.billing_email = None | ||
form = provider.get_form(payment) | ||
self.assertTrue( | ||
'<script class="stripe-button" data-amount="10000" ' | ||
'data-currency="USD" data-description="payment" ' | ||
'data-image="" data-key="%s" data-name="%s" ' | ||
'src="https://checkout.stripe.com/checkout.js"></script>' % ( | ||
PUBLIC_KEY, store_name) | ||
in str(form)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters