定制 lelyfoto/mypos-cashregisterremote 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lelyfoto/mypos-cashregisterremote

最新稳定版本:0.1.2

Composer 安装命令:

composer require lelyfoto/mypos-cashregisterremote

包简介

README 文档

README

Packagist Version Packagist PHP Version MyPos Cash Register Remote API License GitHub issues Packagist Downloads

Cash Register Remote API implementation for MyPos

This is a simple PHP implementation of the MyPos Cash Register Remote API as described on the MyPos website.

Requirements

  • PHP 8.1+
  • PHP extensions: bcmath, soap
  • Composer 2
  • MyPos account and physical payment terminal

Usage

First make sure you have met the requirements of the API from MyPos. See the requirements section on the developer site from MyPos. And store your private key securely in your project. Also add the public key you received from MyPos.

Next require this library with composer:

composer require lelyfoto/mypos-cashregisterremote

Then create a Config-object:

$config = new Config(
    'username@email.com',
    1, // Should be 1, unless you have more than one public key send to MyPos,
    'EUR',
    '12345678', // Your teminal ID, see your dashboard,
    file_get_contents('your_private_key.pem'),
    file_get_contents('mypos_public.crt'),
    Config::MYPOS_WSDL_PRODUCTION
);

The config object can now be used to pair your terminal:

$terminal = new Terminal($config);
$securityCode = $terminal->requestPairCodeForSubscribe();

Go to your terminal and go to settings->pair device and enter the returned security code.

To make a payment:

$requestId = $terminal->makePurchase(42, 'reference id', MPRPurchase::TYPE_REFERENCE_NUMBER);

Store the returned RequestId, you will need this to check the status of the payment. On your terminal you hit the "Enter"-key, and you can do the payment. You can further use the methods "checkPayment" or "cancelPayment" to interact with this payment.

Finally, when you want to disconnect your terminal, you can call "requestPairCodeForUnsubscribe" and enter the security code into the device.

Known issues and limitations

The biggest missing thing in this library is the lack of validation of the responses from MyPos. This will be addressed in a future release and is my top priority.

Also, there is no unit testing at this moment and also there isn't a lot of error checking. I build this library fast because I needed it soon, however I will make time to complete it soon.

Keep also in mind that I don't have a development terminal/account at MyPos, so I have to do all the testing in the production environment. The Refund and LastTxnVoid calls are untested by me at this moment.

统计信息

  • 总下载量: 385
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2022-10-01