mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 06:14:31 -04:00
powerboard
This commit is contained in:
parent
454f7df01e
commit
6876a647ca
@ -30,18 +30,27 @@ class CreditCard implements LivewireMethodInterface
|
|||||||
|
|
||||||
public function authorizeView(array $data)
|
public function authorizeView(array $data)
|
||||||
{
|
{
|
||||||
$intent['intent'] = $this->stripe->getSetupIntent();
|
|
||||||
|
|
||||||
return render('gateways.powerboard.credit_card.authorize', array_merge($data, $intent));
|
return render('gateways.powerboard.credit_card.authorize', array_merge($data, []));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function authorizeResponse($request)
|
public function authorizeResponse($request)
|
||||||
{
|
{
|
||||||
$this->stripe->init();
|
$this->powerboard->init();
|
||||||
|
|
||||||
|
$payment_source = $request->gateway_response;
|
||||||
|
|
||||||
|
$payload = [
|
||||||
|
'token' => $payment_source,
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->powerboard->gatewayRequest('/v1/vault/payment_sources', 'post', $payload, []);
|
||||||
|
|
||||||
|
|
||||||
// $stripe_response = json_decode($request->input('gateway_response'));
|
// $stripe_response = json_decode($request->input('gateway_response'));
|
||||||
|
|
||||||
$customer = $this->powerboard->findOrCreateCustomer();
|
// $customer = $this->powerboard->findOrCreateCustomer();
|
||||||
|
|
||||||
// $this->stripe->attach($stripe_response->payment_method, $customer);
|
// $this->stripe->attach($stripe_response->payment_method, $customer);
|
||||||
|
|
||||||
@ -61,22 +70,8 @@ class CreditCard implements LivewireMethodInterface
|
|||||||
'gateway' => $this->powerboard,
|
'gateway' => $this->powerboard,
|
||||||
'environment' => $this->powerboard->environment,
|
'environment' => $this->powerboard->environment,
|
||||||
];
|
];
|
||||||
// $payment_intent_data = [
|
|
||||||
// 'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
|
||||||
// 'currency' => $this->stripe->client->getCurrencyCode(),
|
|
||||||
// 'customer' => $this->stripe->findOrCreateCustomer(),
|
|
||||||
// 'description' => $description,
|
|
||||||
// 'metadata' => [
|
|
||||||
// 'payment_hash' => $this->stripe->payment_hash->hash,
|
|
||||||
// 'gateway_type_id' => GatewayType::CREDIT_CARD,
|
|
||||||
// ],
|
|
||||||
// 'setup_future_usage' => 'off_session',
|
|
||||||
// 'payment_method_types' => ['card'],
|
|
||||||
// ];
|
|
||||||
|
|
||||||
// $data['intent'] = $this->stripe->createPaymentIntent($payment_intent_data);
|
|
||||||
// $data['gateway'] = $this->stripe;
|
|
||||||
|
|
||||||
|
|
||||||
return array_merge($data, $merge);
|
return array_merge($data, $merge);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +90,7 @@ class CreditCard implements LivewireMethodInterface
|
|||||||
public function paymentResponse(PaymentResponseRequest $request)
|
public function paymentResponse(PaymentResponseRequest $request)
|
||||||
{
|
{
|
||||||
nlog($request->all());
|
nlog($request->all());
|
||||||
|
|
||||||
// $this->stripe->init();
|
// $this->stripe->init();
|
||||||
|
|
||||||
// $state = [
|
// $state = [
|
||||||
|
@ -37,7 +37,7 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public $refundable = true;
|
public $refundable = true;
|
||||||
|
|
||||||
public string $api_endpoint = 'https://api.powerboard.commbank.com.au/';
|
public string $api_endpoint = 'https://api.powerboard.commbank.com.au';
|
||||||
|
|
||||||
public string $widget_endpoint = 'https://widget.powerboard.commbank.com.au/sdk/latest/widget.umd.min.js';
|
public string $widget_endpoint = 'https://widget.powerboard.commbank.com.au/sdk/latest/widget.umd.min.js';
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
|
|||||||
{
|
{
|
||||||
if($this->company_gateway->getConfigField('testMode')) {
|
if($this->company_gateway->getConfigField('testMode')) {
|
||||||
$this->widget_endpoint = 'https://widget.preproduction.powerboard.commbank.com.au/sdk/latest/widget.umd.min.js';
|
$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/';
|
$this->api_endpoint = 'https://api.preproduction.powerboard.commbank.com.au';
|
||||||
$this->environment = 'preproduction_cba';
|
$this->environment = 'preproduction_cba';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,4 +151,20 @@ class CBAPowerBoardPaymentDriver extends BaseDriver
|
|||||||
// return false;
|
// return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function gatewayRequest(string $uri, string $verb, array $payload, array $headers = [])
|
||||||
|
{
|
||||||
|
$r = Http::withHeaders($this->getHeaders($headers))
|
||||||
|
->{$verb}($this->api_endpoint.$uri, $payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeaders(array $headers = []): array
|
||||||
|
{
|
||||||
|
return array_merge([
|
||||||
|
'x-user-secret-key' => $this->company_gateway->getConfigField('secretKey'),
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
],
|
||||||
|
$headers);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user