|
|
@@ -518,13 +518,13 @@ class InvoiceResource extends Resource
|
|
518
|
518
|
->live(onBlur: true)
|
|
519
|
519
|
->helperText(function (Invoice $record, $state) {
|
|
520
|
520
|
$invoiceCurrency = $record->currency_code;
|
|
521
|
|
- if (! CurrencyConverter::isValidAmount($state, $invoiceCurrency)) {
|
|
|
521
|
+ if (! CurrencyConverter::isValidAmount($state, 'USD')) {
|
|
522
|
522
|
return null;
|
|
523
|
523
|
}
|
|
524
|
524
|
|
|
525
|
|
- $amountDue = $record->getRawOriginal('amount_due');
|
|
|
525
|
+ $amountDue = $record->amount_due;
|
|
526
|
526
|
|
|
527
|
|
- $amount = CurrencyConverter::convertToCents($state, $invoiceCurrency);
|
|
|
527
|
+ $amount = CurrencyConverter::convertToCents($state, 'USD');
|
|
528
|
528
|
|
|
529
|
529
|
if ($amount <= 0) {
|
|
530
|
530
|
return 'Please enter a valid positive amount';
|
|
|
@@ -543,8 +543,8 @@ class InvoiceResource extends Resource
|
|
543
|
543
|
};
|
|
544
|
544
|
})
|
|
545
|
545
|
->rules([
|
|
546
|
|
- static fn (Invoice $record): Closure => static function (string $attribute, $value, Closure $fail) use ($record) {
|
|
547
|
|
- if (! CurrencyConverter::isValidAmount($value, $record->currency_code)) {
|
|
|
546
|
+ static fn (): Closure => static function (string $attribute, $value, Closure $fail) {
|
|
|
547
|
+ if (! CurrencyConverter::isValidAmount($value, 'USD')) {
|
|
548
|
548
|
$fail('Please enter a valid amount');
|
|
549
|
549
|
}
|
|
550
|
550
|
},
|