承接 gjorgic/my-promisepay-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

gjorgic/my-promisepay-php

Composer 安装命令:

composer require gjorgic/my-promisepay-php

包简介

PHP SDK for the PromisePay API

README 文档

README

#PHP SDK - PromisePay API

Join the chat at https://gitter.im/PromisePay/promisepay-php

Build Status Latest Stable Version Total Downloads Code Climate

#1. Installation

###Composer

You can include this package via Composer.

{
  "require": {
    "promisepay/promisepay-php": "1.*"
  }
}

Install the package.

composer install

Require the package.

require init.php

###Manual Installation Download the latest release from GitHub, then include the init.php file - see below.

require init.php

#2. Configuration Before interacting with PromisePay API, you need to generate an API token. See http://docs.promisepay.com/v2.2/docs/request_token for more information.

Once you have recorded your API token, configure the PHP package - see below.

Open the file libs/promisepay-credentials.xml and replace the existing credentials with the following:

	<?xml version='1.0'?>
		<ApiCredentials>
   			<ApiUrl>https://test.api.promisepay.com/</ApiUrl>
   			<ApiLogin>user.name@yourdomain.com</ApiLogin>
   			<ApiPassword>Password</ApiPassword>
   			<ApiKey>APIToken</ApiKey>
	</ApiCredentials>

#3. Examples ##Tokens

Example 1 - Request session token

The below example shows the request for a marketplace configured to have the Item and User IDs generated automatically for them.

$repo = new TokenRepository();
$sessionToken = new Token($arr = array(
			   'current_user' 			=> 'seller',
           	   'item_name'				=> 'Test Item',
          		   'amount'					=> '2500',
           	   'seller_lastname' 		=> 'Seller',
           	   'seller_firstname'		=> 'Sally',
           	   'buyer_lastname'			=> 'Buyer',
           	   'buyer_firstname'		=> 'Bobby',
           	   'buyer_country'			=> 'AUS',
           	   'seller_country'			=> 'USA',
           	   'seller_email'			=> 'sally.seller@promisepay.com',
           	   'buyer_email'			=> 'bobby.buyer@promisepay.com',
           	   'fee_ids'				=> '',
           	   'payment_type_id'		=> '2'))
$repo->requestSessionToken($sessionToken)

#####Example 2 - Request session token The below example shows the request for a marketplace that passes the Item and User IDs.

$repo = new TokenRepository();
$sessionToken = new Token($arr = array(
			   'current_user_id' 		=> 'seller1234',
           	   'item_name'				=> 'Test Item',
          		   'amount'					=> '2500',
           	   'seller_lastname' 		=> 'Seller',
           	   'seller_firstname'		=> 'Sally',
           	   'buyer_lastname'			=> 'Buyer',
           	   'buyer_firstname'		=> 'Bobby',
           	   'buyer_country'			=> 'AUS',
           	   'seller_country'			=> 'USA',
           	   'seller_email'			=> 'sally.seller@promisepay.com',
           	   'buyer_email'			=> 'bobby.buyer@promisepay.com',
           	   'external_item_id'		=> 'TestItemId1234',
           	   'external_seller_id'		=> 'seller1234',
           	   'external_buyer_id'		=> 'buyer1234',
           	   'fee_ids'				=> '',
           	   'payment_type_id'		=> '2'))
$repo->requestSessionToken($sessionToken)

##Items

#####Create an item

$repo = new ItemRepository();
$user = new Item($arr = array(
           'id'            => 'External_id',
           'name'          => 'Item Name',
           'amount'        => '2000',
           'payment_type'  => '1',
           'buyer_id'      => 'External_buyer_id',
           'seller_id'     => 'External_seller_id',
           'fee_ids'       => 'fee_id_1,fee_id_2',
           'description'   => 'Item Description'));
$repo->createItem($user)

#####Get an item

$repo = new ItemRepository();
$item = $repo->getItemById('item_id');

#####Get a list of items

$repo = new ItemRepository();
$listOfItems = $repo->getListOfItems;

#####Update an item

