2017 © Pedro Peláez
 

library bank

A bank module for the MCC api

image

kylemassacre-mcc/bank

A bank module for the MCC api

  • Saturday, March 26, 2016
  • by KyleMassacre
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

MCC-API-Bank

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:, (*1)

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

Run the artisan command: php artisan vendor:publish --provider="Modules\Bank\Providers\BankServiceProvider", (*2)

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, (*3)

{
  "message": "422 Unprocessable Entity",
  "errors": {
    "amount": [
      "You must provide a valid transaction amount",
      "Your transaction amount must be at least $2"
    ]
  }
  ```
  *_Not enough funds_*
  ```json
  {
    "message": "You don't have enough funds to put that in your bank",
    "status_code": 200,
  }
  ```
  ```json
  {
    "message": "You don't have enough funds in your Cyber Bank",
    "status_code": 200,
  }
  ```
  *_No Bank_*
  ```json
  {
    "message": "You must own a Cyber Bank",
    "status_code": 200,
  }
  ```
  *_Purchase Bank_*
  ```json
{
    "success": "You have purchased a Bank"
}

Can't afford Bank, (*4)

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

Already Own Bank, (*5)

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

The Versions

26/03 2016

dev-master

9999999-dev

A bank module for the MCC api

  Sources   Download

The Requires

 

26/03 2016

v1.0.0

1.0.0.0

A bank module for the MCC api

  Sources   Download

The Requires