swapwink / components
此包已被废弃且不再维护。未建议替代包。
与SwapWink核心通信的组件
0.2.10
2017-07-20 15:47 UTC
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- filsh/yii2-oauth2-server: dev-master#b0557dd
- linslin/yii2-curl: 1.0.*
- yiisoft/yii2: 2.0.*
- dev-master
- 0.2.10
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.0.30
- 0.0.29
- 0.0.28
- 0.0.27
- 0.0.26
- 0.0.25
- 0.0.24
- 0.0.23
- 0.0.22
- 0.0.21
- 0.0.20
- 0.0.19
- 0.0.18
- 0.0.17
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-components-aaron
- dev-feature-COMMON-103
- dev-feature-COUPON-392
- dev-feature-CORE-166
- dev-feature-COUPON-304
- dev-feature-COMPONENT-5
- dev-feature-COMPONENTS-4
- dev-feature-COUPON-261
- dev-feature-COUPON-260
This package is auto-updated.
Last update: 2017-08-13 18:12:13 UTC
README
与SwapWink核心通信的组件
需求
- Yii2
- linslin/yii2-curl
安装
推荐使用composer进行安装 (http://getcomposer.org/download/)。
要么
composer require swapwink/components
在composer.json的require部分
"swapwink/components": "*"
安装完成后,您需要将以下代码添加到您的yii2项目组件列表中
SwapWink 用户
配置
'components' => [
...
'coreusers' => [
'class' => '\swapwink\components\UsersComponent',
'client_id' => 'client_id',
'client_secret' => 'client_secret',
'uri_api' => 'uri_api'
],
...
],
使用
通过id获取用户
$usercore = Yii::$app->coreusers->getUserById($id);
通过别名获取用户
$usercore = Yii::$app->coreusers->getUserByAlias($alias);
通过别名或名称搜索用户
$usercore = Yii::$app->coreusers->findUsers($alias)
SwapWink 合作伙伴
配置
'components' => [
...
'coreAffiliates' => [
'class' => '\swapwink\components\AffiliatesComponent',
],
...
],
使用
Yii::$app->coreAffiliates->getAffiliatesByUserId($user_id);
SwapWink 交易
配置
'components' => [
...
'coreTransactions' => [
'class' => '\swapwink\components\TransactionsComponent',
],
...
],
使用
Yii::$app->coreTransactions->create($data);
PayPal
配置
'components' => [
...
'paypal' => [
'class' => 'swapwink\components\PaypalComponent',
'returnUrl' => 'paypal/confirm?success=true',
'cancelUrl' => 'paypal/cancel?cancel=true',
'clientId' => 'client_id',
'isProduction' => false,
'config' => [
'mode' => \swapwink\components\PaypalComponent::MODE_SANDBOX
'http.ConnectionTimeOut' => 30,
'http.Retry' => 1,
'log.LogEnabled' => 1,
'log.LogLevel' => \swapwink\components\PaypalComponent::LOG_LEVEL_FINE
]
]
...
]
使用
$response = Yii::$app->paypal->executePaypalPayment($payment_id, $payer_id);