Giter VIP home page Giter VIP logo

ovia-incentives's Introduction

Ovia Incentives Program Management App

This is a WordPress plugin designed to manage employer incentive programs to award users of Ovia apps. Events are sent to this backend as users interact with the Ovia apps and then those events are processed in order to qualify users for awards.

Contributing

This plugin utilizes the MWP Framework. To contribute to its development, begin with the documentation here:

Architecture

Models

The following classes are used for persisting data within the app.

  • User - A known user of Ovia apps
  • Employer - An employer who is eligible to use incentive programs
  • EmployerProgram - A record that ties an incentive program to an employer
  • EmployerProgramAward - A record that assigns an award to an employer program
  • UserProgress - A record used to track progress for user in a given program
  • UserAward - A record used to assign an earned award to a user for a completed program

Domains

The following classes are used when extending the domain logic for programs and awards.

  • AbstractProgram - The base class and interface used for creating new programs in the system
  • AbstractAward - The base class and interface used for creating new awards in the system

System Usage

Once the plugin is installed to the backend, a new endpoint becomes available to send events to.

POST {site_url}/wp-json/ovia/v1/events - The posted data is of type Content-Type: application/json and has the following parameters:

  • user_id - The id of the user which the event is being tracked for
  • event - The event data payload (json object). Below is a sample events payload:
{
	"user_id": "abc123",
	"event": {
		"type": "activity",
		"timestamp": 1636360037
	}
}

Backend Design

  • A User should be associated with an Employer in order to participate in programs.
  • An Employer can have one or more registered programs associated with them via the EmployerProgram record.
  • An EmployerProgram can have one or more registered awards associated with it via the EmployerProgramAward record.
  • An incentive program will track the progress of a given user through the program objectives via a UserProgress record.
  • When a user completes all program objectives, an award is given to the user which is represented by a UserAward record.

Adding New Incentive Programs

An incentive program can be added to the system by extending the Ovia\Incentives\Programs\AbstractProgram class. The responsibility of your class is to process events that are received from the api and then track progress for a user through the program objectives. Once program objectives have been reached, the processEvent method of the implementing class should set the $userProgress->status = 'complete' so that any awards for the program will be granted.

After a new program is implemented, it must be registered to the backend using $plugin->registerProgram().

Adding New Awards

An award can be added to the system by extending the Ovia\Incentives\Awards\AbstractAward class. The responsibility of your class is to perform the necessary system interactions that are needed to actually deliver the award to a user.

After a new award has been implemented, it must be registered to the backend using $plugin->registerAward().

ovia-incentives's People

Contributors

kcarwilemiller avatar

Watchers

James Cloos avatar Kevin Carwile 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.