mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-17 11:54:22 +01:00
(quality) payzen order status
This commit is contained in:
parent
4c126a63d5
commit
e39c5638b8
@ -72,7 +72,7 @@ class API::PayzenController < API::PaymentsController
|
||||
|
||||
cart = shopping_cart
|
||||
|
||||
if order['answer']['transactions'].any? { |transaction| transaction['status'] == 'PAID' }
|
||||
if order['answer']['transactions'].all? { |transaction| transaction['status'] == 'PAID' }
|
||||
render on_payment_success(params[:order_id], cart)
|
||||
else
|
||||
render json: order['answer'], status: :unprocessable_entity
|
||||
@ -86,10 +86,11 @@ class API::PayzenController < API::PaymentsController
|
||||
|
||||
client = PayZen::Transaction.new
|
||||
transaction = client.get(params[:transaction_uuid])
|
||||
order = PayZen::Order.new.get(params[:order_id])
|
||||
|
||||
cart = shopping_cart
|
||||
|
||||
if transaction['answer']['status'] == 'PAID'
|
||||
if transaction['answer']['status'] == 'PAID' && order['answer']['transactions'].all? { |t| t['status'] == 'PAID' }
|
||||
render on_payment_success(params[:order_id], cart)
|
||||
else
|
||||
render json: transaction['answer'], status: :unprocessable_entity
|
||||
|
@ -75,7 +75,7 @@ export const PayzenForm: React.FC<PayzenFormProps> = ({ onSubmit, onSuccess, onE
|
||||
if (updateCard) return onSuccess(null);
|
||||
|
||||
const transaction = event.clientAnswer.transactions[0];
|
||||
if (event.clientAnswer.orderStatus === 'PAID') {
|
||||
if (event.clientAnswer.orderStatus === 'PAID' && transaction?.status === 'PAID') {
|
||||
confirmPayment(event, transaction).then((confirmation) => {
|
||||
PayZenKR.current.removeForms().then(() => {
|
||||
onSuccess(confirmation);
|
||||
|
Loading…
x
Reference in New Issue
Block a user