mouctar/orange-money-bundle

Orange Money for Symfony

0.1 2023-11-08 19:01 UTC

This package is auto-updated.

Last update: 2024-04-14 00:07:23 UTC


README

The OrangeMoneyBundle makes integration easy of the Orange Money payment API on an app Symfony

Installation and configuration

Pretty simple with composer, run

composer require mouctar/orange-money-bundle

Add OrangeMoneyBundle to your application kernel

If you don't use flex (you should), you need to manually enable bundle:

// app/AppKernel.php
public function registerBundles()
{
    return [
        // ...
        new Tm\OrangeMoneyBundle\OrangeMoneyBundle(),
        // ...
    ];
}

Configuration example

You can configure default application

YAML:

# config/packages/orange_money.yaml
orange_money:
  client_id: '%env(OM_CLIENT_ID)%'
  client_secret: '%env(OM_CLIENT_SECRET)%'
  environment: sandbox

How it uses

Fetching Orange Money Public key

<?php
// src/Controller/LuckyController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;

class PublicKeyController extends AbstractController
{
    public function fetch(PublicKeyService $service): JsonResponse
    {
        return new JsonResponse($service());
    }
}