mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for CBA Powerboard
This commit is contained in:
parent
033ef9c492
commit
3b8aef5e58
@ -29,8 +29,13 @@ class Settings
|
|||||||
public function __construct(public CBAPowerBoardPaymentDriver $powerboard)
|
public function __construct(public CBAPowerBoardPaymentDriver $powerboard)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGateways()
|
/**
|
||||||
|
* Returns the API response for the gateways
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getGateways(): mixed
|
||||||
{
|
{
|
||||||
$r = $this->powerboard->gatewayRequest('/v1/gateways', (\App\Enum\HttpVerb::GET)->value, [], []);
|
$r = $this->powerboard->gatewayRequest('/v1/gateways', (\App\Enum\HttpVerb::GET)->value, [], []);
|
||||||
|
|
||||||
@ -41,7 +46,12 @@ class Settings
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** We will need to have a process that updates this at intervals */
|
/** We will need to have a process that updates this at intervals */
|
||||||
|
/**
|
||||||
|
* updateSettings from the API
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
public function updateSettings():self
|
public function updateSettings():self
|
||||||
{
|
{
|
||||||
$gateways = $this->getGateways();
|
$gateways = $this->getGateways();
|
||||||
@ -52,12 +62,23 @@ class Settings
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getSettings
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getSettings(): mixed
|
public function getSettings(): mixed
|
||||||
{
|
{
|
||||||
return $this->powerboard->company_gateway->getSettings();
|
return $this->powerboard->company_gateway->getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point for getting the payment gateway configuration
|
||||||
|
*
|
||||||
|
* @param int $gateway_type_id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getPaymentGatewayConfiguration(int $gateway_type_id): mixed
|
public function getPaymentGatewayConfiguration(int $gateway_type_id): mixed
|
||||||
{
|
{
|
||||||
$type = self::GATEWAY_CBA;
|
$type = self::GATEWAY_CBA;
|
||||||
@ -69,7 +90,13 @@ class Settings
|
|||||||
|
|
||||||
return $this->getGatewayByType($type);
|
return $this->getGatewayByType($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the CBA gateway object for a given gateway type
|
||||||
|
*
|
||||||
|
* @param string $gateway_type_const
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
private function getGatewayByType(string $gateway_type_const): mixed
|
private function getGatewayByType(string $gateway_type_const): mixed
|
||||||
{
|
{
|
||||||
$settings = $this->getSettings();
|
$settings = $this->getSettings();
|
||||||
@ -93,10 +120,15 @@ class Settings
|
|||||||
return $gateway->type == $gateway_type_const;
|
return $gateway->type == $gateway_type_const;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the CBA gateway ID for a given gateway type
|
||||||
|
*
|
||||||
|
* @param int $gateway_type_id
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getGatewayId(int $gateway_type_id): string
|
public function getGatewayId(int $gateway_type_id): string
|
||||||
{
|
{
|
||||||
//allows us to override the gateway id for credit card if configured.
|
|
||||||
|
|
||||||
$gateway = $this->getPaymentGatewayConfiguration($gateway_type_id);
|
$gateway = $this->getPaymentGatewayConfiguration($gateway_type_id);
|
||||||
|
|
||||||
|
109
public/build/assets/app-021b0210.js
vendored
Normal file
109
public/build/assets/app-021b0210.js
vendored
Normal file
File diff suppressed because one or more lines are too long
109
public/build/assets/app-e0713224.js
vendored
109
public/build/assets/app-e0713224.js
vendored
File diff suppressed because one or more lines are too long
13
public/build/assets/powerboard-credit-card-bb946fa4.js
vendored
Normal file
13
public/build/assets/powerboard-credit-card-bb946fa4.js
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import{i,w as u}from"./wait-8f4ae121.js";/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://www.elastic.co/licensing/elastic-license
|
||||||
|
*/let a=!1;function l(){const n=document.querySelector("meta[name=public_key]"),e=document.querySelector("meta[name=gateway_id]"),o=document.querySelector("meta[name=environment]"),t=new cba.HtmlWidget("#widget",n==null?void 0:n.content,e==null?void 0:e.content);t.setEnv(o==null?void 0:o.content),t.useAutoResize(),t.interceptSubmitForm("#stepone"),t.onFinishInsert('#server-response input[name="gateway_response"]',"payment_source"),t.setFormFields(["card_name*"]),t.reload();let r=document.getElementById("pay-now");return r.disabled=!1,r.querySelector("svg").classList.add("hidden"),r.querySelector("span").classList.remove("hidden"),document.querySelector('#server-response input[name="gateway_response"]').value="",t}function m(){var n,e,o;(n=document.querySelector("#widget"))==null||n.replaceChildren(),(e=document.querySelector("#widget"))==null||e.classList.remove("hidden"),(o=document.querySelector("#widget-3dsecure"))==null||o.replaceChildren()}function d(){var t;m();const n=l();n.on("finish",()=>{document.getElementById("errors").hidden=!0,y()}),n.on("submit",function(r){document.getElementById("errors").hidden=!0});let e=document.getElementById("pay-now");e.addEventListener("click",()=>{const r=document.getElementById("widget");if(n.getValidationState(),!n.isValidForm()&&r.offsetParent!==null){e.disabled=!1,e.querySelector("svg").classList.add("hidden"),e.querySelector("span").classList.remove("hidden");return}e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden");let s=document.querySelector("input[name=token-billing-checkbox]:checked");s&&(document.getElementById("store_card").value=s.value),r.offsetParent!==null?document.getElementById("stepone_submit").click():document.getElementById("server-response").submit()}),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",r=>{var c;document.getElementById("widget").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",(c=document.querySelector("#powerboard-payment-container"))==null||c.classList.remove("hidden")}),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(r=>r.addEventListener("click",s=>{var c;document.getElementById("widget").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=s.target.dataset.token,(c=document.querySelector("#powerboard-payment-container"))==null||c.classList.add("hidden")}));const o=document.querySelector('input[name="payment-type"]');o&&o.click(),console.log({focusCreditCard:a}),a&&((t=document.getElementById("toggle-payment-with-credit-card"))==null||t.click())}async function y(){try{const n=await g();if(n.status==="not_authenticated"||n==="not_authenticated")throw a=!0,d(),new Error("There was an issue authenticating this payment method.");if(n.status==="authentication_not_supported"){document.querySelector('input[name="browser_details"]').value=null,document.querySelector('input[name="charge"]').value=JSON.stringify(n);let t=document.querySelector("input[name=token-billing-checkbox]:checked");return t&&(document.getElementById("store_card").value=t.value),document.getElementById("server-response").submit()}const e=new cba.Canvas3ds("#widget-3dsecure",n._3ds.token);e.load(),document.getElementById("widget").classList.add("hidden"),e.on("chargeAuthSuccess",function(t){document.querySelector('input[name="browser_details"]').value=null,document.querySelector('input[name="charge"]').value=JSON.stringify(t);let r=document.querySelector("input[name=token-billing-checkbox]:checked");r&&(document.getElementById("store_card").value=r.value),document.getElementById("server-response").submit()}),e.on("chargeAuthReject",function(t){document.getElementById("errors").textContent="Sorry, your transaction could not be processed...",document.getElementById("errors").hidden=!1,a=!0,d()}),e.load()}catch(n){const e=n.message??"Unknown error.";document.getElementById("errors").textContent=`Sorry, your transaction could not be processed...
|
||||||
|
|
||||||
|
${e}`,document.getElementById("errors").hidden=!1,a=!0,d()}}async function g(){const n={name:navigator.userAgent.substring(0,100),java_enabled:navigator.javaEnabled()?"true":"false",language:navigator.language||navigator.userLanguage,screen_height:window.screen.height.toString(),screen_width:window.screen.width.toString(),time_zone:(new Date().getTimezoneOffset()*-1).toString(),color_depth:window.screen.colorDepth.toString()};document.querySelector('input[name="browser_details"]').value=JSON.stringify(n);const e=JSON.stringify(Object.fromEntries(new FormData(document.getElementById("server-response")))),o=document.querySelector("meta[name=payments_route]");try{const t=await fetch(o.content,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:e});return t.ok?await t.json():await t.json().then(r=>{throw new Error(r.message??"Unknown error.")})}catch(t){document.getElementById("errors").textContent=`Sorry, your transaction could not be processed...
|
||||||
|
|
||||||
|
${t.message}`,document.getElementById("errors").hidden=!1,console.error("Fetch error:",t),a=!0,d()}}i()?d():u("#powerboard-credit-card-payment").then(()=>d());
|
@ -1,13 +0,0 @@
|
|||||||
import{i,w as u}from"./wait-8f4ae121.js";/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://www.elastic.co/licensing/elastic-license
|
|
||||||
*/let a=!1;function l(){const t=document.querySelector("meta[name=public_key]"),n=document.querySelector("meta[name=gateway_id]"),o=document.querySelector("meta[name=environment]"),e=new cba.HtmlWidget("#widget",t==null?void 0:t.content,n==null?void 0:n.content);e.setEnv(o==null?void 0:o.content),e.useAutoResize(),e.interceptSubmitForm("#stepone"),e.onFinishInsert('#server-response input[name="gateway_response"]',"payment_source"),e.setFormFields(["card_name*"]),e.reload();let r=document.getElementById("pay-now");return r.disabled=!1,r.querySelector("svg").classList.add("hidden"),r.querySelector("span").classList.remove("hidden"),document.querySelector('#server-response input[name="gateway_response"]').value="",e}function m(){var t,n,o;(t=document.querySelector("#widget"))==null||t.replaceChildren(),(n=document.querySelector("#widget"))==null||n.classList.remove("hidden"),(o=document.querySelector("#widget-3dsecure"))==null||o.replaceChildren()}function d(){var e;m();const t=l();t.on("finish",()=>{document.getElementById("errors").hidden=!0,y()}),t.on("submit",function(r){document.getElementById("errors").hidden=!0});let n=document.getElementById("pay-now");n.addEventListener("click",()=>{const r=document.getElementById("widget");if(t.getValidationState(),!t.isValidForm()&&r.offsetParent!==null){n.disabled=!1,n.querySelector("svg").classList.add("hidden"),n.querySelector("span").classList.remove("hidden");return}n.disabled=!0,n.querySelector("svg").classList.remove("hidden"),n.querySelector("span").classList.add("hidden");let s=document.querySelector("input[name=token-billing-checkbox]:checked");s&&(document.getElementById("store_card").value=s.value),r.offsetParent!==null?document.getElementById("stepone_submit").click():document.getElementById("server-response").submit()}),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",r=>{var c;document.getElementById("widget").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",(c=document.querySelector("#powerboard-payment-container"))==null||c.classList.remove("hidden")}),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach(r=>r.addEventListener("click",s=>{var c;document.getElementById("widget").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=s.target.dataset.token,(c=document.querySelector("#powerboard-payment-container"))==null||c.classList.add("hidden")}));const o=document.querySelector('input[name="payment-type"]');o&&o.click(),console.log({focusCreditCard:a}),a&&((e=document.getElementById("toggle-payment-with-credit-card"))==null||e.click())}async function y(){try{const t=await g();if(t.status==="not_authenticated"||t==="not_authenticated")throw a=!0,d(),new Error("There was an issue authenticating this payment method.");if(t.status==="authentication_not_supported"){document.querySelector('input[name="browser_details"]').value=null,document.querySelector('input[name="charge"]').value=JSON.stringify(t);let e=document.querySelector("input[name=token-billing-checkbox]:checked");return e&&(document.getElementById("store_card").value=e.value),document.getElementById("server-response").submit()}const n=new cba.Canvas3ds("#widget-3dsecure",t._3ds.token);n.load(),document.getElementById("widget").classList.add("hidden"),n.on("chargeAuthSuccess",function(e){document.querySelector('input[name="browser_details"]').value=null,document.querySelector('input[name="charge"]').value=JSON.stringify(e);let r=document.querySelector("input[name=token-billing-checkbox]:checked");r&&(document.getElementById("store_card").value=r.value),document.getElementById("server-response").submit()}),n.on("chargeAuthReject",function(e){document.getElementById("errors").textContent="Sorry, your transaction could not be processed...",document.getElementById("errors").hidden=!1,a=!0,d()}),n.load()}catch(t){document.getElementById("errors").textContent=`Sorry, your transaction could not be processed...
|
|
||||||
|
|
||||||
${t}`,document.getElementById("errors").hidden=!1,a=!0,d()}}async function g(){const t={name:navigator.userAgent.substring(0,100),java_enabled:navigator.javaEnabled()?"true":"false",language:navigator.language||navigator.userLanguage,screen_height:window.screen.height.toString(),screen_width:window.screen.width.toString(),time_zone:(new Date().getTimezoneOffset()*-1).toString(),color_depth:window.screen.colorDepth.toString()};document.querySelector('input[name="browser_details"]').value=JSON.stringify(t);const n=JSON.stringify(Object.fromEntries(new FormData(document.getElementById("server-response")))),o=document.querySelector("meta[name=payments_route]");try{const e=await fetch(o.content,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",Accept:"application/json","X-CSRF-Token":document.querySelector('meta[name="csrf-token"]').content},body:n});return e.ok?await e.json():await e.json().then(r=>{throw new Error(r.message??"Unknown error.")})}catch(e){document.getElementById("errors").textContent=`Sorry, your transaction could not be processed...
|
|
||||||
|
|
||||||
${e.message}`,document.getElementById("errors").hidden=!1,console.error("Fetch error:",e),a=!0,d()}}i()?d():u("#powerboard-credit-card-payment").then(()=>d());
|
|
@ -12,7 +12,7 @@
|
|||||||
"file": "assets/wait-8f4ae121.js"
|
"file": "assets/wait-8f4ae121.js"
|
||||||
},
|
},
|
||||||
"resources/js/app.js": {
|
"resources/js/app.js": {
|
||||||
"file": "assets/app-e0713224.js",
|
"file": "assets/app-021b0210.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_index-08e160a7.js",
|
"_index-08e160a7.js",
|
||||||
"__commonjsHelpers-725317a4.js"
|
"__commonjsHelpers-725317a4.js"
|
||||||
@ -158,7 +158,7 @@
|
|||||||
"src": "resources/js/clients/payments/paytrace-credit-card.js"
|
"src": "resources/js/clients/payments/paytrace-credit-card.js"
|
||||||
},
|
},
|
||||||
"resources/js/clients/payments/powerboard-credit-card.js": {
|
"resources/js/clients/payments/powerboard-credit-card.js": {
|
||||||
"file": "assets/powerboard-credit-card-f8810425.js",
|
"file": "assets/powerboard-credit-card-bb946fa4.js",
|
||||||
"imports": [
|
"imports": [
|
||||||
"_wait-8f4ae121.js"
|
"_wait-8f4ae121.js"
|
||||||
],
|
],
|
||||||
|
@ -221,9 +221,12 @@ async function process3ds() {
|
|||||||
|
|
||||||
canvas.load();
|
canvas.load();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
||||||
|
const msg = error.message ?? 'Unknown error.';
|
||||||
|
|
||||||
document.getElementById(
|
document.getElementById(
|
||||||
'errors'
|
'errors'
|
||||||
).textContent = `Sorry, your transaction could not be processed...\n\n${error}`;
|
).textContent = `Sorry, your transaction could not be processed...\n\n${msg}`;
|
||||||
document.getElementById('errors').hidden = false;
|
document.getElementById('errors').hidden = false;
|
||||||
|
|
||||||
focusCreditCard = true;
|
focusCreditCard = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user