Skip to content

Commit

Permalink
Implement Bank Transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
llorensjj committed Nov 3, 2023
1 parent b7f06b3 commit ed7694f
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 64 deletions.
11 changes: 4 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Omnipay:: Offline dummy
# Omnipay:: Bank transfer

Omnipay Offline Dummy Gateway for testing
Omnipay bank Transfer Gateway

[![tests](https://github.com/descom-es/omnipay-offline-dummy/actions/workflows/tests.yml/badge.svg)](https://github.com/descom-es/omnipay-offline-dummy/actions/workflows/tests.yml)
[![analyse](https://github.com/descom-es/omnipay-offline-dummy/actions/workflows/analyse.yml/badge.svg)](https://github.com/descom-es/omnipay-offline-dummy/actions/workflows/analyse.yml)
[![style-fix](https://github.com/descom-es/omnipay-offline-dummy/actions/workflows/style-fix.yml/badge.svg)](https://github.com/descom-es/omnipay-offline-dummy/actions/workflows/style-fix.yml)

## Instalation

```sh
composer require descom/omnipay-offline-dummy
composer require descom/omnipay-bank-transfer
```

## Basic Usage
Expand All @@ -19,7 +16,7 @@ composer require descom/omnipay-offline-dummy
```php
use Omnipay\Omnipay;

$gateway = Omnipay::create('OfflineDummy');
$gateway = Omnipay::create('BankTransfer');

$request = $gateway->purchase([
'amount' => '12.00',
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "descom/omnipay-offline-dummy",
"description": "Omnipay Offline Dummy Gateway for testing",
"name": "descom/omnipay-bank-transfer",
"description": "Omnipay Bank Transfer Gateway",
"type": "library",
"license": "MIT",
"autoload": {
"psr-4": {
"Omnipay\\OfflineDummy\\": "src/"
"Omnipay\\BankTransfer\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Omnipay\\OfflineDummy\\Tests\\": "tests/"
"Omnipay\\BankTransfer\\Tests\\": "tests/"
}
},
"authors": [
Expand Down Expand Up @@ -40,8 +40,8 @@
"extra": {
"laravel": {
"providers": [
"Omnipay\\OfflineDummy\\App\\AppServiceProvider"
"Omnipay\\BankTransfer\\App\\AppServiceProvider"
]
}
}
}
}
5 changes: 1 addition & 4 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ parameters:
# The level 9 is the highest level
level: 5

checkMissingIterableValueType: false

ignoreErrors:
- '#Property Omnipay\\OfflineDummy\\Tests.* \(Omnipay\\OfflineDummy\\Gateway\) does not accept Omnipay\\Common\\GatewayInterface.#'
checkMissingIterableValueType: false
7 changes: 4 additions & 3 deletions resources/views/payment.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@
<body>
<div class="container">
<header>
<h1>Método de pago de pruebas</h1>
<h1>Método de pago de transferencia bancaria</h1>
<p>
Este método de pago ha sido desarrollado por Descom para testear los procesos de compra.
Este método de pago ha sido desarrollado por Descom para realizar procesos de compra por transferencia
bancaria.
</p>
</header>

Expand Down Expand Up @@ -133,4 +134,4 @@
</div>
</body>

</html>
</html>
2 changes: 1 addition & 1 deletion src/App/App.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Omnipay\OfflineDummy\App;
namespace Omnipay\BankTransfer\App;

class App
{
Expand Down
8 changes: 4 additions & 4 deletions src/App/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Omnipay\OfflineDummy\App;
namespace Omnipay\BankTransfer\App;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Omnipay\OfflineDummy\App\Http\Controllers\PaymentController;
use Omnipay\OfflineDummy\App\Http\Controllers\PaymentProcessController;
use Omnipay\BankTransfer\App\Http\Controllers\PaymentController;
use Omnipay\BankTransfer\App\Http\Controllers\PaymentProcessController;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -19,7 +19,7 @@ public function boot()
{
$this->registerRouters();

$this->loadViewsFrom(__DIR__ . '/../../resources/views', 'omnipay-offline-dummy');
$this->loadViewsFrom(__DIR__ . '/../../resources/views', 'omnipay-bank-transfer');
}

private function registerRouters(): void
Expand Down
6 changes: 3 additions & 3 deletions src/App/Http/Controllers/PaymentController.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Omnipay\OfflineDummy\App\Http\Controllers;
namespace Omnipay\BankTransfer\App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Omnipay\OfflineDummy\App\App;
use Omnipay\BankTransfer\App\App;

class PaymentController extends Controller
{
Expand All @@ -16,7 +16,7 @@ public function __invoke(Request $request)
'amount' => 'required|numeric',
]);

return view('omnipay-offline-dummy::payment', [
return view('omnipay-bank-transfer::payment', [
'transactionId' => $request->input('transaction_id'),
'description' => $request->input('description'),
'amount' => $request->input('amount'),
Expand Down
4 changes: 2 additions & 2 deletions src/App/Http/Controllers/PaymentProcessController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Omnipay\OfflineDummy\App\Http\Controllers;
namespace Omnipay\BankTransfer\App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
Expand All @@ -11,7 +11,7 @@ class PaymentProcessController extends Controller
{
public function __invoke(Request $request)
{
$gateway = Omnipay::create('OfflineDummy');
$gateway = Omnipay::create('BankTransfer');

$response = $gateway->completePurchase($request->all())->send();

Expand Down
8 changes: 4 additions & 4 deletions src/Gateway.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace Omnipay\OfflineDummy;
namespace Omnipay\BankTransfer;

use Omnipay\Common\AbstractGateway;
use Omnipay\OfflineDummy\Message\CompletedPurchaseRequest;
use Omnipay\OfflineDummy\Message\PurchaseRequest;
use Omnipay\BankTransfer\Message\CompletedPurchaseRequest;
use Omnipay\BankTransfer\Message\PurchaseRequest;

class Gateway extends AbstractGateway
{
public function getName()
{
return 'OfflineDummy';
return 'Bank Transfer';
}

public function getDefaultParameters()
Expand Down
4 changes: 2 additions & 2 deletions src/Message/CompletedPurchaseRequest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Omnipay\OfflineDummy\Message;
namespace Omnipay\BankTransfer\Message;

use Omnipay\Common\Message\AbstractRequest;
use Omnipay\OfflineDummy\App\App;
use Omnipay\BankTransfer\App\App;

/**
* PayFast Purchase Request
Expand Down
2 changes: 1 addition & 1 deletion src/Message/CompletedPurchaseResponse.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Omnipay\OfflineDummy\Message;
namespace Omnipay\BankTransfer\Message;

use Omnipay\Common\Message\AbstractResponse;

Expand Down
4 changes: 2 additions & 2 deletions src/Message/PurchaseRequest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Omnipay\OfflineDummy\Message;
namespace Omnipay\BankTransfer\Message;

use Omnipay\Common\Message\AbstractRequest;
use Omnipay\OfflineDummy\App\App;
use Omnipay\BankTransfer\App\App;

/**
* PayFast Purchase Request
Expand Down
4 changes: 2 additions & 2 deletions src/Message/PurchaseResponse.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Omnipay\OfflineDummy\Message;
namespace Omnipay\BankTransfer\Message;

use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RedirectResponseInterface;
Expand All @@ -24,7 +24,7 @@ public function isSuccessful()

public function isRedirect()
{
return true;
return false;
}

public function getRedirectUrl()
Expand Down
8 changes: 4 additions & 4 deletions tests/AppTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Omnipay\OfflineDummy\Tests;
namespace Omnipay\BankTransfer\Tests;

use Illuminate\Support\Facades\Http;
use Omnipay\OfflineDummy\App\App;
use Omnipay\OfflineDummy\Gateway;
use Omnipay\BankTransfer\App\App;
use Omnipay\BankTransfer\Gateway;
use Omnipay\Omnipay;

class AppTest extends TestCase
Expand All @@ -15,7 +15,7 @@ public function setUp(): void
{
parent::setUp();

$this->gateway = Omnipay::create('OfflineDummy');
$this->gateway = Omnipay::create('BankTransfer');

Check failure on line 18 in tests/AppTest.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Omnipay\BankTransfer\Tests\AppTest::$gateway (Omnipay\BankTransfer\Gateway) does not accept Omnipay\Common\GatewayInterface.
}

public function testPurchase()
Expand Down
12 changes: 6 additions & 6 deletions tests/CompletedPurchaseTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Omnipay\OfflineDummy\Tests;
namespace Omnipay\BankTransfer\Tests;

use Omnipay\OfflineDummy\App\App;
use Omnipay\OfflineDummy\Gateway;
use Omnipay\OfflineDummy\Message\CompletedPurchaseRequest;
use Omnipay\OfflineDummy\Message\CompletedPurchaseResponse;
use Omnipay\BankTransfer\App\App;
use Omnipay\BankTransfer\Gateway;
use Omnipay\BankTransfer\Message\CompletedPurchaseRequest;
use Omnipay\BankTransfer\Message\CompletedPurchaseResponse;
use Omnipay\Omnipay;

class CompletedPurchaseTest extends TestCase
Expand All @@ -16,7 +16,7 @@ public function setUp(): void
{
parent::setUp();

$this->gateway = Omnipay::create('OfflineDummy');
$this->gateway = Omnipay::create('BankTransfer');

Check failure on line 19 in tests/CompletedPurchaseTest.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Omnipay\BankTransfer\Tests\CompletedPurchaseTest::$gateway (Omnipay\BankTransfer\Gateway) does not accept Omnipay\Common\GatewayInterface.
}

public function testCompletedPurchaseRequest()
Expand Down
4 changes: 2 additions & 2 deletions tests/GatewayTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Omnipay\OfflineDummy\Tests;
namespace Omnipay\BankTransfer\Tests;

use Omnipay\OfflineDummy\Gateway;
use Omnipay\BankTransfer\Gateway;
use Omnipay\Tests\GatewayTestCase;

class GatewayTest extends GatewayTestCase
Expand Down
18 changes: 9 additions & 9 deletions tests/PurchaseTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Omnipay\OfflineDummy\Tests;
namespace Omnipay\BankTransfer\Tests;

use Omnipay\OfflineDummy\Gateway;
use Omnipay\OfflineDummy\Message\PurchaseRequest;
use Omnipay\OfflineDummy\Message\PurchaseResponse;
use Omnipay\BankTransfer\Gateway;
use Omnipay\BankTransfer\Message\PurchaseRequest;
use Omnipay\BankTransfer\Message\PurchaseResponse;
use Omnipay\Omnipay;

class PurchaseTest extends TestCase
Expand All @@ -15,7 +15,7 @@ public function setUp(): void
{
parent::setUp();

$this->gateway = Omnipay::create('OfflineDummy');
$this->gateway = Omnipay::create('BankTransfer');

Check failure on line 18 in tests/PurchaseTest.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Omnipay\BankTransfer\Tests\PurchaseTest::$gateway (Omnipay\BankTransfer\Gateway) does not accept Omnipay\Common\GatewayInterface.
}

public function testPurchaseRequest()
Expand Down Expand Up @@ -49,10 +49,10 @@ public function testPurchaseRedirect()
$responseHtml = $this->gateway
->purchase(
[
'amount' => '12.00',
'description' => 'Test purchase',
'transactionId' => 1,
]
'amount' => '12.00',
'description' => 'Test purchase',
'transactionId' => 1,
]
)->send()
->getRedirectResponse()
->getContent();
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Omnipay\OfflineDummy\Tests;
namespace Omnipay\BankTransfer\Tests;

use Omnipay\OfflineDummy\App\AppServiceProvider;
use Omnipay\BankTransfer\App\AppServiceProvider;

class TestCase extends \Orchestra\Testbench\TestCase
{
Expand Down

0 comments on commit ed7694f

Please sign in to comment.