Giter VIP home page Giter VIP logo

prepaid-card-as-abstract's Introduction

Cubalider Prepaid Card As Abstract

This library provides an abstraction for prepaid card concepts.

Category

Prepaid cards are grouped into categories.

A category has a strid (string id) property to identify it and a description. It has a cost and an utility, both properties represented in money format.

You need to create your manager implementing CategoryManagerInterface.

// $manager = new CategoryManager();

$currency = $currencyManager->pick('USD');

// Adds category
$category = new Category();
$category->setStrid('10p');
$category->setDescription('10 points');
$category->setCost(new Money(8, $currency));
$category->setUtility(new Money(10, $currency));
$manager->add($category);

// Picks a category using an array of criteria
$category = $manager->pick(array('strid' => '10p'));

// Picks a category using a strid directly
$category = $manager->pick('10p');

// Removes a category
$manager->remove($category);

// Collects categories
$categories = $manager->collect();

Card

A card has a code, needed when the card is going to be used.

It belongs to a category, representing its cost and utility.

It has a status, "new" when the card is created, "fetched" when the card is fetched from the system to the client, and "utilized" when the client uses the card.

You need to create your manager implementing CardManagerInterface.

// $manager = new CardManager();

// Fetches a card from given category
$card = $manager->fetch($category);

// The client can store a reference to the card and use it in a future

// Mark card as utilized after it's used
$manager->utilize($card);

prepaid-card-as-abstract's People

Contributors

yosmanyga avatar mectwork avatar

Watchers

Nabel Hernandez Martín avatar

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.