2017 © Pedro Peláez
 

library paypal-component

PayPal basic API written in Nette

image

flame/paypal-component

PayPal basic API written in Nette

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

PayPal Component

Usage

Config

parameters:
    paypal:
        api:
            username = 'seberm_1332081338_biz_api1.gmail.com'
            password = '1332081363'
            signature = 'AWiH1IO0zFZrEQbbn0JwDZHbWukIAebmYjpOylRCqBGGgztea2bku.N4'
        sandbox = true

factories:
    paypalOrderButton:
        implement: Flame\Components\PayPal\Buttons\IOrderFactory
        setup:
            - setCredentials(%paypal.api%)
            - setSandBox(%paypal.sandbox%)

            # This option cause that you're not redirected back on your page for payment confirmation but you confirm payment directly on PayPal page
            #- setRedirectToConfirm(false)

Presenter

/**
 * @var \Flame\Components\PayPal\Buttons\IOrderFactory $orderFactory
 */
private $orderFactory;

/**
 * @var \Flame\Components\PayPal\Buttons\Order
 */
private $orderButton;


/**
 * @param \Flame\Components\PayPal\Buttons\IOrderFactory $orderFactory
 */
public function injectOrderFactory(\Flame\Components\PayPal\Buttons\IOrderFactory $orderFactory)
{
    $this->orderFactory = $orderFactory;
}

public function startup()
{
    parent::startup();

    $this->orderButton = $this->orderFactory->create();
    $this->orderButton->setSessionSection($this->session->getSection('paypal'));
    $this->orderButton->onSuccessPayment[] = \Nette\Callback::create($this, 'processPayment');
}

/**
 * @return Flame\Components\PayPal\Buttons\Order
 */
protected function createComponentPaypalButton()
{

    $control = $this->orderButton;
    $control->setCurrencyCode(\Flame\PayPal\API\API::CURRENCY_EURO);
    $control->onConfirmation[] = \Nette\Callback::create($this, 'confirmOrder');
    $control->onError[] = \Nette\Callback::create($this, 'errorOccurred');

    //$tourModel is instance of PRODUCT
    $control->addItemToCart(
        $tourModel['name'], \Nette\Utils\Strings::substring($tourModel['desc'], 0, 25), $tourModel['price']
    );

    return $control;
}

The Versions

06/04 2013

dev-master

9999999-dev https://github.com/flame-org/PayPal-Component

PayPal basic API written in Nette

  Sources   Download

BSD-2-Clause-FreeBSD

The Requires

 

The Development Requires

api payments paypal nette