hostbox / nette-paypal-payment-buttons
Nette 框架的 PayPal 支付按钮组件
v1.0.0
2014-04-15 07:47 UTC
Requires
- nette/nette: ~2.0
Requires (Dev)
- nette/tester: ~1.0
This package is not auto-updated.
Last update: 2024-09-24 02:18:48 UTC
README
支持“立即购买”、“加入购物车”、“捐赠”、“二维码”和“订阅”按钮
包安装
安装社交插件的最佳方式是使用 Composer
$ composer require hostbox/nette-paypal-payment-buttons
或手动编辑项目中 composer.json 文件
"require": { "hostbox/nette-paypal-payment-buttons": "v1.0.0" }
组件安装
config.neon
services:
# Config
- HostBox\Components\PayPal\PaymentButtons\Config('PaypalMerchantId')
# Factory
- HostBox\Components\PayPal\PaymentButtons\ButtonFactory
表示器
use HostBox\Components\PayPal\PaymentButtons\ButtonFactory; use HostBox\Components\PayPal\PaymentButtons\Subscribe; use Nette\Application\UI\Presenter; class PaypalPaymentPresenter extends Presenter { /** @var ButtonFactory */ protected $buttonFactory; public function __construct(ButtonFactory $buttonFactory) { parent::__construct(); $this->buttonFactory = $buttonFactory; } // component create by Factory public function createComponentBuyNow() { return $this->buttonFactory->createBuyNow(); } // default settings by factory function parameter public function createComponentDonate() { return $this->buttonFactory->createDonate(array( 'quantity' => 10, 'tax' => 10.5 )); } // by component function parameter public function createComponentQRCodes() { $component = $this->buttonFactory->createQRCodes(); $component->assign(array( 'quantity' => 10, 'tax' => 10.5 )); return $component; } // by component variable public function createComponentSubscribe() { $component = $this->buttonFactory->createSubscribe(); $component->period = Subscribe::PERIOD_YEARS return $component; } }
模板
{control buyNow}
{control addToCart}
{control subscribe}
{control qRCodes}
// temporary(only for this render) settings editing in Template
{control donate, quantity => 10, tax => 10.5}