From 04afec971bcdf3eb5b25a0ed8800fc01eecc263f Mon Sep 17 00:00:00 2001 From: Ivascu Madalin Date: Thu, 14 Mar 2024 10:36:49 +0200 Subject: [PATCH] Fix knaken signature error (#140) Co-authored-by: Ivascu Madalin --- config/routes.yml | 2 +- config/services.yml | 2 +- vendor/buckaroo/sdk/src/Handlers/Reply/HttpPost.php | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/config/routes.yml b/config/routes.yml index e01859d3d..6c7c89d56 100644 --- a/config/routes.yml +++ b/config/routes.yml @@ -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 diff --git a/config/services.yml b/config/services.yml index 5d4d0e801..a153098f1 100644 --- a/config/services.yml +++ b/config/services.yml @@ -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" diff --git a/vendor/buckaroo/sdk/src/Handlers/Reply/HttpPost.php b/vendor/buckaroo/sdk/src/Handlers/Reply/HttpPost.php index d86e411e7..a099b7bc5 100644 --- a/vendor/buckaroo/sdk/src/Handlers/Reply/HttpPost.php +++ b/vendor/buckaroo/sdk/src/Handlers/Reply/HttpPost.php @@ -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) );