paysera/lib-wallet-transfer-rest-client
Composer 安装命令:
composer require paysera/lib-wallet-transfer-rest-client
包简介
PHP REST client for Paysera.com Wallet Transfers
README 文档
README
Provides methods to manipulate Transfers API.
It automatically authenticates all requests and maps required data structure for you.
Usage
This library provides ClientFactory class, which you should use to get the API client itself:
use Paysera\Client\TransfersClient\ClientFactory; $clientFactory = new ClientFactory([ 'base_url' => 'https://wallet.paysera.com/transfer/rest/v1/', // optional, in case you need a custom one. 'basic' => [ // use this, it API requires Basic authentication. 'username' => 'username', 'password' => 'password', ], 'oauth' => [ // use this, it API requires OAuth v2 authentication. 'token' => [ 'access_token' => 'my-access-token', 'refresh_token' => 'my-refresh-token', ], ], // other configuration options, if needed ]); $transfersClient = $clientFactory->getTransfersClient();
Please use only one authentication mechanism, provided by Paysera.
Now, that you have instance of TransfersClient, you can use following methods
Methods
It reserves funds for transfer and makes it "reserved". It's enough for transfer to be processed. If there are not enough funds, any limits are reached etc., transfer will be still "new" and no action will take place. Returns error if no funds available.
use Paysera\Client\TransfersClient\Entity as Entities; $transferRegistrationParameters = new Entities\TransferRegistrationParameters(); $transferRegistrationParameters->setConvertCurrency($convertCurrency); $transferRegistrationParameters->setUserIp($userIp); $result = $transfersClient->reserveTransfer($id, $transferRegistrationParameters);
Provide password for transfer with status waiting_password. If operation is successful, transfer status becomes done. Available only for internal transfers. Returns error if password provided is invalid.
use Paysera\Client\TransfersClient\Entity as Entities; $transferPassword = new Entities\TransferPassword(); $transferPassword->setValue($value); $result = $transfersClient->provideTransferPassword($id, $transferPassword);
Make transfer visible in frontend for signing. If currency convert operations are related to transfer, they are done when transfer becomes reserved. If there are expectations in currency convert requests, transfer becomes failed together with related conversion request(s) if those expectations fails. This only makes transfer "reserved", so it's visible in our Web UI for signing
use Paysera\Client\TransfersClient\Entity as Entities; $transferRegistrationParameters = new Entities\TransferRegistrationParameters(); $transferRegistrationParameters->setConvertCurrency($convertCurrency); $transferRegistrationParameters->setUserIp($userIp); $result = $transfersClient->registerTransfer($id, $transferRegistrationParameters);
Signs the transfer
use Paysera\Client\TransfersClient\Entity as Entities; $transferRegistrationParameters = new Entities\TransferRegistrationParameters(); $transferRegistrationParameters->setConvertCurrency($convertCurrency); $transferRegistrationParameters->setUserIp($userIp); $result = $transfersClient->signTransfer($id, $transferRegistrationParameters);
Get transfer.
$result = $transfersClient->getTransfer($id);
Revoke transfer.
$result = $transfersClient->deleteTransfer($id);
Create transfer in the system. Created transfer is invisible and will be deleted if no more actions are performed.
use Paysera\Client\TransfersClient\Entity as Entities; $transferInput = new Entities\TransferInput(); $transferInput->setAmount($amount); $transferInput->setBeneficiary($beneficiary); $transferInput->setPayer($payer); $transferInput->setFinalBeneficiary($finalBeneficiary); $transferInput->setPerformAt($performAt); $transferInput->setChargeType($chargeType); $transferInput->setUrgency($urgency); $transferInput->setNotifications($notifications); $transferInput->setPurpose($purpose); $transferInput->setPassword($password); $transferInput->setCancelable($cancelable); $transferInput->setAutoCurrencyConvert($autoCurrencyConvert); $transferInput->setAutoChargeRelatedCard($autoChargeRelatedCard); $transferInput->setAutoProcessToDone($autoProcessToDone); $transferInput->setReserveUntil($reserveUntil); $transferInput->setCallback($callback); $result = $transfersClient->createTransfer($transferInput);
Standard SQL-style Result filtering
use Paysera\Client\TransfersClient\Entity as Entities; $transfersFilter = new Entities\TransfersFilter(); $transfersFilter->setCreatedDateFrom($createdDateFrom); $transfersFilter->setCreatedDateTo($createdDateTo); $transfersFilter->setCreditAccountNumber($creditAccountNumber); $transfersFilter->setDebitAccountNumber($debitAccountNumber); $transfersFilter->setStatuses($statuses); $result = $transfersClient->getTransfers($transfersFilter);
paysera/lib-wallet-transfer-rest-client 适用场景与选型建议
paysera/lib-wallet-transfer-rest-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 183.56k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2017 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 paysera/lib-wallet-transfer-rest-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 paysera/lib-wallet-transfer-rest-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 183.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 23
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2017-05-04