bank api - error display

This commit is contained in:
saparatayev 2021-07-24 14:51:45 +05:00
parent b091829fc9
commit 76b1b65a57
2 changed files with 19 additions and 26 deletions

View File

@ -77,27 +77,6 @@ class OfferForm extends ComponentBase
];
}
public function onChooseSuggestion() {
$product = Product::with(['categories:id', 'country:id'])->find(Input::get('product_id'));
$product_en = DB::table('rainlab_translate_attributes')
->where('model_id',$product->id)
->where('model_type', 'TPS\Birzha\Models\Product')
->where('locale','en')->first();
$product_ru = DB::table('rainlab_translate_attributes')
->where('model_id',$product->id)
->where('model_type', 'TPS\Birzha\Models\Product')
->where('locale','ru')->first();
return [
'product' => $product,
'product_en_name' => json_decode($product_en->attribute_data)->name,
'product_ru_name' => json_decode($product_ru->attribute_data)->name
];
}
public function onSave() {
$data = post();
@ -240,6 +219,12 @@ class OfferForm extends ComponentBase
];
} else {
$url = $this->payOnline();
if(!$url) {
$this->page['err_message'] = 'Не удается подключиться к сервисам банка. Попробуйте позже';
return [
'#form-steps' => $this->renderPartial('@message')
];
}
$this->page['url'] = $url;
return [
@ -263,9 +248,11 @@ class OfferForm extends ComponentBase
return $result['formUrl'];
}
else{
throw new AjaxException(
$result
);
return false;
// dd($result['formUrl']);
// throw new AjaxException(
// $result
// );
}
}
@ -414,7 +401,7 @@ class OfferForm extends ComponentBase
]);
$client->setOption(CURLOPT_POSTFIELDS,$client->getRequestData());
// dd($client);
// dd($client);
return $client->send();
}
@ -422,6 +409,6 @@ class OfferForm extends ComponentBase
return Http::make(self::API_URL.$url, Http::METHOD_POST)->data([
'userName' => Settings::getValue('api_login'),
'password' => Settings::getValue('api_password'),
])->timeout(3600);
])->timeout(120);
}
}

View File

@ -1,12 +1,18 @@
<section class="thanks">
<div class="auto_container">
<div class="thanks_wrap">
{% if err_message is defined %}
<div class="thanks_text">
{{err_message}}
</div>
{% else %}
<div class="thanks_title">
Спасибо за оставленный вами запрос
</div>
<div class="thanks_text">
После проверки нашим Админом ваш лот будет размещен на нашем сайте!
</div>
{% endif %}
</div>
</div>
</section>