From 4b30d9f1241812495b0e8370c1e6895abed7506d Mon Sep 17 00:00:00 2001 From: Nicolas Florentin Date: Thu, 28 Apr 2022 13:36:16 +0200 Subject: [PATCH] Fix a bug: With PayZen, when there was more than one transaction (for ex: 1 failed atempt + 1 successful atemp), the order was not considered PAID because only the first transaction was checked (https://app.clickup.com/t/28zvhwy) --- CHANGELOG.md | 4 ++++ app/controllers/api/payzen_controller.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d8b85475..dc70a3067 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog Fab-manager +## next deploy + +- Fix a bug: With PayZen, when there was more than one transaction (for ex: 1 failed atempt + 1 successful atemp), the order was not considered PAID because only the first transaction was checked (https://app.clickup.com/t/28zvhwy) + ## v5.3.12 2022 April 20 - Auto sync projects to OpenLab if set openlab_app_id and openlab_app_secret diff --git a/app/controllers/api/payzen_controller.rb b/app/controllers/api/payzen_controller.rb index 76d60980f..a458c0c55 100644 --- a/app/controllers/api/payzen_controller.rb +++ b/app/controllers/api/payzen_controller.rb @@ -65,7 +65,7 @@ class API::PayzenController < API::PaymentsController cart = shopping_cart - if order['answer']['transactions'].first['status'] == 'PAID' + if order['answer']['transactions'].any? { |transaction| transaction['status'] == 'PAID' } render on_payment_success(params[:order_id], cart) else render json: order['answer'], status: :unprocessable_entity