There is no license information available for the latest version (v1.0.0) of this package.

A bank module for the MCC api

v1.0.0 2016-03-26 14:22 UTC

This package is not auto-updated.

Last update: 2024-05-08 22:36:06 UTC


README

For Laravel 5.1

Installation

Install via cli php artisan module:install kylemassacre-mcc/bank Open up app/Providers/AppServiceProvider.php and add in the register method:

$this->app->bind([
    ...
    \Modules\Bank\Providers\BankServiceProvider::class
]);

Run the artisan command: php artisan vendor:publish --provider="Modules\Bank\Providers\BankServiceProvider"

API Endpoints:

Method Endpoint Route Name
GET/HEAD /api/cyberbank/buy cyber.buy
POST /api/cyberbank/deposit cyber.deposit
POST /api/cyberbank/withdraw cyber.withdraw
GET/HEAD /api/bank/buy bank.buy
POST /api/bank/deposit bank.deposit
POST /api/bank/withdraw bank.withdraw

Sample Responses

Successful Withdraw
{
  "success": {
    "message": "You have withdrew $1 from your account",
    "txn_details": {
      "amount": "$2",
      "past_balance": "$5",
      "new_balance": "$3",
      "fees": "$1"
    }
  }
}
Successful Deposit
{
  "success": {
    "message": "You have deposited $1 into your account",
    "txn_details": {
      "amount": "$2",
      "past_balance": "$3",
      "new_balance": "$4",
      "fees": "$1"
    }
  }
}
Invalid Responses

Malformed Amount

{
  "message": "422 Unprocessable Entity",
  "errors": {
    "amount": [
      "You must provide a valid transaction amount",
      "Your transaction amount must be at least $2"
    ]
  }

Not enough funds

{
  "message": "You don't have enough funds to put that in your bank",
  "status_code": 200,
}
{
  "message": "You don't have enough funds in your Cyber Bank",
  "status_code": 200,
}

No Bank

{
  "message": "You must own a Cyber Bank",
  "status_code": 200,
}

Purchase Bank

{
  "success": "You have purchased a Bank"
}

Can't afford Bank

{
  "message": "You do not have $10,000,000 to open an account",
  "status_code": 200,
}

Already Own Bank

{
  "message": "You already own a Bank",
  "status_code": 200,
}