Skip to content

Commit

Permalink
Fix knaken signature error (#140)
Browse files Browse the repository at this point in the history
Co-authored-by: Ivascu Madalin <[email protected]>
  • Loading branch information
harli91 and Ivascu Madalin authored Mar 14, 2024
1 parent d0186c8 commit 04afec9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/routes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ buckaroo_refund:
path: buckaroo3/refund
methods: [POST]
defaults:
_controller: 'buckaroo.refund_controller::refund'
_controller: 'Buckaroo\PrestaShop\Controllers\admin\AdminRefundController::refund'

buckaroo_config_paymentMethod:
path: buckaroo3/config/payment/methods
Expand Down
2 changes: 1 addition & 1 deletion config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- "@buckaroo.refund.request.response.handler"
public: true

buckaroo.refund_controller:
Buckaroo\PrestaShop\Controllers\admin\AdminRefundController:
class: Buckaroo\PrestaShop\Controllers\admin\AdminRefundController
arguments:
- "@buckaroo.refund.request.quantity_based_builder"
Expand Down
9 changes: 8 additions & 1 deletion vendor/buckaroo/sdk/src/Handlers/Reply/HttpPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,19 @@ public function validate(): bool

//Combine the array keys with value
$data = array_map(function ($value, $key) {
if ($key === 'brq_service_knaken_buyer_name') {
$key = 'brq_service_knaken_buyer name';
}

if ($key === 'brq_service_knaken_buyer_uuid') {
$key = 'brq_service_knaken_buyer uuid';
}
return $key . '=' . html_entity_decode($value);
}, $data, array_keys($data));

$dataString = implode('', $data) . trim($this->config->secretKey());

return hash_equals(
return hash_equals(
sha1($dataString),
trim($this->data['brq_signature'] ?? $this->data['BRQ_SIGNATURE'] ?? null)
);
Expand Down

0 comments on commit 04afec9

Please sign in to comment.