Download the PHP package nikapps/saman-ussd without Composer

On this page you can find all versions of the php package nikapps/saman-ussd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package saman-ussd

[obsolete] Saman USSD

Obsolete package - payment with USSD is forbidden by Iranian central bank (more info)

Travis (.org) branch Latest Stable Version License

Saman *724*

A php package for connecting to Saman *724# payment gateway.

Table of contents:

Installation

Using Composer, install this package by running this command:

composer require nikapps/saman-ussd

Usage

Then set your listener:

$samanUssd->setListener(new Listener());

2. Callbacks:

Also you can pass a closure for each soap call:

$samanUssd->onProductInfo(function (array $codes, $language) {

    // TODO: return response

});

$samanUssd->onCallSale(function (array $codes, $amount, $phone, $sepId, $language) {

    // TODO: return response

});

$samanUssd->onExecuteSale(function ($providerId) {

    // TODO: return response

});

$samanUssd->onCheckStatus(function ($providerId) {

    // TODO: return response

});

Responses

For each api call, you should return its response object:

onProductInfo

When method GetProductInfo is called on your soap server, onProductInfo will be called on your listener and you should return an instance of Nikapps\SamanUssd\Responses\ProductInfoResponse:

public function onProductInfo(array $codes, $language)
{

    // TODO check codes

    return (new ProductInfoResponse)
        ->successful()
        ->amount(1000)
        ->description('Success!');
}

If the given codes are incorrect:

return (new ProductInfoResponse())
    ->failed()
    ->reason('Failed!');

If you want to set Terminal and Wage:

return (new ProductInfoResponse)
    ->successful()
    ->amount(1000)
    ->description('Success!')
    ->terminal(12345)
    ->wage(200);

Alias methods:


onCallSale

When method CallSaleProvider is called on your soap server, onCallSale will be called on your listener and you should return an instance of Nikapps\SamanUssd\Responses\CallSaleResponse:

public function onCallSale(array $codes, $amount, $phone, $sepId, $language)
{

    // Todo check sale

    return (new CallSaleResponse)
        ->successful()
        ->providerId('provider_id');
}

If something goes wrong:

return (new CallSaleResponse)
    ->failed()
    ->reason('Failed!');

Alias methods:


onExecuteSale

When method ExecSaleProvider is called on your soap server, onExecuteSale will be called on your listener and you should return an instance of Nikapps\SamanUssd\Responses\ExecuteSaleResponse:

public function onExecuteSale($providerId)
{
    return (new ExecuteSaleResponse)
        ->successful()
        ->description('Success!'); 
}

If something goes wrong:

return (new ExecuteSaleResponse)
    ->failed()
    ->reason('Failed!');

Alias method:


onCheckStatus

When method CheckStatus is called on your soap server, onCheckStatus will be called on your listener and you should return an instance of Nikapps\SamanUssd\Responses\CheckStatusResponse:

public function onCheckStatus($providerId)
{
    // Todo check provider id

    return (new CheckStatusResponse)
        ->found()
        ->successful();
}

When provider_id is not found:

return (new CheckStatusResponse)
    ->notFound()
    ->failed();

When provider_id is found, but transaction was failed:

return (new CheckStatusResponse)
    ->found()
    ->failed();
}

Alias methods:


Customization

1. Set Namespace

If you want to set your custom xml namespace:

$samanUssd->setNamespace('http://my-web-site.com');

2. Set custom soap options:

If you want to set custom soap options for SoapServer or override default options:

$samanUssd->setOptions([
    'soap_version' => SOAP_1_2
]);

3. Set custom WSDL query string

By default, if you append ?wsdl to your endpoint uri, you can see wsdl specification. If you want to set custom query string for that:

$samanUssd->setWsdlQueryString('WSDL');

Testing

Unit test

Run:

vendor/bin/phpspec run

Api test

Run:

docker-compose -f docker-compose.testing.yaml up -d

vendor/bin/codecept run

Dependencies

Dev dependencies:

Official documentation

Download: Technical Documentation Version 1.8

Contribute

Wanna contribute? simply fork this project and make a pull request!

License

This project released under the MIT License.

Donation

Donate via Paypal


All versions of saman-ussd with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
ext-soap Version *
ext-dom Version *
piotrooo/wsdl-creator Version 2.0.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nikapps/saman-ussd contains the following files

Loading the files please wait ....