Skip to content

Commit f6426b0

Browse files
committed
Initial Commit
0 parents  commit f6426b0

20 files changed

Lines changed: 764 additions & 0 deletions
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Browser [e.g. chrome, safari]
29+
- Version [e.g. 22]
30+
31+
**Smartphone (please complete the following information):**
32+
- Device: [e.g. iPhone6]
33+
- OS: [e.g. iOS8.1]
34+
- Browser [e.g. stock browser, safari]
35+
- Version [e.g. 22]
36+
37+
**Additional context**
38+
Add any other context about the problem here.

.github/ISSUE_TEMPLATES/custom.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Custom issue template
3+
about: Describe this issue template's purpose here.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/workflows/lint.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lint
2+
on: [push]
3+
jobs:
4+
lint:
5+
name: PHP Lint
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Setup PHP
9+
uses: shivammathur/setup-php@v2
10+
with:
11+
php-version: 8.2
12+
13+
- name: Cache Composer dependencies
14+
uses: actions/cache@v2
15+
with:
16+
path: /tmp/composer-cache
17+
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
18+
19+
- uses: actions/checkout@master
20+
- name: lint
21+
run: make lint

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/vendor/

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2023] [Devscast]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.PHONY: help
2+
help: ## affiche cet aide
3+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
4+
5+
.PHONY: lint
6+
lint: vendor/autoload.php ## affiche les erreurs de formatage de code
7+
php vendor/bin/ecs
8+
php vendor/bin/phpstan
9+
10+
.PHONY: lint-fix
11+
lint-fix: vendor/autoload.php ## corrige les erreurs de formatage de code
12+
php vendor/bin/ecs --fix
13+
14+
vendor/autoload.php: composer.lock # installe les dépendances PHP
15+
composer update
16+
composer dump-autoload

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Maxicash PHP
2+
3+
![Lint](https://github.com/devscast/maxicash/actions/workflows/lint.yaml/badge.svg)
4+
[![Latest Stable Version](https://poser.pugx.org/devscast/maxicash/version)](https://packagist.org/packages/devscast/maxicash)
5+
[![Total Downloads](https://poser.pugx.org/devscast/maxicash/downloads)](https://packagist.org/packages/devscast/maxicash)
6+
[![License](https://poser.pugx.org/devscast/maxicash/license)](https://packagist.org/packages/devscast/maxicash)
7+
8+
9+
The MaxiCash Integration Platform enables Merchants to integrate with the MaxiCash platform in order to receive payments through their mobile apps or their websites. The API uses JSON to interact with .Net client or open source platforms like PHP. see more at [Maxicash Documentation](https://developer.maxicashapp.com/Default)
10+
11+
## Installation
12+
You can use the PHP client by installing the Composer package and adding it to your application’s dependencies:
13+
14+
```bash
15+
composer require devscast/maxicash
16+
```
17+
## Usage
18+
The MaxiCash Gateway enables the Merchant to Collect Payment into their MaxiCash account using multiple payment channels such as Credit Cards, MaxiCash, Paypal, Mobile Money and Mobile Banking.
19+
20+
### Authentication
21+
* **Step 1**. Download the MaxiCash Mobile App and signup...
22+
* **Step 2**. Contact us to upgrade your account to a Merchant Account info@maxicashapp.com
23+
You will receive a Merchant Form to complete in order to provide your business details and preffered Cashout Wallet or Banking Details.
24+
* **Step 3**. Once the paperwork is completed, you will be issued with Live and Sandbox Accounts (MerchantID and MerchantPassword)
25+
26+
27+
```php
28+
use Devscast\Maxicash\Client as Maxicash;
29+
use Devscast\Maxicash\Credential;
30+
use Devscast\Maxicash\PaymentEntry;
31+
use Devscast\Maxicash\Environment;
32+
33+
$maxicash = new Maxicash(
34+
credential: new Credential('marchand_id', 'marchand_password'),
35+
environment: Environment::SANDBOX // use `Environment::LIVE` for live
36+
);
37+
```
38+
39+
### Create a Payment Entry
40+
```php
41+
$entry = new PaymentEntry(
42+
credential: $maxicash->credential,
43+
amount: intval(47.50 * 100), // amount in cents
44+
reference: "this text will be shown on maxicash payment page",
45+
acceptUrl: "your_website_accept_url",
46+
declineUrl: "your_website_decline_url",
47+
);
48+
```
49+
> **Note**: we hightly recommand your `accept` and `decline` urls to be unique for each transaction, thus users will not be able to reuse them to validate other transactions, on your side save the transaction with a unique generated token (a.k.a transaction reference) and use it as parameter to your accept and decline urls, don't use it for the `PaymentEntry->reference`; once the user is redirected to your accept url, validate the token and grant access to the paid resource (with your own business logic).
50+
51+
52+
### Redirect to Maxicash Gateway
53+
Redirect your user to the maxicash gateway to continue the payment process
54+
55+
```php
56+
$url = $maxicash->queryStringURLPayment($entry);
57+
```
58+
> **Note** : we highly recommand to do a `server side` redirection, this url can be modified and leak your maxicash credentials when displayed to your user in any manner (eg: a link, button or form) ! you can use the `header("Location: $url")` fonction in vanilla PHP or return a `RedirectResponse($url)` in your controller when using Symfony or Laravel frameworks`
59+
60+
### Donate Button for NGOs
61+
Once you signup as an NGO Merchant
62+
63+
```php
64+
$donationUrl = $maxicash->donationUrl()
65+
```
66+
67+
## Features supported
68+
- [x] QueryString URL Payment
69+
- [x] Donate Button for NGOs
70+
- [ ] Form Post Payment
71+
- [ ] Pay Entry Web

composer.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "devscast/maxicash",
3+
"description": "The MaxiCash integration platform enables merchants to integrate with the MaxiCash platform to receive payments via their mobile applications or websites. The API uses JSON to interact with .Net or open source platforms such as PHP.",
4+
"keywords": [
5+
"maxicash",
6+
"mobile money",
7+
"payment gateway",
8+
"api"
9+
],
10+
"type": "library",
11+
"license": "MIT",
12+
"autoload": {
13+
"psr-4": {
14+
"Devscast\\Maxicash\\": "src/"
15+
}
16+
},
17+
"authors": [
18+
{
19+
"name": "bernard-ng",
20+
"email": "ngandubernard@gmail.com"
21+
}
22+
],
23+
"minimum-stability": "stable",
24+
"require-dev": {
25+
"phpstan/phpstan": "^1.10",
26+
"symplify/easy-coding-standard": "^12.0"
27+
},
28+
"require": {
29+
"php": ">=8.2",
30+
"webmozart/assert": "^1.11"
31+
},
32+
"repositories": [
33+
{
34+
"type": "vcs",
35+
"url": "https://github.com/devscast/maxicash"
36+
}
37+
]
38+
}

0 commit comments

Comments
 (0)