Powerboard

This commit is contained in:
David Bomba 2024-09-06 15:15:33 +10:00
parent 30ff490977
commit 54c1831228
3 changed files with 32 additions and 12 deletions

View File

@ -55,7 +55,9 @@ class CreditCard implements LivewireMethodInterface
public function paymentData(array $data): array public function paymentData(array $data): array
{ {
// $description = $this->stripe->getDescription(false); // $description = $this->stripe->getDescription(false);
$merge = [
'publicKey' => $this->powerboard->company_gateway->getConfigField('publicKey'),
];
// $payment_intent_data = [ // $payment_intent_data = [
// 'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()), // 'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
// 'currency' => $this->stripe->client->getCurrencyCode(), // 'currency' => $this->stripe->client->getCurrencyCode(),
@ -72,7 +74,7 @@ class CreditCard implements LivewireMethodInterface
// $data['intent'] = $this->stripe->createPaymentIntent($payment_intent_data); // $data['intent'] = $this->stripe->createPaymentIntent($payment_intent_data);
// $data['gateway'] = $this->stripe; // $data['gateway'] = $this->stripe;
// return $data; return array_merge($data, $merge);
} }
public function paymentView(array $data) public function paymentView(array $data)

View File

@ -12,16 +12,17 @@
namespace App\PaymentDrivers; namespace App\PaymentDrivers;
use App\Jobs\Util\SystemLogger;
use App\Models\ClientGatewayToken;
use App\Models\GatewayType;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Payment; use App\Models\Payment;
use App\Models\PaymentHash;
use App\Models\PaymentType;
use App\Models\SystemLog; use App\Models\SystemLog;
use App\Utils\HtmlEngine; use App\Utils\HtmlEngine;
use App\Models\GatewayType;
use App\Models\PaymentHash;
use App\Models\PaymentType;
use App\Jobs\Util\SystemLogger;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use App\Models\ClientGatewayToken;
use App\PaymentDrivers\CBAPowerBoard\CreditCard;
/** /**
* Class CBAPowerBoardPaymentDriver. * Class CBAPowerBoardPaymentDriver.
@ -36,9 +37,13 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
public $refundable = true; public $refundable = true;
protected $api_endpoint = ''; protected $api_endpoint = 'https://api.powerboard.commbank.com.au/';
protected $widget_endpoint = ''; protected $widget_endpoint = 'https://widget.powerboard.commbank.com.au/sdk/latest/widget.umd.min.js';
public static $methods = [
GatewayType::CREDIT_CARD => CreditCard::class,
];
/** /**
* Returns the gateway types. * Returns the gateway types.
*/ */
@ -51,9 +56,11 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
return $types; return $types;
} }
public function init() public function init(): self
{ {
// $this->company_gateway->getConfigField('account_id') if($this->company_gateway->getConfigField('testMode')) {
$this->widget_endpoint = 'https://widget.preproduction.powerboard.commbank.com.au/sdk/latest/widget.umd.min.js';
$this->api_endpoint = 'https://api.preproduction.powerboard.commbank.com.au/'; }
return $this; return $this;
} }
@ -113,7 +120,6 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash) public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
{ {
return (new Charge($this))->tokenBilling($cgt, $payment_hash);
} }
public function importCustomers() public function importCustomers()
@ -124,6 +130,8 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
{ {
$this->init(); $this->init();
return true;
// try { // try {
// $this->verifyConnect(); // $this->verifyConnect();
// return true; // return true;

View File

@ -0,0 +1,10 @@
<script src="https://widget.preproduction.powerboard.commbank.com.au/sdk/latest/widget.umd.min.js"></script>
<script>
var widget = new cba.HtmlWidget('#widget', 'PUBLIC_KEY', 'GATEWAY_ID');
widget.setEnv("preproduction_cba");
widget.load();
</script>
<div id="widget"></div>