mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Fixes for AUthorize.net
This commit is contained in:
parent
6b9cca14fb
commit
f82953b44b
@ -75,13 +75,16 @@ class AuthorizeCreditCard
|
|||||||
$authorise_payment_method = new AuthorizePaymentMethod($this->authorize);
|
$authorise_payment_method = new AuthorizePaymentMethod($this->authorize);
|
||||||
|
|
||||||
$payment_profile = $authorise_payment_method->addPaymentMethodToClient($gateway_customer_reference, $data);
|
$payment_profile = $authorise_payment_method->addPaymentMethodToClient($gateway_customer_reference, $data);
|
||||||
|
$payment_profile_id = $payment_profile->getPaymentProfile()->getCustomerPaymentProfileId();
|
||||||
|
|
||||||
if($request->has('store_card') && $request->input('store_card')){
|
info($request->input('store_card'));
|
||||||
|
|
||||||
|
if($request->has('store_card') && $request->input('store_card') === 'true'){
|
||||||
$authorise_payment_method->payment_method = GatewayType::CREDIT_CARD;
|
$authorise_payment_method->payment_method = GatewayType::CREDIT_CARD;
|
||||||
$client_gateway_token = $authorise_payment_method->createClientGatewayToken($payment_profile, $gateway_customer_reference);
|
$client_gateway_token = $authorise_payment_method->createClientGatewayToken($payment_profile, $gateway_customer_reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($gateway_customer_reference, $payment_profile, $data['amount_with_fee']);
|
$data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($gateway_customer_reference, $payment_profile_id, $data['amount_with_fee']);
|
||||||
|
|
||||||
return $this->handleResponse($data, $request);
|
return $this->handleResponse($data, $request);
|
||||||
|
|
||||||
@ -91,7 +94,7 @@ class AuthorizeCreditCard
|
|||||||
{
|
{
|
||||||
$client_gateway_token = ClientGatewayToken::find($this->decodePrimaryKey($request->token));
|
$client_gateway_token = ClientGatewayToken::find($this->decodePrimaryKey($request->token));
|
||||||
|
|
||||||
$data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($client_gateway_token->gateway_customer_reference, $client_gateway_token->token, $request->input('amount'));
|
$data = (new ChargePaymentProfile($this->authorize))->chargeCustomerProfile($client_gateway_token->gateway_customer_reference, $client_gateway_token->token, $request->input('amount_with_fee'));
|
||||||
|
|
||||||
return $this->handleResponse($data, $request);
|
return $this->handleResponse($data, $request);
|
||||||
}
|
}
|
||||||
@ -121,7 +124,7 @@ class AuthorizeCreditCard
|
|||||||
$payment->currency_id = $this->authorize->client->getSetting('currency_id');
|
$payment->currency_id = $this->authorize->client->getSetting('currency_id');
|
||||||
$payment->date = Carbon::now();
|
$payment->date = Carbon::now();
|
||||||
$payment->transaction_reference = $response->getTransactionResponse()->getTransId();
|
$payment->transaction_reference = $response->getTransactionResponse()->getTransId();
|
||||||
$payment->amount = $request->input('amount');
|
$payment->amount = $request->input('amount_with_fee');
|
||||||
$payment->currency_id = $this->authorize->client->getSetting('currency_id');
|
$payment->currency_id = $this->authorize->client->getSetting('currency_id');
|
||||||
$payment->client->getNextPaymentNumber($this->authorize->client);
|
$payment->client->getNextPaymentNumber($this->authorize->client);
|
||||||
$payment->save();
|
$payment->save();
|
||||||
@ -145,7 +148,7 @@ class AuthorizeCreditCard
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function processFailedResponse($data, $request)
|
private function processFailedResponse($data, $request)
|
||||||
{
|
{ dd($data);
|
||||||
info(print_r($data,1));
|
info(print_r($data,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ $factory->define(App\Models\Company::class, function (Faker $faker) {
|
|||||||
'db' => config('database.default'),
|
'db' => config('database.default'),
|
||||||
'settings' => CompanySettings::defaults(),
|
'settings' => CompanySettings::defaults(),
|
||||||
'custom_fields' => (object) [
|
'custom_fields' => (object) [
|
||||||
'invoice1' => '1|date',
|
'invoice1' => 'Custom Date|date',
|
||||||
// 'invoice2' => '2|switch',
|
// 'invoice2' => '2|switch',
|
||||||
// 'invoice3' => '3|',
|
// 'invoice3' => '3|',
|
||||||
// 'invoice4' => '4',
|
// 'invoice4' => '4',
|
||||||
|
@ -141,6 +141,8 @@ var AuthorizeAuthorizeCard = /*#__PURE__*/function () {
|
|||||||
_defineProperty(this, "handle", function () {
|
_defineProperty(this, "handle", function () {
|
||||||
if (_this.cardButton) {
|
if (_this.cardButton) {
|
||||||
_this.cardButton.addEventListener("click", function () {
|
_this.cardButton.addEventListener("click", function () {
|
||||||
|
_this.cardButton.disabled = true;
|
||||||
|
|
||||||
_this.handleAuthorization();
|
_this.handleAuthorization();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -154,6 +156,8 @@ var AuthorizeAuthorizeCard = /*#__PURE__*/function () {
|
|||||||
var _loop = function _loop() {
|
var _loop = function _loop() {
|
||||||
var item = _step.value;
|
var item = _step.value;
|
||||||
item.addEventListener('click', function () {
|
item.addEventListener('click', function () {
|
||||||
|
item.disabled = true;
|
||||||
|
|
||||||
_this.handlePayNowAction(item.dataset.id);
|
_this.handlePayNowAction(item.dataset.id);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -208,6 +212,7 @@ var AuthorizeAuthorizeCard = /*#__PURE__*/function () {
|
|||||||
document.getElementById("server_response").submit();
|
document.getElementById("server_response").submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.cardButton.disabled = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"/js/clients/payment_methods/authorize-authorize-card.js": "/js/clients/payment_methods/authorize-authorize-card.js?id=7f63b5cd48631432a424",
|
"/js/clients/payment_methods/authorize-authorize-card.js": "/js/clients/payment_methods/authorize-authorize-card.js?id=7f63b5cd48631432a424",
|
||||||
"/js/clients/payment_methods/authorize-stripe-card.js": "/js/clients/payment_methods/authorize-stripe-card.js?id=420e22ba244289dd75f8",
|
"/js/clients/payment_methods/authorize-stripe-card.js": "/js/clients/payment_methods/authorize-stripe-card.js?id=420e22ba244289dd75f8",
|
||||||
"/js/clients/payments/alipay.js": "/js/clients/payments/alipay.js?id=cf114848ef8a3633a51b",
|
"/js/clients/payments/alipay.js": "/js/clients/payments/alipay.js?id=cf114848ef8a3633a51b",
|
||||||
"/js/clients/payments/authorize-credit-card-payment.js": "/js/clients/payments/authorize-credit-card-payment.js?id=1b765d273ca55c87f910",
|
"/js/clients/payments/authorize-credit-card-payment.js": "/js/clients/payments/authorize-credit-card-payment.js?id=a474e669b65198f7ce6f",
|
||||||
"/js/clients/payments/card-js.min.js": "/js/clients/payments/card-js.min.js?id=3fe6822360e6c456d1a2",
|
"/js/clients/payments/card-js.min.js": "/js/clients/payments/card-js.min.js?id=3fe6822360e6c456d1a2",
|
||||||
"/js/clients/payments/checkout.com.js": "/js/clients/payments/checkout.com.js?id=31df208670107e18f59d",
|
"/js/clients/payments/checkout.com.js": "/js/clients/payments/checkout.com.js?id=31df208670107e18f59d",
|
||||||
"/js/clients/payments/process.js": "/js/clients/payments/process.js?id=f4c4b09d4454070a6db6",
|
"/js/clients/payments/process.js": "/js/clients/payments/process.js?id=f4c4b09d4454070a6db6",
|
||||||
|
@ -55,6 +55,7 @@ class AuthorizeAuthorizeCard {
|
|||||||
|
|
||||||
responseHandler(response) {
|
responseHandler(response) {
|
||||||
|
|
||||||
|
|
||||||
if (response.messages.resultCode === "Error") {
|
if (response.messages.resultCode === "Error") {
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
@ -70,7 +71,8 @@ class AuthorizeAuthorizeCard {
|
|||||||
document.getElementById("server_response").submit();
|
document.getElementById("server_response").submit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.cardButton.disabled=false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +85,8 @@ class AuthorizeAuthorizeCard {
|
|||||||
{
|
{
|
||||||
this.cardButton.addEventListener("click", () => {
|
this.cardButton.addEventListener("click", () => {
|
||||||
|
|
||||||
|
this.cardButton.disabled = true;
|
||||||
|
|
||||||
this.handleAuthorization();
|
this.handleAuthorization();
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -94,7 +98,7 @@ class AuthorizeAuthorizeCard {
|
|||||||
for(let item of this.payNowButton) {
|
for(let item of this.payNowButton) {
|
||||||
|
|
||||||
item.addEventListener('click', () => {
|
item.addEventListener('click', () => {
|
||||||
|
item.disabled = true;
|
||||||
this.handlePayNowAction(item.dataset.id);
|
this.handlePayNowAction(item.dataset.id);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -31,10 +31,22 @@
|
|||||||
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||||
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
||||||
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
|
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
|
||||||
|
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||||
|
{{ ctrans('texts.enter_payment') }}
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@if($tokens->count() == 0)
|
@if($tokens->count() == 0)
|
||||||
<dl>
|
<dl>
|
||||||
|
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
|
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||||
|
{{ ctrans('texts.amount') }}
|
||||||
|
</dt>
|
||||||
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
|
{{ App\Utils\Number::formatMoney($amount_with_fee, $client) }}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
|
||||||
@include('portal.ninja2020.gateways.authorize.credit_card')
|
@include('portal.ninja2020.gateways.authorize.credit_card')
|
||||||
|
|
||||||
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
@ -51,21 +63,50 @@
|
|||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
@else
|
@else
|
||||||
<!-- TODO Iterate through the tokens and display the card type and last4 and present
|
|
||||||
a button for payment -->
|
<div>
|
||||||
<ul>
|
<dl>
|
||||||
@foreach($tokens as $token)
|
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
<li>
|
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||||
{{ $token->meta->brand }} : {{ $token->meta->last4 }} : <button class="button button-primary pay_now_button" data-id="{{ $token->hashed_id }}">{{ ctrans('texts.pay_now') }}</button>
|
{{ ctrans('texts.amount') }}
|
||||||
</li>
|
</dt>
|
||||||
@endforeach
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
</ul>
|
{{ App\Utils\Number::formatMoney($amount_with_fee, $client) }}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
@foreach($tokens as $token)
|
||||||
|
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
|
||||||
|
<dt class="text-sm leading-5 font-medium text-gray-500">
|
||||||
|
{{ $token->meta->brand }} : {{ $token->meta->last4 }}
|
||||||
|
</dt>
|
||||||
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
|
<button class="button button-primary pay_now_button" data-id="{{ $token->hashed_id }}">{{ ctrans('texts.pay_now') }}</button>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('footer')
|
@push('footer')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user