File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ class Scaffold:
1010 # These are the constants that all scaffolds are expected to return
1111 # to a multi-psp application. They might look like those actually returned
1212 # by the psp itself, but that would be a pure coincidence.
13+ # At some point we could discuss merging cancelled & refused & error and just
14+ # ensuring good error messages are returned. I doubt the distinction is
15+ # important to most checkout procedures.
1316 PAYMENT_STATUS_ACCEPTED = 'ACCEPTED'
1417 PAYMENT_STATUS_CANCELLED = 'CANCELLED'
1518 PAYMENT_STATUS_REFUSED = 'REFUSED'
Original file line number Diff line number Diff line change 2323
2424class TestAdyenPaymentRedirects (TestCase ):
2525 """
26- Test case that tests Adyen payment redirects (user redirected from Adyen to us)
26+ Test case that tests Adyen payment redirects (user redirected from Adyen to us).
27+
28+ Note that notifications and redirects are pretty similar and share a lot of
29+ common code. So those tests will actually test a lot of code for notifications
30+ as well. In an ideal world, we'd split things up to check the shared code individually.
2731 """
2832
2933 def test_handle_authorised_payment (self ):
@@ -129,6 +133,15 @@ def test_handle_refused_payment(self):
129133 assert AdyenTransaction .objects .filter (status = 'REFUSED' ).count () == 1
130134
131135 def test_signing_is_enforced (self ):
136+ """
137+ Test that the supplied signature (in field merchantSig) is checked and
138+ notifications are ignored when the signature doesn't match.
139+
140+ In an ideal world, our other tests would ignore the signature checking
141+ because it's annoying to have to alter the sig when altering the fake
142+ data. Maik gets valid signatures by adding a print(expected_hash) to
143+ PaymentRedirection.validate.
144+ """
132145 fake_signature = copy (AUTHORISED_PAYMENT_PARAMS_GET )
133146 fake_signature ['merchantSig' ] = '14M4N3V1LH4X0RZ'
134147 signature_none = copy (AUTHORISED_PAYMENT_PARAMS_GET )
You can’t perform that action at this time.
0 commit comments