Componette

Componette

HostBox

HostBox / nette-paypal-payment-buttons v1.0.0

PayPal payment buttons component for Nette Framework

download-cloud-line composer require hostbox/nette-paypal-payment-buttons

Paypal Payment buttons for Nette Framework Build Status

Support for Buy Now, Add to Cart, Donate, QR Codes, and Subscribe buttons

Package Installation

The best way to install Social Plugins is using Composer:

$ composer require hostbox/nette-paypal-payment-buttons

Packagist - Versions

Nette Forum (cs) - plugin section

Nette Addons

or manual edit composer.json in your project

"require": {
    "hostbox/nette-paypal-payment-buttons": "v1.0.0"
}

Component Installation

config.neon

services:
    # Config
    - HostBox\Components\PayPal\PaymentButtons\Config('PaypalMerchantId')
    # Factory
    - HostBox\Components\PayPal\PaymentButtons\ButtonFactory

Presenter

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;
    }

}

Template

{control buyNow}
{control addToCart}
{control subscribe}
{control qRCodes}

// temporary(only for this render) settings editing in Template
{control donate, quantity => 10, tax => 10.5}
  • v1.0.0 Released version 1.0.0

Componette Componette felix@nette.org