Skip to content

Commit

Permalink
Merge pull request #42 from shabayekdes/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
shabayekdes authored Apr 12, 2022
2 parents 6a8bfc8 + d7d6cbf commit 946a161
Show file tree
Hide file tree
Showing 29 changed files with 1,220 additions and 752 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: tests

on:
push:
branches:
- main
- develop
pull_request:
schedule:
- cron: '0 0 * * *'
Expand Down Expand Up @@ -32,5 +35,6 @@ jobs:
- name: Install dependencies
run: |
composer update --prefer-dist --no-interaction --no-progress
- name: Execute tests
run: vendor/bin/phpunit --verbose
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## [Unreleased](https://github.com/shabayekdes/laravel-payment/compare/main...develop)

## [v0.8.0 (2022-04-13)](https://github.com/shabayekdes/laravel-payment/compare/v0.7.1...v0.8.0)

### Added
- Added new payment gateway Mastercard ([#43](https://github.com/shabayekdes/laravel-payment/pull/43)).
- Added payment method models and migration.
- Added new method checkout form to methods.
- Added test cases for mastercard method.

### Changed
- Changed the way we handle the payment gateways from database instead config ([#41](https://github.com/shabayekdes/laravel-payment/pull/41))
- Changed the payment manager to get method from database.

### Enhanced
- Enhanced test cases

## [v0.7.1 (2022-02-05)](https://github.com/shabayekdes/laravel-payment/compare/v0.7.0...v0.7.1)

### Added
Expand Down
48 changes: 39 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Laravel Payment Methods

[![Github Status](https://github.com/shabayekdes/laravel-payment/actions/workflows/tests.yml/badge.svg)](https://github.com/shabayekdes/laravel-payment/actions) [![Styleci Status](https://github.styleci.io/repos/421966331/shield?style=flat&branch=develop)](https://github.styleci.io/repos/421966331) [![Packagist version](https://img.shields.io/packagist/v/shabayek/laravel-payment)](https://packagist.org/packages/shabayek/laravel-payment) [![mit](https://img.shields.io/apm/l/laravel)](https://packagist.org/packages/shabayek/laravel-payment) ![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/shabayek/laravel-payment) ![Packagist Downloads](https://img.shields.io/packagist/dt/shabayek/laravel-payment)

This is a Laravel Package for Payment Gateway Integration. It has a clear and consistent API, is fully unit tested, and even comes with an example application to get you started.
Expand All @@ -23,7 +24,7 @@ php artisan vendor:publish --provider="Shabayek\Payment\PaymentServiceProvider"

```php
$method_id = 1; // payment method id from the config file
$payment = Payment::store($method_id);
$payment = Payment::via($method_id);
```

- Implement customer details contracts on user model by adding **Billable** trait
Expand All @@ -39,14 +40,16 @@ class User extends Authenticatable

}
```

- Following columns is default for billable user
- **first_name**
- **last_name**
- **email**
- **phone**
- **first_name**
- **last_name**
- **email**
- **phone**

if you want to change the column name you can do add public methods on your model with convention name CamelCase like **firstName** + **Column**
FirstNameColumn

```php
/**
* Get the first name.
Expand All @@ -59,8 +62,8 @@ FirstNameColumn
}
```

- Implement address details with relation to address model
> The default relation is **address** if you want change the relation name you can do add public methods on your user model
- Implement address details with relation to address model
> The default relation is **address** if you want change the relation name you can do add public methods on your user model
```php
/**
Expand Down Expand Up @@ -107,6 +110,12 @@ $payment->customer($user);
$payment->addItem($name, $price, $quantity, $description);
```

- Set transaction id will send to gateway

```php
$payment->transaction($transaction_id);
```

- Check the payment is online to get pay url

```php
Expand All @@ -115,7 +124,14 @@ if ($payment->isOnline()) {
}
```

-Print the errors messages
- The MasterCard method adds a new way to get the checkout form
> pass the transaction model will update successIndicator and return view with checkout form
```php
$payment->checkoutForm(Transaction $transaction);
```

- Print the errors messages

```php
$payment->getErrors();
Expand All @@ -136,14 +152,28 @@ $payment = $payment->pay($request);
```

- Check the payment status

```php
$method_id = 1; // payment method id from the config file
$payment_order_id = 111; // payment order id
$payment_status = Payment::store($method_id)->verify($payment_order_id);
$payment_status = Payment::via($method_id)->verify($payment_order_id);
```

## Change log

Please see [CHANGELOG](https://github.com/shabayekdes/laravel-payment/blob/main/CHANGELOG.md) for more information on what has been changed recently.


## Contributing

Please see [CONTRIBUTING](https://github.com/shabayekdes/laravel-payment/blob/main/CONTRIBUTING.md) for details.


## Security Vulnerabilities

If you've found a bug regarding security please mail [[email protected]](mailto:[email protected]) instead of using the issue tracker.


## License

The Laravel payment methods package is open-sourced software licensed under the [MIT license](https://github.com/shabayekdes/laravel-payment/blob/main/LICENSE).
Loading

0 comments on commit 946a161

Please sign in to comment.