Skip to content

devNenyasha/investec-api-wrapper

Repository files navigation

🎄 Investec API Wrapper: Your Festive Helper! 🎁

A delightfully simple PHP wrapper for Investec's Private Banking and ICIB APIs. This wrapper simplifies API integration, handles authentication seamlessly, and empowers developers to build festive solutions! 🎅

🎁 Features at a Glance

Dear Santa, I want an API wrapper that:

  • 🎁 Works with both Private Banking and ICIB
  • 🎅 Handles OAuth automatically
  • 🦌 Simple, fluent interface
  • 🔒 Built-in error handling
  • 🔄 Automatic token refresh
  • ⚡ Rate limiting with backoff
  • 🎨 Has clear examples

🎄 Quick Start

Prerequisites

Make sure you have:

Installation

Set Up the Sandbox (for testing)

  1. Clone the sandbox repository:
git clone https://github.com/devinpearson/programmable-banking-sim.git
cd programmable-banking-sim
npm install
  1. Run the server in a Docker container:
docker build -t investec-sim .
docker run -p 3000:3000 investec-sim
  1. Start the simulator:
npm run dev

Your sandbox will run at http://localhost:3000

Install the wrapper

  1. Install the wrapper via Composer:
composer require melodymbewe/investec-api-wrapper

Step 2: Create Configuration

Create a .env file in your project's root:

CLIENT_ID=your-client-id
CLIENT_SECRET=your-client-secret
API_KEY=your-api-key
BASE_URL_PRIVATE_BANKING=https://api.investec.com/za/pb/v1
BASE_URL_ICIB=https://api.investec.com/za/icib/v1

Step 3: Create your client:

use MelodyMbewe\InvestecApiWrapper\Client;

// Initialize the client
$client = new Client(
'your-client-id',
'your-client-secret',
'your-api-key',

'https://api.investec.com/za/pb/v1', // Private Banking endpoint
'https://api.investec.com/za/icib/v1' // ICIB endpoint
);

// Private Banking Magic 🎁
$accounts = $client->getPrivateBankingAccounts();
$balance = $client->getPrivateBankingBalance($accountId);

// ICIB Magic 🎅
$corporateAccounts = $client->getICIBAccounts();
$corporateBalance = $client->getICIBBalance($accountId);

🧪 Running Comprehensive Tests

For a full test of all features, use the provided test script:

php run-test.php

🔍 Troubleshooting

If you encounter errors:

  1. Check your credentials in .env

  2. Ensure you have the required PHP extensions:

    php -m | grep -E "curl|json|openssl"
  3. Verify your PHP version:

    php -v

For detailed examples, see:

startLine: 1
endLine: 47

##📝 License This project is licensed under the MIT License. See the LICENSE file for details.

🚀 Resources

🎄 A Festive Note This project is a mock environment, perfect for testing and developing your next big idea. Let’s make this season brighter with amazing tech! ✨

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages