* so we need to save the difference as overPaymentAmount */ $payi->overPaymentAmount($payi->getBalance()); } elseif ($payi->getBalance() > 0) { /* If there any adjusted to closed small amount on capture, * after received captured from payone: balance = 0, getBalance > 0 * so we need to save the difference as reduceAmount */ $payi->reduceAmount($payi->getBalance()); } } 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') {