I have a big form which is essentially split into two different sections, I need to to be one big form as a user might go back and edit the details of the first section of the form. I need to post the whole form to my controller save some of the data in my local database and capture & encrypt the rest of the input data to be posted to a remote URL (user taken off-site).
Currently, I'm saving the first part of the form -
//Create Billing Details
$this->validate($request, [
'billing-name' => 'required|max:65',
'billing-address-1' => 'required',
'billing-town' => 'required',
'billing-county' => 'required',
'billing-postcode' => 'required',
]);
$order = new Orders([
'billing_name' => $request->input('billing-name'),
'billing_company' => $request->input('company-name'),
'billing_job_title' => $request->input('job-title'),
'billing_address_1' => $request->input('billing-address-1'),
'billing_address_2' => $request->input('billing-address-2'),
'billing_town' => $request->input('billing-town'),
'billing_county' => $request->input('billing-county'),
'billing_postcode' => $request->input('billing-postcode'),
]);
$order->save();
I need to set and encrypt, the rest of the data
SagePay::setAmount($price);
SagePay::setBillingFirstnames($request->input('billing-name'));
SagePay::setBillingCity($request->input('billing-town'));
SagePay::setBillingPostCode($request->input('billing-postcode'));
SagePay::setBillingAddress1($request->input('billing-address-1'));
$encrypted_code = SagePay::getCrypt();
This is the remote URL/form I need to post
<form method="POST" id="SagePayForm" action="https://test.sagepay.com/gateway/service/vspform-register.vsp">
<input type="hidden" name="VPSProtocol" value= "3.00">
<input type="hidden" name="TxType" value= "PAYMENT">
<input type="hidden" name="Vendor" value= "123456789">
<input type="hidden" name="Crypt" value= "">
<input type="submit" value="Pay">
</form>
Is there a way I can store the first part of my data then possibly in the response I can return to a view that instantly submits the second form?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire