Code Monkey home page Code Monkey logo

faso-dev / orange-money-burkina-sdk Goto Github PK

View Code? Open in Web Editor NEW
32.0 5.0 12.0 44 KB

Unofficial SDK for the Orange Money Burkina base API, designed to simplify its usage and integration by developers into PHP projects. This SDK does not handle the contractual aspect with Orange, and developers must contact Orange directly to obtain access and credentials.

License: MIT License

PHP 100.00%
orange orange-money orange-money-burkina orange-burkina transfert-d-argent transfert orangemoney

orange-money-burkina-sdk's Introduction

sdk orange-money-burkina

SDK non officiel de l'API de base de Orange Money Burkina afin de faciliter son usage et son intégration par les développeurs dans des projets PHP.

Installation via composer

composer require faso-dev/orange-money-burkina-sdk

Cas d'utilisation

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

Exécutez les tests avec:

vendor/bin/phpunit

ou

composer tests

Authors

Merci de contribuer !

orange-money-burkina-sdk's People

Contributors

faso-dev avatar issadicko avatar tsommie avatar yenteck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

orange-money-burkina-sdk's Issues

Using a strict float type-hint for amount.

    /**
     * Transaction amount
     * @var float
     */
    private $amount;

    /**
     * @param float $amount
     * @return OrangeMoneyAPI
     */
    public function setAmount(float $amount): self
    {
        $this->amount = $amount;
        return $this;
    }

Using a float type-hint for this is a bit strict, it is possible that the value may come as an integer or string, I suggest using mixed or int|string, what do you think?

Leave URL open for modification by the users of the package.

    return static::isProduction()
            ? 'https://apiom.orange.bf:9007/payment'
            : 'https://testom.orange.bf:9008/payment';

I don't think the URL should be hardcoded into the project. This should be moved into the .env file. If Orange should update its API URL, everyone using this package will have to wait for the maintainers to update the code. I suggest leaving it open for modification by the users of the package.

I can make a PR.

Property visibility scope.

    /**
     * Transaction amount
     * @var float
     */
    private $amount;

    /**
     * @var string
     */
    private $otp;

    /**
     * @var string
     */
    private $username;

    /**
     * @var string
     */
    private $password;

    /**
     * @var
     */
    private $merchantNumber;

    /**
     * @var
     */
    private $clientNumber;

    /**
     * @var
     */
    private $referenceNumber = "";

    /**
     * @var string
     */
    private $url;

Using private on the properties makes it impossible to extend this class, I suggest using protected.

Notice: Undefined property: stdClass::$status

La fonction OMSDK->processPayment() renvoie quoi? au cas ou la requête n'aboutit même pas au serveur de Orange Money. Il va falloir gérer cette issue. Je suggere de renvoyer null au cas ou ca ne marche pas .
Ainsi modifier processPayment comme suit :

public function processPayment()
{ 
       //curl renvoi null au cas ou le serveur ou la connexion est indisponible  
       $RQ = $this->requestApi();

       if($RQ){
            $parsed = Xml::toObject("<response>" . $RQ . "</response>");
       return $parsed;

       }else return null;
       
 }

cURL error code 28

Salut,
deja merci pour ce travail abattu. cela facilite un temps soit peu ce processus d'integration de l'API Orange Money dans nos differents projet web.
J'ai une preoccupation: j'obtiens cette erreur lorsque j'essai de faire un paiement.
Failed to connect to testom.orange.bf port 9008 after 130629 ms: Connection timed out
J'ai modifier le connect_timeout, read_timeout et le timeout mais c'est toujours pareille.

savez-vous pourquoi cette erreur persite?
pouvez-vous m'apporter votre assistance?
Merci d'avance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.