Skip to content

Commit

Permalink
feat(sdk): v1.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
faso-dev committed Dec 23, 2021
1 parent 5b0a8f1 commit 9256aab
Show file tree
Hide file tree
Showing 26 changed files with 623 additions and 556 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4
4 changes: 0 additions & 4 deletions .env.example

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/.idea
/build
/vendor
.env
.phpunit.result.cache
composer.lock
36 changes: 0 additions & 36 deletions Examples/example.php

This file was deleted.

33 changes: 0 additions & 33 deletions Examples/example2.php

This file was deleted.

77 changes: 23 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,35 @@ dans des projets PHP.
## Installation via composer

```shell
composer require faso-dev/orange-money-burkina-sdk v2.beta
composer require faso-dev/orange-money-burkina-sdk
```

## Cas d'utilisation

```php

use Fasodev\Exceptions\PaymentSDKException;
use Fasodev\Sdk\PaymentSDK;
use \Fasodev\Sdk\OrangeMoneyAPI;

require_once __DIR__ . '/../vendor/autoload.php';

try {
$orangeMoneyAPI = new OrangeMoneyAPI(
'username',
'password',
'merchant_number'
);

$orangeMoneyAPI->setAmount(1000) // Montant de la transaction
->setOTPCode(121212) // Code otp fourni par l'utilisateur
->setClientNumber(76819212); // Le numero de client

// Not calling this method will cause the process to default to a test url.
// And the other hand, calling this method and not pass a parameter will
// cause the process to default to the production url as provided by Orange Money
// as of the time of this update.
// If you need to modify the url to make the api request to a custom endpoint,
// you can always provide one as a parameter like so:
// "$orangeMoneyAPI->setUrl('https://custom.orange.bf:9007/payment');"
$orangeMoneyAPI->setUrl();

$sdk = new PaymentSDK($orangeMoneyAPI);

$result = $sdk->handlePayment(); //Enclenchement du processus de paiement

echo "paiement effectué";
echo $result->transID;

} catch (PaymentSDKException $exception) {
echo "Whoops! Unable to process payment. <br /> Error message returned by request: {$exception->getMessage()}. <br /> Error code returned by request: {$exception->getCode()}";
}
use Fasodev\Sdk\Config\TransactionData;
use Fasodev\Sdk\Exception\TransactionException;
use Fasodev\Sdk\OrangeMoneyAPI;
use Fasodev\Sdk\PaymentSDK;

require_once __DIR__ . '/vendor/autoload.php';

try {
$orangeApi = (new OrangeMoneyAPI("username", "password", "merchant_number"))
->withTransactionData(TransactionData::from('client_number', 'payment_amount', 'otp_code'))
->withCustomReference("123456778") //optionnal
->useProdApi() // for production
->withoutSSLVerification() //if you have any troubleshoot with ssl verifcation(not recommended)
;
$response = (new PaymentSDK($orangeApi))->handlePayment();
echo 'Thank you for your purchasse !';
echo $response->getTransactionId();
} catch (TransactionException $exception) {
echo "Whoops! Unable to process payment. <br/>
Error message returned by request: {$exception->getMessage()}. <br/>
Error code returned by request: {$exception->getCode()}";
}
```

## Testing
Expand All @@ -66,23 +52,6 @@ ou
composer tests
```

Vous pouvez également exécuter l'exemple de code en procédant comme suit à partir du terminal de commande:

```bash
php -S localhost:8000 -t Examples/
```

N'oubliez pas de faire une copie du fichier `.env.exampe` et renommez-le en` .env`, puis définissez les variables à utiliser pour exécuter la requête comme ceci:

```
APP_ENV=local
ORANGE_MONEY_USERNAME='johndoe'
ORANGE_MONEY_PASSWORD='password'
ORANGE_MONEY_MERCHANT_ID='123456789'
```

...puis visitez `http://localhost:8000/example.php` ou ` http://localhost:8000/example2.php` depuis votre navigateur.

## Authors

- https://github.com/faso-dev
Expand Down
86 changes: 43 additions & 43 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
{
"name": "faso-dev/orange-money-burkina-sdk",
"type": "library",
"license": "MIT",
"description": "Ce package est une API qui encapsule l'API de base de Orange Money Burkina",
"authors": [
{
"name": "Yentema Nadjoari",
"email": "[email protected]"
"name": "faso-dev/orange-money-burkina-sdk",
"type": "library",
"license": "MIT",
"description": "Ce package est une API qui encapsule l'API de base de Orange Money Burkina",
"authors": [
{
"name": "Yentema Nadjoari",
"email": "[email protected]"
},
{
"name": "S.C Jerôme ONADJA",
"email": "[email protected]"
},
{
"name": "Faso dev",
"homepage": "https://github.com/faso-dev"
}
],
"require": {
"php": ">=7.4",
"ext-curl": "*",
"ext-json": "*",
"ext-simplexml": "*"
},
{
"name": "S.C Jerôme ONADJA",
"email": "[email protected]"
"require-dev": {
"phpunit/phpunit": "^9.5"
},
{
"name": "Faso dev",
"homepage": "https://github.com/faso-dev"
}
],
"require": {
"php": ">=7.3",
"ext-curl": "*",
"ext-json": "*",
"ext-simplexml": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"Fasodev\\": "src/Fasodev/"
}
},
"autoload-dev": {
"psr-4": {
"Fasodev\\Tests\\": "tests"
"autoload": {
"psr-4": {
"Fasodev\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Fasodev\\Tests\\": "tests"
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"tests": "vendor/bin/phpunit",
"testsVerbose": "@tests -vvv"
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"tests": "vendor/bin/phpunit",
"testsVerbose": "@tests -vvv"
}
}
12 changes: 0 additions & 12 deletions src/Fasodev/Exceptions/OrangeMoneyAPIException.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Fasodev/Exceptions/PaymentSDKException.php

This file was deleted.

Loading

0 comments on commit 9256aab

Please sign in to comment.