$repo = new ItemRepository();
$item = new Item($arr = array(
           'id'            => 'External_id',
           'name'          => 'Item Name',
           'amount'        => '2000',
           'payment_type'  => '1',
           'buyer_id'      => 'External_buyer_id',
           'seller_id'     => 'External_seller_id',
           'fee_ids'       => 'fee_id_1,fee_id_2',
           'description'   => 'Item Description'));
$repo->updateItem($item, 'user', 'account', 'release_amount');

#####Delete an item

$repo = new ItemRepository();
$repo->deleteItem('item_id');

#####Get an item status

$repo = new ItemRepository();
$repo->getItemStatus('item_id');

#####Get an item's buyer

$repo = new ItemRepository();
$buyer = $repo->getBuyerOfItem('item_id');

#####Get an item's seller

$repo = new ItemRepository();
$seller = $repo->getSellerForItem('item_id');

#####Get an item's fees

$repo = new ItemRepository();
$fees = $repo->getListFeesForItems('item_id');

#####Get an item's transactions

$repo = new ItemRepository();
$transactions = $repo->getListOfTransactionsForItem('item_id');

#####Get an item's wire details

$repo = new ItemRepository();
$wireDetails = $repo->getWireDetailsForItem('item_id');

#####Get an item's BPAY details

$repo = new ItemRepository();
$bpayDetails = $repo->getBPayDetailsForItem('item_id');

##Users

#####Create a user

