Skip to content

Commit

Permalink
Update Readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
aimensasi committed Jan 26, 2021
1 parent 5a850ab commit 3cdf2b7
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 59 deletions.
19 changes: 0 additions & 19 deletions .scrutinizer.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .styleci.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

90 changes: 79 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Very short description of the package

[![Latest Version on Packagist](https://img.shields.io/packagist/v/aimensasi/fpx.svg?style=flat-square)](https://packagist.org/packages/aimensasi/fpx)
[![Build Status](https://img.shields.io/travis/aimensasi/fpx/master.svg?style=flat-square)](https://travis-ci.org/aimensasi/fpx)
[![Quality Score](https://img.shields.io/scrutinizer/g/aimensasi/fpx.svg?style=flat-square)](https://scrutinizer-ci.com/g/aimensasi/fpx)
[![Total Downloads](https://img.shields.io/packagist/dt/aimensasi/fpx.svg?style=flat-square)](https://packagist.org/packages/aimensasi/fpx)

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
This package provides laravel implementations for Paynet FPX services.

## Installation

Expand All @@ -15,18 +10,91 @@ You can install the package via composer:
composer require aimensasi/fpx
```

Then run the publish command to publish the config files and support controller

```bash
php artisan vendor:publish --provider="Aimensasi\FPX\FPXServiceProvider"
```

## Setups

1. Add your redirect urls and your Seller and Exchange Id to the `.env` file.

```php
FPX_INDIRECT_URL=https://app.test/payments/fpx/callback
FPX_INDIRECT_PATH=payments/fpx/callback
FPX_DIRECT_URL=https://app.test/payments/fpx/direct-callback
FPX_DIRECT_PATH=payments/fpx/direct-callback

FPX_EXCHANGE_ID=
FPX_SELLER_ID=
```

2. After generating your certificates add them to your app. By default, we look for the certificates inside the following directives.

```php
'certificates' => [
'uat' => [
'disk' => 'local', // S3 or Local. Don't put your certificate in public disk
'dir' => '/certificates/uat',
],
'production' => [
'disk' => 'local', // S3 or Local. Don't put your certificate in public disk
'dir' => '/certificates/prod',
]
],
```

You can override the defaults by updating the config file.

3. Run migration to add the banks table

```bash
php artisan migrate
```


## Usage

1. First run the following commands to seed the banks list.

``` bash
php artisan fpx:banks
```

you should schedule the fpx:banks Artisan command to run daily:

```php
$schedule->command('fpx:banks')->daily();
```


Once the banks are seeded, you can add the pay component to your view.

``` php
// Usage description here
<x-fpx-pay
:reference-id="$invoice->id"
:datetime="$invoice->created_at->format('Ymdhms')"
:amount="$invoice->total"
:customer-name="$company->name"
:customer-email="$company->owner->email"
product-description="Salary Invoice">
```

### Testing
During testing, you can use the `test-mode` attribute to override the provided amount to 'MYR 1.00'

``` bash
composer test
``` php
<x-fpx-pay
:reference-id="$invoice->id"
:datetime="$invoice->created_at->format('Ymdhms')"
:amount="$invoice->total"
:customer-name="$company->name"
:customer-email="$company->owner->email"
product-description="Salary Invoice"
test-mode>
```


### Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
Expand All @@ -50,4 +118,4 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio

## Laravel Package Boilerplate

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).
This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@
"laravel": {
"providers": [
"Aimensasi\\FPX\\FPXServiceProvider"
],
"aliases": {
"FPX": "Aimensasi\\FPX\\Facades\\FPX"
}
]
}
}
}

0 comments on commit 3cdf2b7

Please sign in to comment.