File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -264,12 +264,14 @@ public function generateUUIDv4()
264
264
* Returns a hashed string and defines a default through the sAlgorithm parameter
265
265
*
266
266
* @param string $sString
267
+ * @param string $sAlgorithm
268
+ * @param string $sKey
267
269
* @return string
268
270
*/
269
271
public function hashString ($ sString , $ sAlgorithm = 'sha384 ' , $ sKey = false )
270
272
{
271
273
if ($ sAlgorithm == "sha384 " && $ sKey !== false ) {
272
- return hash_hmac ($ sAlgorithm , $ sString , $ sKey );
274
+ return hash_hmac ($ sAlgorithm , $ sString , $ sKey ?? '' );
273
275
}
274
276
return hash ($ sAlgorithm , $ sString );
275
277
}
Original file line number Diff line number Diff line change @@ -140,11 +140,22 @@ public function testRefreshProfiles()
140
140
{
141
141
$ aShopConfig = [['shop_id ' => '12345 ' , 'currency ' => 'EUR ' ]];
142
142
$ this ->scopeConfig ->method ('getValue ' )->willReturn (json_encode ($ aShopConfig ));
143
+ $ this ->profile ->method ('sendRequest ' )->willReturn (['status ' => 'OK ' ]);
143
144
144
145
$ result = $ this ->classToTest ->refreshProfiles ('payone_ratepay_invoice ' );
145
146
$ this ->assertNull ($ result );
146
147
}
147
148
149
+ public function testRefreshProfilesException ()
150
+ {
151
+ $ aShopConfig = [['shop_id ' => '12345 ' , 'currency ' => 'EUR ' ]];
152
+ $ this ->scopeConfig ->method ('getValue ' )->willReturn (json_encode ($ aShopConfig ));
153
+ $ this ->profile ->method ('sendRequest ' )->willReturn (['status ' => 'ERROR ' ]);
154
+
155
+ $ this ->expectException (\Exception::class);
156
+ $ this ->classToTest ->refreshProfiles ('payone_ratepay_invoice ' );
157
+ }
158
+
148
159
public function testGetRatepayDeviceFingerprintToken ()
149
160
{
150
161
$ this ->checkoutSession ->method ('getPayoneRatepayDeviceFingerprintToken ' )->willReturn (null );
You can’t perform that action at this time.
0 commit comments