Coder Social home page Coder Social logo

api-platba-mobilom's Introduction

Rozhranie webovej služby „Platba Mobilom“

Trieda PlatbaMobilom predstavuje abstraktné rozhranie (vrstvu) pre komunikáciu so serverom webovej služby platbamobilom.zoznam.sk.

Rozhranie

class PlatbaMobilom extends IntellObject {
	/* constants */
	const string SERVICE_IP = '109.74.149.29' ;
	const string SERVICE_MIME_TYPE = 'text/plain' ;
	const string RESULT_OK = "OK" ;
	const string RESULT_ERROR = "FAIL" ;
	const string ARG_ID = 'id' ;
	const string ARG_RESULT = 'res' ;
	const string ARG_TEL = 'msisdn' ;
	const string ARG_MESSAGE = 'text';

	/* events */	
	/* methods */
	PlatbaMobilom __construct(string $urlReceive, string $urlParse, string $keyword)
	void handle()
	void setReceiveHandler(callback $handler)
	void setParseHandler(callback $handler)
	static FeedBack createFeedBack()
}

Implementácia

Štandardné použitie triedy je nasledovné:

<?php

require "source/PlatbaMobilom/PlatbaMobilom.php";
use PlatbaMobilom\PlatbaMobilom;

$service = new PlatbaMobilom('/prijatie', '/spracovanie', 'app');

/**
 * Receive handler. First URL - see docs.
 *
 * @param int   phone number of customer
 * @param string   the text of message customer sent, without leading application keyword
 * @param string(40)   sha-1 hash of received identifier
 * @return PlatbaMobilom\FeedBack   instance of FeedBack carriage
 */
$service->receiveHandler = function($phoneNo, $messageText, $identifier) {
	// prijatie správy
	// návratová hodnota musí byť PlatbaMobilom\FeedBack
	// PlatbaMobilom::createFeedBack(string $message [, float $price = 0.0 ])
	return PlatbaMobilom::createFeedBack("Dakujeme za Vasu SMS spravu.");
};


/**
 * Parse handler. Second URL.
 *
 * @param string   Either one of PlatbaMobilom::RESULT_OK or PlatbaMobilom::RESULT_ERROR constants
 * @param string(40)   sha-1 hash of received identifier
 * @return bool   true if parse was successful, false otherwise
 */
$service->parseHandler = function($result, $identifier) {
	// spracovanie platby
};

$service->handle();


?>

api-platba-mobilom's People

Contributors

kubo2 avatar

Watchers

 avatar  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.