} else { $status = 'O'; } $payi->updateCompleteStatus($status); } $payi->payoneSaldo($request['balance']); break; case 'paid': case 'underpaid': $prev_balance = $payi->getBalance(); if ($request['clearingtype'] == 'vor') { //if paid/underpaid, payone returns negative balance and balance = total_amount_has_paid_by_user $request['balance'] = $payi->detail['invoice_amount'] + $request['balance']; } $receipt_amount = $prev_balance - $request['balance']; $payi->addReceipt($receipt_amount, $tx_time, $received, $request['clearingtype']); //Send Payment Received Notification $order_type = $payi->detail['invoice_order_type'] == 'J' ? Order::ORDER_TYPE_JULIE_GRACE : Order::ORDER_TYPE_SALES_PARTNER; $order = new Order($order_type, $payi->detail['invoice_order_id']); $order->sendPaymentReceivedNotification($receipt_amount, 'today'); if ($txaction == 'underpaid') { $status = 'U'; if ($payi->detail['invoice_order_type'] == 'J') { //SET ORDER AS PAID "ONLY FOR JG" WHEN CUST. PAID WITH LEAVING SMALL AMOUNT ONLY FOR UNCAPTURED PREAUTH VORKASSE $is_uncaptured_preauthvorkasse = $request['clearingtype'] == 'vor' && $payi->detail['is_captured'] == '0'; $is_small_amount = $request['balance'] > 0 && $request['balance'] * 100 <= PAYONE_MAX_RETURNED_OPEN_PAYMENT; if ($is_uncaptured_preauthvorkasse && $is_small_amount) { //replaced this with below since we not use this var anymore on this code //$set_order_as_paid = true; //need to set as paid so we could process and could set leadtime before its captured on sent $status = 'P';