|
|
|
|
138
|
|
138
|
|
139
|
// Fall back to conversion if metadata is not available
|
139
|
// Fall back to conversion if metadata is not available
|
140
|
$bankAccountCurrency = $transaction->bankAccount->account->currency_code;
|
140
|
$bankAccountCurrency = $transaction->bankAccount->account->currency_code;
|
141
|
- $amountCents = (int) $transaction->getRawOriginal('amount');
|
|
|
|
|
141
|
+ $amountCents = (int) $transaction->amount;
|
142
|
|
142
|
|
143
|
return CurrencyConverter::convertBalance($amountCents, $bankAccountCurrency, $invoiceCurrency);
|
143
|
return CurrencyConverter::convertBalance($amountCents, $bankAccountCurrency, $invoiceCurrency);
|
144
|
});
|
144
|
});
|
|
|
|
|
158
|
|
158
|
|
159
|
// Fall back to conversion if metadata is not available
|
159
|
// Fall back to conversion if metadata is not available
|
160
|
$bankAccountCurrency = $transaction->bankAccount->account->currency_code;
|
160
|
$bankAccountCurrency = $transaction->bankAccount->account->currency_code;
|
161
|
- $amountCents = (int) $transaction->getRawOriginal('amount');
|
|
|
|
|
161
|
+ $amountCents = (int) $transaction->amount;
|
162
|
|
162
|
|
163
|
return CurrencyConverter::convertBalance($amountCents, $bankAccountCurrency, $invoiceCurrency);
|
163
|
return CurrencyConverter::convertBalance($amountCents, $bankAccountCurrency, $invoiceCurrency);
|
164
|
});
|
164
|
});
|
165
|
|
165
|
|
166
|
$totalPaidInInvoiceCurrencyCents = $depositTotalInInvoiceCurrencyCents - $withdrawalTotalInInvoiceCurrencyCents;
|
166
|
$totalPaidInInvoiceCurrencyCents = $depositTotalInInvoiceCurrencyCents - $withdrawalTotalInInvoiceCurrencyCents;
|
167
|
|
167
|
|
168
|
- $invoiceTotalInInvoiceCurrencyCents = (int) $invoice->getRawOriginal('total');
|
|
|
|
|
168
|
+ $invoiceTotalInInvoiceCurrencyCents = (int) $invoice->total;
|
169
|
|
169
|
|
170
|
$newStatus = match (true) {
|
170
|
$newStatus = match (true) {
|
171
|
$totalPaidInInvoiceCurrencyCents > $invoiceTotalInInvoiceCurrencyCents => InvoiceStatus::Overpaid,
|
171
|
$totalPaidInInvoiceCurrencyCents > $invoiceTotalInInvoiceCurrencyCents => InvoiceStatus::Overpaid,
|
|
|
|
|
212
|
|
212
|
|
213
|
// Fall back to conversion if metadata is not available
|
213
|
// Fall back to conversion if metadata is not available
|
214
|
$bankAccountCurrency = $transaction->bankAccount->account->currency_code;
|
214
|
$bankAccountCurrency = $transaction->bankAccount->account->currency_code;
|
215
|
- $amountCents = (int) $transaction->getRawOriginal('amount');
|
|
|
|
|
215
|
+ $amountCents = (int) $transaction->amount;
|
216
|
|
216
|
|
217
|
return CurrencyConverter::convertBalance($amountCents, $bankAccountCurrency, $billCurrency);
|
217
|
return CurrencyConverter::convertBalance($amountCents, $bankAccountCurrency, $billCurrency);
|
218
|
});
|
218
|
});
|
219
|
|
219
|
|
220
|
$totalPaidInBillCurrencyCents = $withdrawalTotalInBillCurrencyCents;
|
220
|
$totalPaidInBillCurrencyCents = $withdrawalTotalInBillCurrencyCents;
|
221
|
|
221
|
|
222
|
- $billTotalInBillCurrencyCents = (int) $bill->getRawOriginal('total');
|
|
|
|
|
222
|
+ $billTotalInBillCurrencyCents = (int) $bill->total;
|
223
|
|
223
|
|
224
|
$newStatus = match (true) {
|
224
|
$newStatus = match (true) {
|
225
|
$totalPaidInBillCurrencyCents >= $billTotalInBillCurrencyCents => BillStatus::Paid,
|
225
|
$totalPaidInBillCurrencyCents >= $billTotalInBillCurrencyCents => BillStatus::Paid,
|