wip
This commit is contained in:
@@ -64,19 +64,21 @@ class MakeSberPaymentAction extends Action
|
|||||||
public function fields(NovaRequest $request)
|
public function fields(NovaRequest $request)
|
||||||
{
|
{
|
||||||
$usd_to_tmt = CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value');
|
$usd_to_tmt = CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'TMT')->first('value');
|
||||||
|
$usd_to_rub = CurrencyRate::where('currency_from', 'USD')->where('currency_to', 'RUB')->first('value');
|
||||||
|
$rub_to_tmt = CurrencyRate::where('currency_from', 'RUB')->where('currency_to', 'TMT')->first('value');
|
||||||
|
|
||||||
if (! $usd_to_tmt) {
|
if (! $usd_to_tmt || ! $usd_to_rub || ! $rub_to_tmt) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$max_value = number_format(96.05 * 250 * 0.036621, 2, '.', '');
|
$max_value = number_format($usd_to_rub * 250 * $rub_to_tmt, 2, '.', '');
|
||||||
$tvebTaxTMT = $usd_to_tmt->value * 18;
|
$tvebTaxTMT = $usd_to_tmt->value * 18;
|
||||||
$bankTax = 120.75;
|
$bankTax = 120.75;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Heading::make(Blade::render(<<<HTML
|
Heading::make(Blade::render(<<<HTML
|
||||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 USD = $usd_to_tmt->value TMT</h3>
|
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 USD = $usd_to_tmt->value TMT</h3>
|
||||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 RUB = 0.036621 TMT</h3>
|
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 RUB = $rub_to_tmt TMT</h3>
|
||||||
<br>
|
<br>
|
||||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">TVEB USD tutumy: 18 USD</h3>
|
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">TVEB USD tutumy: 18 USD</h3>
|
||||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">TVEB tutumy TMT = $tvebTaxTMT TMT</h3>
|
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">TVEB tutumy TMT = $tvebTaxTMT TMT</h3>
|
||||||
@@ -93,9 +95,9 @@ class MakeSberPaymentAction extends Action
|
|||||||
Text::make(__('USD ekwalendi'), 'usd_rate')
|
Text::make(__('USD ekwalendi'), 'usd_rate')
|
||||||
->fullWidth()
|
->fullWidth()
|
||||||
->readonly()
|
->readonly()
|
||||||
->dependsOn('payment_amount', function ($field, $request, $formData) {
|
->dependsOn('payment_amount', function ($field, $request, $formData) use ($usd_to_rub, $rub_to_tmt) {
|
||||||
if ($formData->payment_amount) {
|
if ($formData->payment_amount) {
|
||||||
$usdValue = number_format($formData->payment_amount / (96.05 * 0.036621), 2, '.', '');
|
$usdValue = number_format($formData->payment_amount / ($usd_to_rub * $rub_to_tmt), 2, '.', '');
|
||||||
|
|
||||||
$field->setValue($usdValue);
|
$field->setValue($usdValue);
|
||||||
} else {
|
} else {
|
||||||
@@ -153,10 +155,6 @@ class MakeSberPaymentAction extends Action
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
info([
|
|
||||||
$paymentResponse->body()
|
|
||||||
]);
|
|
||||||
|
|
||||||
OnlinePaymentHistory::create([
|
OnlinePaymentHistory::create([
|
||||||
'online_paymantable_id' => $resource->id,
|
'online_paymantable_id' => $resource->id,
|
||||||
'online_paymantable_type' => SberPaymentOrder::class,
|
'online_paymantable_type' => SberPaymentOrder::class,
|
||||||
|
|||||||
Reference in New Issue
Block a user