1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/PaymentDrivers/Eway/CreditCard.php

94 lines
2.5 KiB
PHP
Raw Normal View History

2021-07-22 03:30:16 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\PaymentDrivers\Eway;
use App\Exceptions\PaymentFailed;
use App\Jobs\Mail\PaymentFailureMailer;
use App\Jobs\Util\SystemLogger;
use App\Models\ClientGatewayToken;
use App\Models\GatewayType;
use App\Models\Payment;
use App\Models\PaymentHash;
use App\Models\PaymentType;
use App\Models\SystemLog;
use App\PaymentDrivers\EwayPaymentDriver;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
class CreditCard
{
2021-07-22 08:05:58 +02:00
public $eway_driver;
2021-07-22 03:30:16 +02:00
2021-07-22 08:05:58 +02:00
public function __construct(EwayPaymentDriver $eway_driver)
2021-07-22 03:30:16 +02:00
{
2021-07-22 08:05:58 +02:00
$this->eway_driver = $eway_driver;
2021-07-22 03:30:16 +02:00
}
public function authorizeView($data)
{
2021-07-22 08:05:58 +02:00
$data['gateway'] = $this->eway_driver;
$data['api_key'] = $this->eway_driver->company_gateway->getConfigField('apiKey');
2021-07-26 05:33:03 +02:00
$data['public_api_key'] = $this->eway_driver->company_gateway->getConfigField('publicApiKey');
2021-07-22 08:05:58 +02:00
return render('gateways.eway.authorize', $data);
2021-07-22 03:30:16 +02:00
}
2021-07-26 05:33:03 +02:00
public function authorizeResponse($request)
2021-07-22 03:30:16 +02:00
{
2021-07-26 05:33:03 +02:00
$this->eway_driver->init();
$transaction = [
'Reference' => 'A12345',
2021-07-22 08:05:58 +02:00
'Title' => 'Mr.',
'FirstName' => 'John',
'LastName' => 'Smith',
2021-07-26 05:33:03 +02:00
'CompanyName' => 'Demo Shop 123',
'JobDescription' => 'PHP Developer',
'Street1' => 'Level 5',
'Street2' => '369 Queen Street',
'City' => 'Sydney',
'State' => 'NSW',
'PostalCode' => '2000',
2021-07-22 08:05:58 +02:00
'Country' => 'au',
2021-07-26 05:33:03 +02:00
'Phone' => '09 889 0986',
'Mobile' => '09 889 6542',
'Email' => 'demo@example.org',
"Url" => "http://www.ewaypayments.com",
2021-07-22 08:05:58 +02:00
'Payment' => [
'TotalAmount' => 0,
],
'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
'Method' => \Eway\Rapid\Enum\PaymentMethod::CREATE_TOKEN_CUSTOMER,
'SecuredCardData' => $request->input('SecuredCardData'),
];
2021-07-26 05:33:03 +02:00
$response = $this->eway_driver->init()->eway->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
2021-07-22 08:05:58 +02:00
2021-07-26 05:33:03 +02:00
dd($response);
2021-07-22 03:30:16 +02:00
}
public function paymentView($data)
{
}
public function processPaymentResponse($request)
{
}
}