Merge pull request #6446 from turbo124/eway

Eway
This commit is contained in:
David Bomba 2021-08-12 21:02:28 +10:00 committed by GitHub
commit 8ec35a3606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 10 deletions

View File

@ -134,7 +134,7 @@ class Request extends FormRequest
} }
} }
if (isset($input['contacts'])) { if (isset($input['contacts']) && is_array($input['contacts'])) {
foreach ($input['contacts'] as $key => $contact) { foreach ($input['contacts'] as $key => $contact) {
if (array_key_exists('id', $contact) && is_numeric($contact['id'])) { if (array_key_exists('id', $contact) && is_numeric($contact['id'])) {
unset($input['contacts'][$key]['id']); unset($input['contacts'][$key]['id']);

View File

@ -138,7 +138,7 @@ class CreditCard
// ], // ],
// 'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE, // 'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
'Method' => \Eway\Rapid\Enum\PaymentMethod::CREATE_TOKEN_CUSTOMER, 'Method' => \Eway\Rapid\Enum\PaymentMethod::CREATE_TOKEN_CUSTOMER,
'SecuredCardData' => $request->input('SecuredCardData'), 'SecuredCardData' => $request->input('securefieldcode'),
]; ];
$response = $this->eway_driver->init()->eway->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction); $response = $this->eway_driver->init()->eway->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
@ -178,7 +178,8 @@ class CreditCard
} }
public function processPaymentResponse($request)
public function paymentResponse($request)
{ {
} }

View File

@ -115,7 +115,7 @@ class EwayPaymentDriver extends BaseDriver
} }
} else { } else {
$refund_status = false; $refund_status = false;
$refund_message 'Sorry, your refund failed'; $refund_message = 'Sorry, your refund failed';
} }
} }
return [ return [
@ -146,7 +146,7 @@ class EwayPaymentDriver extends BaseDriver
if($precision == 1) if($precision == 1)
return $amount*10; return $amount*10;
if$precision == 2) if($precision == 2)
return $amount*100; return $amount*100;

View File

@ -6,10 +6,10 @@ ctrans('texts.credit_card')])
@section('gateway_content') @section('gateway_content')
<form action="{{ route('client.payment_methods.store', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}" <form action="{{ route('client.payment_methods.store', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}"
method="post" id="payment_form"> method="post" id="server-response">
@csrf @csrf
<input type="hidden" id="securefieldcode" name="SecuredCardData" value="" /> <input type="hidden" id="securefieldcode" name="securefieldcode" value="" />
<input type="hidden" name="company_gateway_id" value="{{ $gateway->company_gateway->id }}"> <input type="hidden" name="company_gateway_id" value="{{ $gateway->company_gateway->id }}">
<input type="hidden" name="payment_method_id" value="1"> <input type="hidden" name="payment_method_id" value="1">
@ -36,7 +36,7 @@ ctrans('texts.credit_card')])
<!-- Your JS includes go here --> <!-- Your JS includes go here -->
<script src="https://secure.ewaypayments.com/scripts/eWAY.min.js" data-init="false"></script> <script src="https://secure.ewaypayments.com/scripts/eWAY.min.js" data-init="false"></script>
@include('portal.ninja2020.gateways.eway.includes.credt_card') @include('portal.ninja2020.gateways.eway.includes.credit_card')
<script type="text/javascript"> <script type="text/javascript">

View File

@ -93,17 +93,20 @@ function securePanelCallback(event) {
if (!event.fieldValid) { if (!event.fieldValid) {
alert(getError(event.errors)); alert(getError(event.errors));
} else { } else {
var s = document.getElementById("securefieldcode"); var s = document.querySelector("input[name=securefieldcode]");
s.value = event.secureFieldCode s.value = event.secureFieldCode
console.log(s.value);
} }
} }
function doneCallback() { function doneCallback() {
var form = document.getElementById("payment_form"); console.log("done call bak");
var form = document.getElementById("server-response");
form.submit(); form.submit();
} }
function saveAndSubmit() { function saveAndSubmit() {
console.log("save and sub");
eWAY.saveAllFields(doneCallback, 2000); eWAY.saveAllFields(doneCallback, 2000);
return false; return false;
} }

View File

@ -12,6 +12,7 @@
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}"> <input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
<input type="hidden" name="payment_method_id" value="1"> <input type="hidden" name="payment_method_id" value="1">
<input type="hidden" name="token" id="token" value=""> <input type="hidden" name="token" id="token" value="">
<input type="hidden" name="securefieldcode" value="">
</form> </form>
<div class="alert alert-failure mb-4" hidden id="errors"></div> <div class="alert alert-failure mb-4" hidden id="errors"></div>