$repo = new UserRepository();
$user = new User($arr = array(
           'id'            => id,
           'first_name'    => 'First Name',
           'last_name'     => 'Last Name',
           'email'         => 'email'
           'mobile'        => 'mobile phone'
           'address_line1' => 'a line 1',
           'address_line2' => 'a line 2',
           'state'         => 'state',
           'city'          => 'city',
           'zip'           => '90210',
           'country'       => 'AUS'//country code,));
$repo->createUser($user)

#####Get a user

$repo = new UserRepository();
$user = $repo->getUserById('User id');

#####Get a list of users

$repo = new UserRepository();
$users = $repo->getListOfUsers();

#####Delete a User

$repo = new UserRepository();
$repo->deleteUser('User_id');

#####Get a user's card accounts

$repo = new UserRepository();
$usersCardAccounts = $repo->getListOfCardAccountsForUser('User_id');

#####Get a user's PayPal accounts

$repo = new UserRepository();
$usersPayPalAccounts = $repo->getListOfPayPalAccountsForUser('User_id');

#####Get a user's bank accounts

$repo = new UserRepository();
$usersBankAccounts = $repo->getListOfBankAccountsForUser('User_id');

#####Get a user's items

$repo = new UserRepository();
$items = $repo->getListOfItemsForUser('User_id');

#####Set a user's disbursement account

$repo = new UserRepository();
$repo->setDisbursementAccount('user_id', 'account_id');

##Item Actions

#####Make payment

$repo = new ItemRepository();
$repo->makePayment('External_item_id', 'Card_account_id', 'User_id')

#####Request payment

$repo = new ItemRepository();
$requestPayment = $repo->requestPayment('Item_id', 'Seller_id');

#####Release payment

$repo = new ItemRepository();
$releasePayment = $repo->releasePayment('Item_id', 'buyer_id', 'Release amount');

#####Request release

$repo = new ItemRepository();
$requestRelease = $repo->requestRelease('Item_id', 'Seller_id', 'Release amount');

#####Cancel

$repo = new ItemRepository();
$repo->cancelItem('Item_id');

#####Acknowledge wire

$repo = new ItemRepository();
$acknowledgeWire = $repo->acknowledgeWire('Item_id', 'Buyer_id');

#####Acknowledge PayPal

$repo = new ItemRepository();
$acknowledgePayPal = $repo->acknowledgePayPal('Item_id', 'Buyer_id');

#####Revert wire

$repo = new ItemRepository();
$repo->revertWire('Item_id', 'Buyer_id');

#####Request refund

$repo = new ItemRepository();
$repo->requestRefund('Item_id',  'Buyer_id',  'Refund amount',  'Refund message');

#####Refund

$repo = new ItemRepository();
$repo = refund( 'Item id',  'Seller id',  'Refund Amount',  'Refund message')

##Card Accounts #####Create a card account

$repo = new CardAccountRepository();
$user = new CardAccount($arr = array(
           'user_id'       => id,
           'full_name'     => 'Bobby Buyer',
           'number'        => '4111111111111111',
           'expiry_month'  => '06'
           'expiry_year'   => '2016'
           'cvv' 			=> '123'));
$repo->createCardAccount($user)

#####Get a card account

$repo = new CardAccountRepository();
$card = $repo->getCardAccountById('Account_id')

#####Delete a card account

$repo = new CardAccountRepository();
$repo->deleteCardAccount('Account_id')

#####Get a card account's users

$repo = new CardAccountRepository();
$users = $repo->getUserForCardAccount('Card Account');

##Bank Accounts #####Create a bank account

$repo = new BankAccountRepository();
$bankAccount = new BankAccount($arr = array(
			   'user_id' 			=> 'External_seller_id',
           	   'bank_name'			=> 'Test Bank',
          	   'account_name'		=> 'Sally Seller',
           	   'routing_number' 	=> '123456',
           	   'account_number'		=> '12345678',
           	   'account_type'		=> 'checking',
           	   'holder_type'		=> 'personal',
           	   'bank_country'		=> 'AUS'))
$repo->createBankAccount($bankAccount)

#####Get a bank account

$repo = new BankAccountRepository();
$bankAccount = $repo->getBankAccountById('Account_id');

#####Delete a bank account

$repo = new BankAccountRepository();
$repo->deleteBankAccount('Account_id');

#####Get a bank account's users

$repo = new BankAccountRepository();
$user = $repo->getUserForBankAccount('Account_id');

##PayPal Accounts #####Create a PayPal account

$repo  = new PayPalAccountRepository();
$params  = array(
    'user_id'=> 'User id',
    'active'=>'true',
    'paypal'=>array(
        'email'=>'User email'
        )
    );
$ppalAccount = new PayPalAccount($params);
$repo->createPayPalAccount($ppalAccount);

#####Get a PayPal account

$repo = new PayPalAccountRepository();
$paypalAccount = $repo->getPayPalAccountById('account_id');

#####Delete a PayPal account

$repo = new PayPalAccountRepository();
$repo->deletePayPalAccount('Account id')

#####Get a PayPal account's users

$repo = new PayPalAccountRepository();
$users = $repo->getUserForPayPalAccount('Account id')

##Fees #####Get a list of fees

$repo = new FeeRepository();
$fees = $repo->getListOfFees();

#####Get a fee

$repo = new FeeRepository();
$fee = $repo->getFeeById('Fee id');

#####Create a fee

$enum = new FeeType();
$repo = new FeeRepository();
$data = array(
    'id'=>'fee id',
    'amount'=>1000,
    'name'=>'fee name',
    'fee_type'=>$enum->Fixed,
    'cap'=>'1',
    'max'=>'3',
    'min'=>'2',
    'to'=>'buyer'
    );
$fee = new Fee($data);
$repo->createFee($fee);

##Transactions #####Get a list of transactions

$repo = new TransactionRepository();
$trans = $repo->getListOfTransactions();

#####Get a transaction

$repo = new TransactionRepository();
$transaction = $repo->getTransaction('transaction_id');

#####Get a transaction's users

$repo = new TransactionRepository();
$users = $repo->getUserForTransaction('transaction id');

#####Get a transaction's fees

$repo = new TransactionRepository();
$fees = $repo->getFeeForTransaction('transaction id');

#4. Contributing 1. Fork it ( https://github.com/PromisePay/promisepay-php/fork ) 2. Create your feature branch (git checkout -b my-new-feature) 3. Commit your changes (git commit -am 'Add some feature') 4. Push to the branch (git push origin my-new-feature) 5. Create a new Pull Request

gjorgic/my-promisepay-php 适用场景与选型建议

gjorgic/my-promisepay-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 356 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 08 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 gjorgic/my-promisepay-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 gjorgic/my-promisepay-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 gjorgic/my-promisepay-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2015-08-05