File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 44import hmac
55import hashlib
66import binascii
7+ import copy
8+
79
810
911def generate_notification_sig (dict_object , hmac_key ):
@@ -35,7 +37,7 @@ def generate_notification_sig(dict_object, hmac_key):
3537
3638
3739def is_valid_hmac_notification (dict_object , hmac_key ):
38- dict_object = dict_object . copy ()
40+ dict_object = copy . deepcopy ( dict_object )
3941
4042 if 'notificationItems' in dict_object :
4143 dict_object = dict_object ['notificationItems' ][0 ]['NotificationRequestItem' ]
Original file line number Diff line number Diff line change @@ -107,4 +107,29 @@ def test_custom_version(self):
107107 headers = {'adyen-library-name' : settings .LIB_NAME , 'adyen-library-version' : settings .LIB_VERSION },
108108 json = request ,
109109 xapikey = "YourXapikey"
110- )
110+ )
111+
112+ def test_is_valid_hmac_notification_removes_additional_data (self ):
113+ notification = {
114+ "live" :"false" ,
115+ "notificationItems" :[
116+ {
117+ "NotificationRequestItem" :{
118+ "additionalData" :{
119+ "hmacSignature" :"11aa" ,
120+ "fraudResultType" :"GREEN" ,
121+ "fraudManualReview" : "false" ,
122+ "totalFraudScore" :"75"
123+ },
124+ "amount" :{
125+ "currency" :"USD" ,
126+ "value" :10000
127+ },
128+ "success" :"true"
129+
130+ }
131+ }
132+ ]}
133+ is_valid_hmac_notification (notification , "11aa" )
134+ self .assertIsNotNone (notification ['notificationItems' ][0 ]['NotificationRequestItem' ]['additionalData' ])
135+
You can’t perform that action at this time.
0 commit comments