mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 00:34:35 -04:00
checkout
This commit is contained in:
parent
7dfc396ffc
commit
049f30104e
@ -120,17 +120,18 @@ class PaymentController extends Controller
|
|||||||
|
|
||||||
return $gateway
|
return $gateway
|
||||||
->driver(auth()->user()->client)
|
->driver(auth()->user()->client)
|
||||||
->setPaymentMethod('App\\PaymentDrivers\\Stripe\\Alipay')
|
->setPaymentMethod()
|
||||||
->processPaymentView($data);
|
->processPaymentView($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function response(Request $request)
|
public function response(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
$gateway = CompanyGateway::find($request->input('company_gateway_id'));
|
$gateway = CompanyGateway::find($request->input('company_gateway_id'));
|
||||||
|
|
||||||
return $gateway
|
return $gateway
|
||||||
->driver(auth()->user()->client)
|
->driver(auth()->user()->client)
|
||||||
->setPaymentMethod('App\\PaymentDrivers\\Stripe\\Alipay')
|
->setPaymentMethod()
|
||||||
->processPaymentResponse($request);
|
->processPaymentResponse($request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
app/PaymentDrivers/CheckoutCom/Utilities.php
Normal file
26
app/PaymentDrivers/CheckoutCom/Utilities.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\PaymentDrivers\CheckoutCom;
|
||||||
|
|
||||||
|
trait Utilities
|
||||||
|
{
|
||||||
|
public function getPublishableKey()
|
||||||
|
{
|
||||||
|
// This doesn't work since $gateway->getPublishableKey is looking for 'publishableKey'
|
||||||
|
// but we use 'publicApiKey' for Checkout.com in .env file.
|
||||||
|
|
||||||
|
// This is dummy implementation and it needs to be fixed.
|
||||||
|
|
||||||
|
return $this->company_gateway->getConfig()->publicApiKey;
|
||||||
|
}
|
||||||
|
}
|
78
app/PaymentDrivers/CheckoutComPaymentDriver.php
Normal file
78
app/PaymentDrivers/CheckoutComPaymentDriver.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\PaymentDrivers;
|
||||||
|
|
||||||
|
use App\Models\GatewayType;
|
||||||
|
use App\PaymentDrivers\CheckoutCom\Utilities;
|
||||||
|
use App\Utils\Traits\SystemLogTrait;
|
||||||
|
|
||||||
|
class CheckoutComPaymentDriver extends BasePaymentDriver
|
||||||
|
{
|
||||||
|
use SystemLogTrait, Utilities;
|
||||||
|
|
||||||
|
/* The company gateway instance*/
|
||||||
|
public $company_gateway;
|
||||||
|
|
||||||
|
/* The Invitation */
|
||||||
|
protected $invitation;
|
||||||
|
|
||||||
|
/* Gateway capabilities */
|
||||||
|
protected $refundable = true;
|
||||||
|
|
||||||
|
/* Token billing */
|
||||||
|
protected $token_billing = true;
|
||||||
|
|
||||||
|
/* Authorise payment methods */
|
||||||
|
protected $can_authorise_credit_card = true;
|
||||||
|
|
||||||
|
/** Instance of \Checkout\CheckoutApi */
|
||||||
|
public $gateway;
|
||||||
|
|
||||||
|
/** Since with Checkout.com we handle only credit cards, this method should be empty. */
|
||||||
|
public function setPaymentMethod($string = null)
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
// $this->gateway
|
||||||
|
}
|
||||||
|
|
||||||
|
public function viewForType($gateway_type_id)
|
||||||
|
{
|
||||||
|
if ($gateway_type_id == GatewayType::CREDIT_CARD) {
|
||||||
|
return 'gateways.checkout.credit_card';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($gateway_type_id == GatewayType::TOKEN) {
|
||||||
|
return 'gateways.checkout.credit_card';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processPaymentView(array $data)
|
||||||
|
{
|
||||||
|
$data['gateway'] = $this;
|
||||||
|
$data['client'] = $this->client;
|
||||||
|
$data['currency'] = $this->client->getCurrencyCode();
|
||||||
|
$data['value'] = $data['amount_with_fee']; // Fix for currencies.
|
||||||
|
$data['customer_email'] = $this->client->present()->email;
|
||||||
|
|
||||||
|
return render($this->viewForType($data['payment_method_id']), $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processPaymentResponse($request)
|
||||||
|
{
|
||||||
|
dd($request->all());
|
||||||
|
}
|
||||||
|
}
|
@ -1,139 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://opensource.org/licenses/AAL
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\PaymentDrivers;
|
|
||||||
|
|
||||||
use App\Factory\PaymentFactory;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\ClientContact;
|
|
||||||
use App\Models\CompanyGateway;
|
|
||||||
use App\Models\GatewayType;
|
|
||||||
use App\Models\Invoice;
|
|
||||||
use App\Models\Payment;
|
|
||||||
use App\Utils\Traits\SystemLogTrait;
|
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
|
||||||
use Omnipay\Omnipay;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class BasePaymentDriver
|
|
||||||
* @package App\PaymentDrivers
|
|
||||||
*
|
|
||||||
* Minimum dataset required for payment gateways
|
|
||||||
*
|
|
||||||
* $data = [
|
|
||||||
'amount' => $invoice->getRequestedAmount(),
|
|
||||||
'currency' => $invoice->getCurrencyCode(),
|
|
||||||
'returnUrl' => $completeUrl,
|
|
||||||
'cancelUrl' => $this->invitation->getLink(),
|
|
||||||
'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->number}",
|
|
||||||
'transactionId' => $invoice->number,
|
|
||||||
'transactionType' => 'Purchase',
|
|
||||||
'clientIp' => Request::getClientIp(),
|
|
||||||
];
|
|
||||||
|
|
||||||
*/
|
|
||||||
class CheckoutPaymentDriver extends BasePaymentDriver
|
|
||||||
{
|
|
||||||
use SystemLogTrait;
|
|
||||||
|
|
||||||
/* The company gateway instance*/
|
|
||||||
protected $company_gateway;
|
|
||||||
|
|
||||||
/* The Omnipay payment driver instance*/
|
|
||||||
protected $gateway;
|
|
||||||
|
|
||||||
/* The Invitation */
|
|
||||||
protected $invitation;
|
|
||||||
|
|
||||||
/* Gateway capabilities */
|
|
||||||
protected $refundable = true;
|
|
||||||
|
|
||||||
/* Token billing */
|
|
||||||
protected $token_billing = true;
|
|
||||||
|
|
||||||
/* Authorise payment methods */
|
|
||||||
protected $can_authorise_credit_card = true;
|
|
||||||
|
|
||||||
public function createTransactionToken($amount)
|
|
||||||
{
|
|
||||||
// if ($this->invoice()->getCurrencyCode() == 'BHD') {
|
|
||||||
// $amount = $this->invoice()->getRequestedAmount() / 10;
|
|
||||||
// } elseif ($this->invoice()->getCurrencyCode() == 'KWD') {
|
|
||||||
// $amount = $this->invoice()->getRequestedAmount() * 10;
|
|
||||||
// } elseif ($this->invoice()->getCurrencyCode() == 'OMR') {
|
|
||||||
// $amount = $this->invoice()->getRequestedAmount();
|
|
||||||
// } else
|
|
||||||
// $amount = $this->invoice()->getRequestedAmount();
|
|
||||||
|
|
||||||
$response = $this->gateway()->purchase([
|
|
||||||
'amount' => $amount,
|
|
||||||
'currency' => $this->client->getCurrencyCode(),
|
|
||||||
])->send();
|
|
||||||
|
|
||||||
if ($response->isRedirect()) {
|
|
||||||
$token = $response->getTransactionReference();
|
|
||||||
|
|
||||||
session()->flash('transaction_reference', $token);
|
|
||||||
|
|
||||||
|
|
||||||
// On each request, session()->flash() || sesion('', value) || session[name] ||session->flash(key, value)
|
|
||||||
|
|
||||||
return $token;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function viewForType($gateway_type_id)
|
|
||||||
{
|
|
||||||
switch ($gateway_type_id) {
|
|
||||||
case GatewayType::CREDIT_CARD:
|
|
||||||
return 'gateways.checkout.credit_card';
|
|
||||||
break;
|
|
||||||
case GatewayType::TOKEN:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* $data = [
|
|
||||||
'invoices' => $invoices,
|
|
||||||
'amount' => $amount,
|
|
||||||
'fee' => $gateway->calcGatewayFee($amount),
|
|
||||||
'amount_with_fee' => $amount + $gateway->calcGatewayFee($amount),
|
|
||||||
'token' => auth()->user()->client->gateway_token($gateway->id, $payment_method_id),
|
|
||||||
'payment_method_id' => $payment_method_id,
|
|
||||||
'hashed_ids' => explode(",", request()->input('hashed_ids')),
|
|
||||||
];
|
|
||||||
*/
|
|
||||||
public function processPaymentView(array $data)
|
|
||||||
{
|
|
||||||
$data['token'] = $this->createTransactionToken($data['amount']);
|
|
||||||
$data['gateway'] = $this->gateway();
|
|
||||||
|
|
||||||
return render($this->viewForType($data['payment_method_id']), $data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function processPaymentResponse($request)
|
|
||||||
{
|
|
||||||
$data['token'] = session('transaction_reference');
|
|
||||||
|
|
||||||
$this->completeOffsitePurchase($data);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
namespace App\PaymentDrivers\Stripe;
|
namespace App\PaymentDrivers\Stripe;
|
||||||
|
|
||||||
trait Utilities
|
trait Utilities
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"asgrim/ofxparser": "^1.2",
|
"asgrim/ofxparser": "^1.2",
|
||||||
"beganovich/omnipay-checkout": "dev-master",
|
"beganovich/omnipay-checkout": "dev-master",
|
||||||
|
"checkout/checkout-sdk-php": "^1.0",
|
||||||
"cleverit/ubl_invoice": "^1.3",
|
"cleverit/ubl_invoice": "^1.3",
|
||||||
"composer/composer": "^1.10",
|
"composer/composer": "^1.10",
|
||||||
"czproject/git-php": "^3.17",
|
"czproject/git-php": "^3.17",
|
||||||
|
@ -302,18 +302,18 @@ class RandomDataSeeder extends Seeder
|
|||||||
// $cg->save();
|
// $cg->save();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if(config('ninja.testvars.checkout')) {
|
if(config('ninja.testvars.checkout')) {
|
||||||
// $cg = new CompanyGateway;
|
$cg = new CompanyGateway;
|
||||||
// $cg->company_id = $company->id;
|
$cg->company_id = $company->id;
|
||||||
// $cg->user_id = $user->id;
|
$cg->user_id = $user->id;
|
||||||
// $cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456';
|
$cg->gateway_key = '3758e7f7c6f4cecf0f4f348b9a00f456';
|
||||||
// $cg->require_cvv = true;
|
$cg->require_cvv = true;
|
||||||
// $cg->show_billing_address = true;
|
$cg->show_billing_address = true;
|
||||||
// $cg->show_shipping_address = true;
|
$cg->show_shipping_address = true;
|
||||||
// $cg->update_details = true;
|
$cg->update_details = true;
|
||||||
// $cg->config = encrypt(config('ninja.testvars.checkout'));
|
$cg->config = encrypt(config('ninja.testvars.checkout'));
|
||||||
// $cg->save();
|
$cg->save();
|
||||||
// }
|
}
|
||||||
|
|
||||||
if(config('ninja.testvars.authorize')) {
|
if(config('ninja.testvars.authorize')) {
|
||||||
$cg = new CompanyGateway;
|
$cg = new CompanyGateway;
|
||||||
|
2
public/css/app.css
vendored
2
public/css/app.css
vendored
File diff suppressed because one or more lines are too long
@ -1,3 +1,2 @@
|
|||||||
/*! For license information please see action-selectors.js.LICENSE.txt */
|
/*! For license information please see action-selectors.js.LICENSE.txt */
|
||||||
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=4)}({4:function(e,t,n){e.exports=n("Boob")},Boob:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var t,r,o;return t=e,(r=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()}));var r=document.createElement("INPUT");r.setAttribute("name","invoices[]"),r.setAttribute("value",e.dataset.value),r.setAttribute("class","child-hidden-input"),r.hidden=!0,t.append(r)}},{key:"handle",value:function(){var e=this;this.parentElement.addEventListener("click",(function(){e.watchCheckboxes(e.parentElement)}));var t=!0,n=!1,r=void 0;try{for(var o,c=function(){var t=o.value;t.addEventListener("click",(function(){e.processChildItem(t,e.parentForm)}))},u=document.querySelectorAll(".form-check-child")[Symbol.iterator]();!(t=(o=u.next()).done);t=!0)c()}catch(e){n=!0,r=e}finally{try{t||null==u.return||u.return()}finally{if(n)throw r}}}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=3)}({3:function(e,t,n){e.exports=n("Boob")},Boob:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var t,r,o;return t=e,(r=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()}));var r=document.createElement("INPUT");r.setAttribute("name","invoices[]"),r.setAttribute("value",e.dataset.value),r.setAttribute("class","child-hidden-input"),r.hidden=!0,t.append(r)}},{key:"handle",value:function(){var e=this;this.parentElement.addEventListener("click",(function(){e.watchCheckboxes(e.parentElement)}));var t=!0,n=!1,r=void 0;try{for(var o,c=function(){var t=o.value;t.addEventListener("click",(function(){e.processChildItem(t,e.parentForm)}))},u=document.querySelectorAll(".form-check-child")[Symbol.iterator]();!(t=(o=u.next()).done);t=!0)c()}catch(e){n=!0,r=e}finally{try{t||null==u.return||u.return()}finally{if(n)throw r}}}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
|
4
public/js/clients/invoices/payment.js
vendored
4
public/js/clients/invoices/payment.js
vendored
@ -1,4 +1,2 @@
|
|||||||
/*! For license information please see payment.js.LICENSE.txt */
|
/*! For license information please see payment.js.LICENSE.txt */
|
||||||
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=5)}({5:function(e,t,n){e.exports=n("FuOr")},FuOr:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.shouldDisplayTerms=t,this.shouldDisplaySignature=n,this.termsAccepted=!1}var t,r,i;return t=e,(r=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){return e.handleMethodSelect(t)}))}))}}])&&n(t.prototype,r),i&&n(t,i),e}(),i=document.querySelector('meta[name="require-invoice-signature"]').content,u=document.querySelector('meta[name="show-invoice-terms"]').content;new r(Boolean(+i),Boolean(+u)).handle()}});
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=4)}({4:function(e,t,n){e.exports=n("FuOr")},FuOr:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.shouldDisplayTerms=t,this.shouldDisplaySignature=n,this.termsAccepted=!1}var t,r,i;return t=e,(r=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){return e.handleMethodSelect(t)}))}))}}])&&n(t.prototype,r),i&&n(t,i),e}(),i=document.querySelector('meta[name="require-invoice-signature"]').content,u=document.querySelector('meta[name="show-invoice-terms"]').content;new r(Boolean(+i),Boolean(+u)).handle()}});
|
|
||||||
|
|
2
public/js/clients/payments/checkout.com.js
vendored
Normal file
2
public/js/clients/payments/checkout.com.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/*! For license information please see checkout.com.js.LICENSE.txt */
|
||||||
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=8)}({8:function(e,t,n){e.exports=n("XYrq")},XYrq:function(e,t){window.CKOConfig={publicKey:document.querySelector('meta[name="public-key"]').content,customerEmail:document.querySelector('meta[name="customer-email"]').content,value:document.querySelector('meta[name="value"]').content,currency:document.querySelector('meta[name="currency"]').content,paymentMode:"cards",cardFormMode:"cardTokenisation",cardTokenised:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.data),document.getElementById("server-response").submit()}}}});
|
9
public/js/clients/payments/checkout.com.js.LICENSE.txt
Normal file
9
public/js/clients/payments/checkout.com.js.LICENSE.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
3
public/js/clients/payments/process.js
vendored
3
public/js/clients/payments/process.js
vendored
@ -1,3 +1,2 @@
|
|||||||
/*! For license information please see process.js.LICENSE.txt */
|
/*! For license information please see process.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=7)}({7:function(e,t,n){e.exports=n("OXGg")},OXGg:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}new(function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.key=t,this.usingToken=n}var t,r,o;return t=e,(r=[{key:"setupStripe",value:function(){return this.stripe=Stripe(this.key),this.elements=this.stripe.elements(),this}},{key:"createElement",value:function(){return this.cardElement=this.elements.create("card"),this}},{key:"mountCardElement",value:function(){return this.cardElement.mount("#card-element"),this}},{key:"completePaymentUsingToken",value:function(){var e=this,t=document.getElementById("pay-now-with-token");this.stripe.handleCardPayment(t.dataset.secret,{payment_method:t.dataset.token}).then((function(t){return t.error?e.handleFailure(t.error.message):e.handleSuccess(t)}))}},{key:"completePaymentWithoutToken",value:function(){var e=this,t=document.getElementById("pay-now"),n=document.getElementById("cardholder-name");this.stripe.handleCardPayment(t.dataset.secret,this.cardElement,{payment_method_data:{billing_details:{name:n.value}}}).then((function(t){return t.error?e.handleFailure(t.error.message):e.handleSuccess(t)}))}},{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);var t=document.querySelector('input[name="token-billing-checkbox"]');t&&(document.querySelector('input[name="store_card"]').value=t.checked),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1}},{key:"handle",value:function(){var e=this;this.setupStripe(),this.usingToken&&document.getElementById("pay-now-with-token").addEventListener("click",(function(){return e.completePaymentUsingToken()})),this.usingToken||(this.createElement().mountCardElement(),document.getElementById("pay-now").addEventListener("click",(function(){return e.completePaymentWithoutToken()})))}}])&&n(t.prototype,r),o&&n(t,o),e}())(document.querySelector('meta[name="stripe-publishable-key"]').content,document.querySelector('meta[name="using-token"]').content).handle()}});
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=11)}({11:function(e,t,n){e.exports=n("OXGg")},OXGg:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}new(function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.key=t,this.usingToken=n}var t,r,o;return t=e,(r=[{key:"setupStripe",value:function(){return this.stripe=Stripe(this.key),this.elements=this.stripe.elements(),this}},{key:"createElement",value:function(){return this.cardElement=this.elements.create("card"),this}},{key:"mountCardElement",value:function(){return this.cardElement.mount("#card-element"),this}},{key:"completePaymentUsingToken",value:function(){var e=this,t=document.getElementById("pay-now-with-token");this.stripe.handleCardPayment(t.dataset.secret,{payment_method:t.dataset.token}).then((function(t){return t.error?e.handleFailure(t.error.message):e.handleSuccess(t)}))}},{key:"completePaymentWithoutToken",value:function(){var e=this,t=document.getElementById("pay-now"),n=document.getElementById("cardholder-name");this.stripe.handleCardPayment(t.dataset.secret,this.cardElement,{payment_method_data:{billing_details:{name:n.value}}}).then((function(t){return t.error?e.handleFailure(t.error.message):e.handleSuccess(t)}))}},{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent);var t=document.querySelector('input[name="token-billing-checkbox"]');t&&(document.querySelector('input[name="store_card"]').value=t.checked),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1}},{key:"handle",value:function(){var e=this;this.setupStripe(),this.usingToken&&document.getElementById("pay-now-with-token").addEventListener("click",(function(){return e.completePaymentUsingToken()})),this.usingToken||(this.createElement().mountCardElement(),document.getElementById("pay-now").addEventListener("click",(function(){return e.completePaymentWithoutToken()})))}}])&&n(t.prototype,r),o&&n(t,o),e}())(document.querySelector('meta[name="stripe-publishable-key"]').content,document.querySelector('meta[name="using-token"]').content).handle()}});
|
||||||
|
|
3
public/js/clients/quotes/action-selectors.js
vendored
3
public/js/clients/quotes/action-selectors.js
vendored
@ -1,3 +1,2 @@
|
|||||||
/*! For license information please see action-selectors.js.LICENSE.txt */
|
/*! For license information please see action-selectors.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=5)}({5:function(e,t,n){e.exports=n("ydWM")},ydWM:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var t,r,o;return t=e,(r=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()}));var r=document.createElement("INPUT");r.setAttribute("name","quotes[]"),r.setAttribute("value",e.dataset.value),r.setAttribute("class","child-hidden-input"),r.hidden=!0,t.append(r)}},{key:"handle",value:function(){var e=this;this.parentElement.addEventListener("click",(function(){e.watchCheckboxes(e.parentElement)}));var t=!0,n=!1,r=void 0;try{for(var o,c=function(){var t=o.value;t.addEventListener("click",(function(){e.processChildItem(t,e.parentForm)}))},u=document.querySelectorAll(".form-check-child")[Symbol.iterator]();!(t=(o=u.next()).done);t=!0)c()}catch(e){n=!0,r=e}finally{try{t||null==u.return||u.return()}finally{if(n)throw r}}}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=9)}({9:function(e,t,n){e.exports=n("ydWM")},ydWM:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var t,r,o;return t=e,(r=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()}));var r=document.createElement("INPUT");r.setAttribute("name","quotes[]"),r.setAttribute("value",e.dataset.value),r.setAttribute("class","child-hidden-input"),r.hidden=!0,t.append(r)}},{key:"handle",value:function(){var e=this;this.parentElement.addEventListener("click",(function(){e.watchCheckboxes(e.parentElement)}));var t=!0,n=!1,r=void 0;try{for(var o,c=function(){var t=o.value;t.addEventListener("click",(function(){e.processChildItem(t,e.parentForm)}))},u=document.querySelectorAll(".form-check-child")[Symbol.iterator]();!(t=(o=u.next()).done);t=!0)c()}catch(e){n=!0,r=e}finally{try{t||null==u.return||u.return()}finally{if(n)throw r}}}}])&&n(t.prototype,r),o&&n(t,o),e}())).handle()}});
|
||||||
|
|
3
public/js/clients/quotes/approve.js
vendored
3
public/js/clients/quotes/approve.js
vendored
@ -1,3 +1,2 @@
|
|||||||
/*! For license information please see approve.js.LICENSE.txt */
|
/*! For license information please see approve.js.LICENSE.txt */
|
||||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=6)}({6:function(e,t,n){e.exports=n("WuMn")},WuMn:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.shouldDisplaySignature=t}var t,r,o;return t=e,(r=[{key:"submitForm",value:function(){document.getElementById("approve-form").submit()}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style"),new SignaturePad(document.getElementById("signature-pad"),{backgroundColor:"rgb(240,240,240)",penColor:"rgb(0, 0, 0)"})}},{key:"handle",value:function(){var e=this;document.getElementById("approve-button").addEventListener("click",(function(){e.shouldDisplaySignature&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){e.submitForm()}))),e.shouldDisplaySignature||e.submitForm()}))}}])&&n(t.prototype,r),o&&n(t,o),e}(),o=document.querySelector('meta[name="require-quote-signature"]').content;new r(Boolean(+o)).handle()}});
|
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=10)}({10:function(e,t,n){e.exports=n("WuMn")},WuMn:function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.shouldDisplaySignature=t}var t,r,o;return t=e,(r=[{key:"submitForm",value:function(){document.getElementById("approve-form").submit()}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style"),new SignaturePad(document.getElementById("signature-pad"),{backgroundColor:"rgb(240,240,240)",penColor:"rgb(0, 0, 0)"})}},{key:"handle",value:function(){var e=this;document.getElementById("approve-button").addEventListener("click",(function(){e.shouldDisplaySignature&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){e.submitForm()}))),e.shouldDisplaySignature||e.submitForm()}))}}])&&n(t.prototype,r),o&&n(t,o),e}(),o=document.querySelector('meta[name="require-quote-signature"]').content;new r(Boolean(+o)).handle()}});
|
||||||
|
|
3
public/js/clients/shared/pdf.js
vendored
3
public/js/clients/shared/pdf.js
vendored
File diff suppressed because one or more lines are too long
3
public/js/setup/setup.js
vendored
3
public/js/setup/setup.js
vendored
File diff suppressed because one or more lines are too long
@ -1,14 +1,17 @@
|
|||||||
{
|
{
|
||||||
"/js/app.js": "/js/app.js?id=8b49701583f407403ddf",
|
"/js/app.js": "/js/app.js?id=8b49701583f407403ddf",
|
||||||
"/css/app.css": "/css/app.css?id=9082c02ea8f150e2a3e9",
|
"/css/app.css": "/css/app.css?id=05d9dbe4a834b13c2fde",
|
||||||
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=725ed8b1ad1518cdffe9",
|
"/js/clients/invoices/action-selectors.js": "/js/clients/invoices/action-selectors.js?id=d16c0e6728b00d329cbb",
|
||||||
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=af22ef81288656e46b7f",
|
"/js/clients/invoices/payment.js": "/js/clients/invoices/payment.js?id=8ce8955ba775ea5f47d1",
|
||||||
|
"/js/clients/payment_methods/authorize-ach.js": "/js/clients/payment_methods/authorize-ach.js?id=30a5db56b004becf4715",
|
||||||
"/js/clients/payment_methods/authorize-authorize-card.js": "/js/clients/payment_methods/authorize-authorize-card.js?id=b0a1bd21a57e12cd491a",
|
"/js/clients/payment_methods/authorize-authorize-card.js": "/js/clients/payment_methods/authorize-authorize-card.js?id=b0a1bd21a57e12cd491a",
|
||||||
"/js/clients/payment_methods/authorize-stripe-card.js": "/js/clients/payment_methods/authorize-stripe-card.js?id=f4c45f0da9868d840799",
|
"/js/clients/payment_methods/authorize-stripe-card.js": "/js/clients/payment_methods/authorize-stripe-card.js?id=f4c45f0da9868d840799",
|
||||||
"/js/clients/payments/process.js": "/js/clients/payments/process.js?id=a97ddadb7af0563c1d4b",
|
"/js/clients/payments/alipay.js": "/js/clients/payments/alipay.js?id=04778cbf46488e8f6b5f",
|
||||||
"/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=3af82eeaf86fe5efaa2c",
|
"/js/clients/payments/checkout.com.js": "/js/clients/payments/checkout.com.js?id=c644b7555ae3c1a918ab",
|
||||||
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=972c7cc8e9d9406babfa",
|
"/js/clients/payments/process.js": "/js/clients/payments/process.js?id=be2b10b1b5e3a727f6e2",
|
||||||
"/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=afc25cff1d17c538d66d",
|
"/js/clients/payments/sofort.js": "/js/clients/payments/sofort.js?id=f9253aea74535bc46886",
|
||||||
"/js/setup/setup.js": "/js/setup/setup.js?id=39f1625d7fbbda12d0e3"
|
"/js/clients/quotes/action-selectors.js": "/js/clients/quotes/action-selectors.js?id=88ff76c9ca1c15fc011b",
|
||||||
|
"/js/clients/quotes/approve.js": "/js/clients/quotes/approve.js?id=9cdbe50bab63dc1dd520",
|
||||||
|
"/js/clients/shared/pdf.js": "/js/clients/shared/pdf.js?id=5df2af6e8ba88b2621d9",
|
||||||
|
"/js/setup/setup.js": "/js/setup/setup.js?id=cd5d37e5eddb88678da4"
|
||||||
}
|
}
|
||||||
|
26
resources/js/clients/payments/checkout.com.js
vendored
Normal file
26
resources/js/clients/payments/checkout.com.js
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
window.CKOConfig = {
|
||||||
|
publicKey: document.querySelector('meta[name="public-key"]').content,
|
||||||
|
customerEmail: document.querySelector('meta[name="customer-email"]')
|
||||||
|
.content,
|
||||||
|
value: document.querySelector('meta[name="value"]').content,
|
||||||
|
currency: document.querySelector('meta[name="currency"]').content,
|
||||||
|
paymentMode: 'cards',
|
||||||
|
cardFormMode: 'cardTokenisation',
|
||||||
|
cardTokenised: function(event) {
|
||||||
|
document.querySelector(
|
||||||
|
'input[name="gateway_response"]'
|
||||||
|
).value = JSON.stringify(event.data);
|
||||||
|
|
||||||
|
document.getElementById('server-response').submit();
|
||||||
|
},
|
||||||
|
};
|
@ -3211,4 +3211,6 @@ return [
|
|||||||
|
|
||||||
'verification' => 'Verification',
|
'verification' => 'Verification',
|
||||||
'complete_your_bank_account_verification' => 'Before using bank account they must be verified.',
|
'complete_your_bank_account_verification' => 'Before using bank account they must be verified.',
|
||||||
|
|
||||||
|
'checkout_com' => 'Checkout.com',
|
||||||
];
|
];
|
||||||
|
@ -1,42 +1,67 @@
|
|||||||
@extends('portal.ninja2020.layout.app')
|
@extends('portal.ninja2020.layout.app')
|
||||||
|
@section('meta_title', ctrans('texts.checkout_com'))
|
||||||
|
|
||||||
<script src="https://cdn.checkout.com/sandbox/js/checkout.js"></script>
|
@push('head')
|
||||||
<form class="payment-form" method="POST" action="https://merchant.com/successUrl">
|
<meta name="public-key" content="{{ $gateway->getPublishableKey() }}">
|
||||||
<script>
|
<meta name="customer-email" content="{{ $customer_email }}">
|
||||||
Checkout.render({
|
<meta name="value" content="{{ $value }}">
|
||||||
publicKey: 'pk_test_6ff46046-30af-41d9-bf58-929022d2cd14',
|
<meta name="currency" content="{{ $currency }}">
|
||||||
paymentToken: 'pay_tok_SPECIMEN-000',
|
|
||||||
customerEmail: 'user@email.com',
|
|
||||||
value: 100,
|
|
||||||
currency: 'GBP',
|
|
||||||
cardFormMode: 'cardTokenisation',
|
|
||||||
cardTokenised: function(event) {
|
|
||||||
console.log(event.data.cardToken);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!--
|
<script src="{{ asset('js/clients/payments/checkout.com.js') }}"></script>
|
||||||
Checkout.render({
|
@endpush
|
||||||
debugMode: {{ $gateway->getConfigField('testMode') ? 'true' : 'false' }},
|
|
||||||
publicKey: '{{ $gateway->getConfigField('publicApiKey') }}',
|
@section('body')
|
||||||
paymentToken: '{{ $token }}',
|
<form action="{{ route('client.payments.response') }}" method="post" id="server-response">
|
||||||
customerEmail: '{{ $contact->email }}',
|
@csrf
|
||||||
customerName: '{{ $contact->getFullName() }}',
|
<input type="hidden" name="gateway_response">
|
||||||
@if( $invoice->getCurrencyCode() == 'BHD' || $invoice->getCurrencyCode() == 'KWD' || $invoice->getCurrencyCode() == 'OMR')
|
<input type="hidden" name="store_card">
|
||||||
value: {{ $invoice->getRequestedAmount() * 1000 }},
|
@foreach($invoices as $invoice)
|
||||||
|
<input type="hidden" name="hashed_ids[]" value="{{ $invoice->hashed_id }}">
|
||||||
|
@endforeach
|
||||||
|
<input type="hidden" name="company_gateway_id" value="{{ $gateway->getCompanyGatewayId() }}">
|
||||||
|
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="container mx-auto">
|
||||||
|
<div class="grid grid-cols-6 gap-4">
|
||||||
|
<div class="col-span-6 md:col-start-2 md:col-span-4">
|
||||||
|
<div class="alert alert-failure mb-4" hidden id="errors"></div>
|
||||||
|
<div class="bg-white shadow overflow-hidden sm:rounded-lg">
|
||||||
|
<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.pay_now') }}
|
||||||
|
</h3>
|
||||||
|
<p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500">
|
||||||
|
{{ ctrans('texts.complete_your_payment') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
|
||||||
|
<dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
|
||||||
|
{{ ctrans('texts.payment_type') }}
|
||||||
|
</dt>
|
||||||
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
|
{{ ctrans('texts.checkout_com') }} ({{ ctrans('texts.credit_card') }})
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6 flex items-center">
|
||||||
|
<dt class="text-sm leading-5 font-medium text-gray-500 mr-4">
|
||||||
|
{{ ctrans('texts.amount') }}
|
||||||
|
</dt>
|
||||||
|
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
|
||||||
|
<span class="font-bold">{{ App\Utils\Number::formatMoney($amount, $client) }}</span>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
<div class="bg-gray-50 px-4 py-5 flex justify-end">
|
||||||
|
<form class="payment-form" method="POST" action="https://merchant.com/successUrl">
|
||||||
|
@if(app()->environment() == 'production')
|
||||||
|
<script async src="https://cdn.checkout.com/js/checkout.js"></script>
|
||||||
@else
|
@else
|
||||||
value: {{ $invoice->getRequestedAmount() * 100 }},
|
<script async src="https://cdn.checkout.com/sandbox/js/checkout.js"></script>
|
||||||
@endif
|
@endif
|
||||||
currency: '{{ $invoice->getCurrencyCode() }}',
|
</form>
|
||||||
widgetContainerSelector: '.payment-form',
|
</div>
|
||||||
widgetColor: '#333',
|
</div>
|
||||||
themeColor: '#3075dd',
|
</div>
|
||||||
buttonColor:'#51c470',
|
</div>
|
||||||
cardCharged: function(event){
|
</div>
|
||||||
location.href = '{{ URL::to('/complete/'. $invitation->invitation_key . '/credit_card?token=' . $transactionToken) }}';
|
@endsection
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
-->
|
|
@ -4,7 +4,6 @@
|
|||||||
@push('head')
|
@push('head')
|
||||||
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
|
<meta name="stripe-publishable-key" content="{{ $gateway->getPublishableKey() }}">
|
||||||
<meta name="using-token" content="{{ boolval($token) }}">
|
<meta name="using-token" content="{{ boolval($token) }}">
|
||||||
<meta name="turbolinks-visit-control" content="reload">
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
||||||
@section('body')
|
@section('body')
|
||||||
|
4
webpack.mix.js
vendored
4
webpack.mix.js
vendored
@ -30,6 +30,10 @@ mix.js("resources/js/app.js", "public/js")
|
|||||||
"resources/js/clients/payments/alipay.js",
|
"resources/js/clients/payments/alipay.js",
|
||||||
"public/js/clients/payments/alipay.js"
|
"public/js/clients/payments/alipay.js"
|
||||||
)
|
)
|
||||||
|
.js(
|
||||||
|
"resources/js/clients/payments/checkout.com.js",
|
||||||
|
"public/js/clients/payments/checkout.com.js"
|
||||||
|
)
|
||||||
.js(
|
.js(
|
||||||
"resources/js/clients/quotes/action-selectors.js",
|
"resources/js/clients/quotes/action-selectors.js",
|
||||||
"public/js/clients/quotes/action-selectors.js"
|
"public/js/clients/quotes/action-selectors.js"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user