PK       ! H      src/ExpressGateway.phpnu [        <?php

namespace Omnipay\PayPal;

/**
 * PayPal Express Class
 */
class ExpressGateway extends ProGateway
{
    public function getName()
    {
        return 'PayPal Express';
    }

    public function getDefaultParameters()
    {
        $settings = parent::getDefaultParameters();
        $settings['solutionType'] = array('Sole', 'Mark');
        $settings['landingPage'] = array('Billing', 'Login');
        $settings['brandName'] = '';
        $settings['headerImageUrl'] = '';
        $settings['logoImageUrl'] = '';
        $settings['borderColor'] = '';

        return $settings;
    }

    public function getSolutionType()
    {
        return $this->getParameter('solutionType');
    }

    public function setSolutionType($value)
    {
        return $this->setParameter('solutionType', $value);
    }

    public function getLandingPage()
    {
        return $this->getParameter('landingPage');
    }

    public function setLandingPage($value)
    {
        return $this->setParameter('landingPage', $value);
    }

    public function getBrandName()
    {
        return $this->getParameter('brandName');
    }

    public function setBrandName($value)
    {
        return $this->setParameter('brandName', $value);
    }

    public function getHeaderImageUrl()
    {
        return $this->getParameter('headerImageUrl');
    }

    public function getLogoImageUrl()
    {
        return $this->getParameter('logoImageUrl');
    }

    public function getBorderColor()
    {
        return $this->getParameter('borderColor');
    }

    /**
     * Header Image URL (Optional)
     *
     * URL for the image you want to appear at the top left of the payment page.
     * The image has a maximum size of 750 pixels wide by 90 pixels high.
     * PayPal recommends that you provide an image that is stored on a secure
     * (HTTPS) server.
     * If you do not specify an image, the business name displays.
     * Character length and limitations: 127 single-byte alphanumeric characters
     */
    public function setHeaderImageUrl($value)
    {
        return $this->setParameter('headerImageUrl', $value);
    }

    /**
     * Logo Image URL (Optional)
     *
     * URL for the image to appear above the order summary, in place of the
     * brand name.
     * The recommended size is 190 pixels wide and 60 pixels high.
     */
    public function setLogoImageUrl($value)
    {
        return $this->setParameter('logoImageUrl', $value);
    }

    /**
     * Border Color (Optional)
     *
     * The color of the border gradient on payment pages.
     * Should be a six character hexadecimal code (i.e. C0C0C0).
     */
    public function setBorderColor($value)
    {
        return $this->setParameter('borderColor', $value);
    }

    public function setSellerPaypalAccountId($value)
    {
        return $this->setParameter('sellerPaypalAccountId', $value);
    }

    public function getSellerPaypalAccountId()
    {
        return $this->getParameter('sellerPaypalAccountId');
    }

    public function authorize(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\ExpressAuthorizeRequest', $parameters);
    }

    public function completeAuthorize(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\ExpressCompleteAuthorizeRequest', $parameters);
    }

    public function purchase(array $parameters = array())
    {
        return $this->authorize($parameters);
    }

    public function completePurchase(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\ExpressCompletePurchaseRequest', $parameters);
    }

    public function void(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\ExpressVoidRequest', $parameters);
    }

    public function fetchCheckout(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\ExpressFetchCheckoutRequest', $parameters);
    }
}
PK       ! eE9       src/Message/CaptureRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Capture Request
 */
class CaptureRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('transactionReference', 'amount');

        $data = $this->getBaseData();
        $data['METHOD'] = 'DoCapture';
        $data['AMT'] = $this->getAmount();
        $data['CURRENCYCODE'] = $this->getCurrency();
        $data['AUTHORIZATIONID'] = $this->getTransactionReference();
        $data['COMPLETETYPE'] = 'Complete';

        return $data;
    }
}
PK       ! fΏJ  J  #  src/Message/ProAuthorizeRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Pro Authorize Request
 */
class ProAuthorizeRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('amount', 'card');
        $this->getCard()->validate();

        $data = $this->getBaseData();
        $data['METHOD'] = 'DoDirectPayment';
        $data['PAYMENTACTION'] = 'Authorization';
        $data['AMT'] = $this->getAmount();
        $data['CURRENCYCODE'] = $this->getCurrency();
        $data['INVNUM'] = $this->getTransactionId();
        $data['DESC'] = $this->getDescription();

        // add credit card details
        $data['ACCT'] = $this->getCard()->getNumber();
        $data['CREDITCARDTYPE'] = $this->getCard()->getBrand();
        $data['EXPDATE'] = $this->getCard()->getExpiryDate('mY');
        $data['STARTDATE'] = $this->getCard()->getStartDate('mY');
        $data['CVV2'] = $this->getCard()->getCvv();
        $data['ISSUENUMBER'] = $this->getCard()->getIssueNumber();
        $data['IPADDRESS'] = $this->getClientIp();
        $data['FIRSTNAME'] = $this->getCard()->getFirstName();
        $data['LASTNAME'] = $this->getCard()->getLastName();
        $data['EMAIL'] = $this->getCard()->getEmail();
        $data['STREET'] = $this->getCard()->getAddress1();
        $data['STREET2'] = $this->getCard()->getAddress2();
        $data['CITY'] = $this->getCard()->getCity();
        $data['STATE'] = $this->getCard()->getState();
        $data['ZIP'] = $this->getCard()->getPostcode();
        $data['COUNTRYCODE'] = strtoupper($this->getCard()->getCountry());

        return $data;
    }
}
PK       ! 91c      src/Message/AbstractRequest.phpnu [        <?php
/**
 * PayPal Abstract Request
 */

namespace Omnipay\PayPal\Message;

/**
 * PayPal Abstract Request
 *
 * This class forms the base class for PayPal Express Checkout and Pro Checkout
 * requests.  These are also known as "Payflow Gateway" requests and also
 * "PayPal Classic APIs".
 *
 * According to the PayPal documentation:
 *
 * * This is the recommended way to integrate when you want to accept payments
 *   with a completely customizable solution. This integration method leverages
 *   the PayPal Payflow Gateway to transmit payments your PayPal Internet Merchant
 *   Account; it also gives the merchant the flexibility to change payment
 *   processors without having to re-do their technical integration. When using
 *   PayPal Payments Pro (Payflow Edition) using Payflow Gateway integration,
 *   merchants can use Transparent Redirect feature to help manage PCI compliance.
 *
 * @link https://developer.paypal.com/docs/classic/products/payflow-gateway/
 * @link https://developer.paypal.com/docs/classic/express-checkout/gs_expresscheckout/
 * @link https://developer.paypal.com/docs/classic/products/ppp-payflow-edition/
 * @link https://devtools-paypal.com/integrationwizard/
 * @link http://paypal.github.io/sdk/
 */
abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest
{
	const API_VERSION = '119.0';

	protected $liveEndpoint = 'https://api-3t.paypal.com/nvp';
	protected $testEndpoint = 'https://api-3t.sandbox.paypal.com/nvp';

	public function getUsername()
	{
		return $this->getParameter('username');
	}

	public function setUsername($value)
	{
		return $this->setParameter('username', $value);
	}

	public function getPassword()
	{
		return $this->getParameter('password');
	}

	public function setPassword($value)
	{
		return $this->setParameter('password', $value);
	}

	public function getSignature()
	{
		return $this->getParameter('signature');
	}

	public function setSignature($value)
	{
		return $this->setParameter('signature', $value);
	}

	public function getSubject()
	{
		return $this->getParameter('subject');
	}

	public function setSubject($value)
	{
		return $this->setParameter('subject', $value);
	}

	public function getSolutionType()
	{
		return $this->getParameter('solutionType');
	}

	public function setSolutionType($value)
	{
		return $this->setParameter('solutionType', $value);
	}

	public function getLandingPage()
	{
		return $this->getParameter('landingPage');
	}

	public function setLandingPage($value)
	{
		return $this->setParameter('landingPage', $value);
	}

	public function getHeaderImageUrl()
	{
		return $this->getParameter('headerImageUrl');
	}

	public function setHeaderImageUrl($value)
	{
		return $this->setParameter('headerImageUrl', $value);
	}

	public function getLogoImageUrl()
	{
		return $this->getParameter('logoImageUrl');
	}

	public function setLogoImageUrl($value)
	{
		return $this->setParameter('logoImageUrl', $value);
	}

	public function getBorderColor()
	{
		return $this->getParameter('borderColor');
	}

	public function setBorderColor($value)
	{
		return $this->setParameter('borderColor', $value);
	}

	public function getBrandName()
	{
		return $this->getParameter('brandName');
	}

	public function setBrandName($value)
	{
		return $this->setParameter('brandName', $value);
	}

	public function getNoShipping()
	{
		return $this->getParameter('noShipping');
	}

	public function setNoShipping($value)
	{
		return $this->setParameter('noShipping', $value);
	}

	public function getAllowNote()
	{
		return $this->getParameter('allowNote');
	}

	public function setAllowNote($value)
	{
		return $this->setParameter('allowNote', $value);
	}

	public function getAddressOverride()
	{
		return $this->getParameter('addressOverride');
	}

	public function setAddressOverride($value)
	{
		return $this->setParameter('addressOverride', $value);
	}

	public function getMaxAmount()
	{
		return $this->getParameter('maxAmount');
	}

	public function setMaxAmount($value)
	{
		return $this->setParameter('maxAmount', $value);
	}

	public function getTaxAmount()
	{
		return $this->getParameter('taxAmount');
	}

	public function setTaxAmount($value)
	{
		return $this->setParameter('taxAmount', $value);
	}

	public function getShippingAmount()
	{
		return $this->getParameter('shippingAmount');
	}

	public function setShippingAmount($value)
	{
		return $this->setParameter('shippingAmount', $value);
	}

	public function getHandlingAmount()
	{
		return $this->getParameter('handlingAmount');
	}

	public function setHandlingAmount($value)
	{
		return $this->setParameter('handlingAmount', $value);
	}

	public function getShippingDiscount()
	{
		return $this->getParameter('shippingDiscount');
	}

	public function setShippingDiscount($value)
	{
		return $this->setParameter('shippingDiscount', $value);
	}

	public function getInsuranceAmount()
	{
		return $this->getParameter('insuranceAmount');
	}

	public function setInsuranceAmount($value)
	{
		return $this->setParameter('insuranceAmount', $value);
	}

	public function getLocaleCode()
	{
		return $this->getParameter('localeCode');
	}

	/*
	 * Used to change the locale of PayPal pages.
	 * Accepts 2 or 5 character language codes as described here:
	 * https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECCustomizing/
	 *
	 * If no value/invalid value is passed, the gateway will default it for you
	*/
	public function setLocaleCode($value)
	{
		return $this->setParameter('localeCode', $value);
	}

	public function setCustomerServiceNumber($value)
	{
		return $this->setParameter('customerServiceNumber', $value);
	}

	public function getCustomerServiceNumber()
	{
		return $this->getParameter('customerServiceNumber');
	}

	public function setSellerPaypalAccountId($value)
	{
		return $this->setParameter('sellerPaypalAccountId', $value);
	}

	public function getSellerPaypalAccountId()
	{
		return $this->getParameter('sellerPaypalAccountId');
	}

	/**
	 * The Button Source (BN Code) is for PayPal Partners taking payments for a 3rd party
	 */
	public function setButtonSource($value)
	{
		return $this->setParameter('ButtonSource', $value);
	}

	public function getButtonSource()
	{
		return $this->getParameter('ButtonSource');
	}

	protected function getBaseData()
	{
		$data              = array();
		$data['VERSION']   = static::API_VERSION;
		$data['USER']      = $this->getUsername();
		$data['PWD']       = $this->getPassword();
		$data['SIGNATURE'] = $this->getSignature();
		$data['SUBJECT']   = $this->getSubject();
		$bnCode            = $this->getButtonSource();
		if (!empty($bnCode))
		{
			$data['BUTTONSOURCE'] = $bnCode;
		}

		return $data;
	}

	protected function getItemData()
	{
		$data  = array();
		$items = $this->getItems();
		if ($items)
		{
			$data["PAYMENTREQUEST_0_ITEMAMT"] = 0;
			foreach ($items as $n => $item)
			{
				$data["L_PAYMENTREQUEST_0_NAME$n"] = $item->getName();
				$data["L_PAYMENTREQUEST_0_DESC$n"] = $item->getDescription();
				$data["L_PAYMENTREQUEST_0_QTY$n"]  = $item->getQuantity();
				$data["L_PAYMENTREQUEST_0_AMT$n"]  = $this->formatCurrency($item->getPrice());

				$data["PAYMENTREQUEST_0_ITEMAMT"] += $item->getQuantity() * $this->formatCurrency($item->getPrice());
			}
			$data["PAYMENTREQUEST_0_ITEMAMT"] = $this->formatCurrency($data["PAYMENTREQUEST_0_ITEMAMT"]);
		}

		return $data;
	}

	public function sendData($data)
	{
		$httpRequest = $this->httpClient->post($this->getEndpoint(), null, http_build_query($data, '', '&'));
		$httpRequest->getCurlOptions()->set(CURLOPT_SSLVERSION, 6); // CURL_SSLVERSION_TLSv1_2 for libcurl < 7.35
		$httpResponse = $httpRequest->send();

		return $this->createResponse($httpResponse->getBody());
	}

	protected function getEndpoint()
	{
		return $this->getTestMode() ? $this->testEndpoint : $this->liveEndpoint;
	}

	protected function createResponse($data)
	{
		return $this->response = new Response($this, $data);
	}
}
PK       ! qd    '  src/Message/FetchTransactionRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Fetch Transaction Request
 */
class FetchTransactionRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('transactionReference');

        $data = $this->getBaseData();
        $data['METHOD'] = 'GetTransactionDetails';
        $data['TRANSACTIONID'] = $this->getTransactionReference();

        return $data;
    }
}
PK       ! ('a<      src/Message/Response.phpnu [        <?php

namespace Omnipay\PayPal\Message;

use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RequestInterface;

/**
 * PayPal Response
 */
class Response extends AbstractResponse
{
    public function __construct(RequestInterface $request, $data)
    {
        $this->request = $request;
        parse_str($data, $this->data);
    }

    public function isPending()
    {
        return isset($this->data['PAYMENTINFO_0_PAYMENTSTATUS'])
            && $this->data['PAYMENTINFO_0_PAYMENTSTATUS'] == 'Pending';
    }

    public function isSuccessful()
    {
        return isset($this->data['ACK']) && in_array($this->data['ACK'], array('Success', 'SuccessWithWarning'));
    }

    public function getTransactionReference()
    {
        foreach (array('REFUNDTRANSACTIONID',
            'TRANSACTIONID',
            'PAYMENTINFO_0_TRANSACTIONID',
            'AUTHORIZATIONID') as $key) {
            if (isset($this->data[$key])) {
                return $this->data[$key];
            }
        }
    }

    public function getMessage()
    {
        return isset($this->data['L_LONGMESSAGE0']) ? $this->data['L_LONGMESSAGE0'] : null;
    }
}
PK       !     "  src/Message/ExpressVoidRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Express Void Request
 */
class ExpressVoidRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('transactionReference');
        $data = $this->getBaseData();
        $data['METHOD'] = 'DoVoid';
        $data['AUTHORIZATIONID'] = $this->getTransactionReference();
        return $data;
    }
}
PK       !  M  M  .  src/Message/ExpressCompletePurchaseRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Express Complete Purchase Request
 */
class ExpressCompletePurchaseRequest extends ExpressCompleteAuthorizeRequest
{
    public function getData()
    {
        $data = parent::getData();
        $data['PAYMENTREQUEST_0_PAYMENTACTION'] = 'Sale';

        return $data;
    }
}
PK       ! p}  }  /  src/Message/ExpressCompleteAuthorizeRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Express Complete Authorize Request
 */
class ExpressCompleteAuthorizeRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('amount');

        $data = $this->getBaseData();
        $data['METHOD'] = 'DoExpressCheckoutPayment';
        $data['PAYMENTREQUEST_0_PAYMENTACTION'] = 'Authorization';
        $data['PAYMENTREQUEST_0_AMT'] = $this->getAmount();
        $data['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->getCurrency();
        $data['PAYMENTREQUEST_0_INVNUM'] = $this->getTransactionId();
        $data['PAYMENTREQUEST_0_DESC'] = $this->getDescription();
        $data['PAYMENTREQUEST_0_NOTIFYURL'] = $this->getNotifyUrl();

        $data['MAXAMT'] = $this->getMaxAmount();
        $data['PAYMENTREQUEST_0_TAXAMT'] = $this->getTaxAmount();
        $data['PAYMENTREQUEST_0_SHIPPINGAMT'] = $this->getShippingAmount();
        $data['PAYMENTREQUEST_0_HANDLINGAMT'] = $this->getHandlingAmount();
        $data['PAYMENTREQUEST_0_SHIPDISCAMT'] = $this->getShippingDiscount();
        $data['PAYMENTREQUEST_0_INSURANCEAMT'] = $this->getInsuranceAmount();

        $data['TOKEN'] = $this->getToken() ? $this->getToken() : $this->httpRequest->query->get('token');
        $data['PAYERID'] = $this->getPayerID() ? $this->getPayerID() : $this->httpRequest->query->get('PayerID');

        $data = array_merge($data, $this->getItemData());

        return $data;
    }

    public function getPayerID()
    {
        return $this->getParameter('payerID');
    }

    public function setPayerID($value)
    {
        return $this->setParameter('payerID', $value);
    }
}
PK       ! \vte  e  +  src/Message/ExpressFetchCheckoutRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Express Fetch Checkout Details Request
 */
class ExpressFetchCheckoutRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate();

        $data = $this->getBaseData();
        $data['METHOD'] = 'GetExpressCheckoutDetails';

        // token can either be specified directly, or inferred from the GET parameters
        if ($this->getToken()) {
            $data['TOKEN'] = $this->getToken();
        } else {
            $data['TOKEN'] = $this->httpRequest->query->get('token');
        }

        return $data;
    }
}
PK       ! *ar  r    src/Message/RefundRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Refund Request
 */
class RefundRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('transactionReference');

        $data = $this->getBaseData();
        $data['METHOD'] = 'RefundTransaction';
        $data['TRANSACTIONID'] = $this->getTransactionReference();
        $data['REFUNDTYPE'] = 'Full';
        if ($this->getAmount() > 0) {
            $data['REFUNDTYPE'] = 'Partial';
            $data['AMT'] = $this->getAmount();
            $data['CURRENCYCODE'] = $this->getCurrency();
        }

        return $data;
    }
}
PK       ! 0Kш    "  src/Message/ProPurchaseRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Pro Purchase Request
 */
class ProPurchaseRequest extends ProAuthorizeRequest
{
    public function getData()
    {
        $data = parent::getData();
        $data['PAYMENTACTION'] = 'Sale';

        return $data;
    }
}
PK       ! c:  :  '  src/Message/ExpressAuthorizeRequest.phpnu [        <?php

namespace Omnipay\PayPal\Message;

/**
 * PayPal Express Authorize Request
 */
class ExpressAuthorizeRequest extends AbstractRequest
{
    public function getData()
    {
        $this->validate('amount', 'returnUrl', 'cancelUrl');

        $data = $this->getBaseData();
        $data['METHOD'] = 'SetExpressCheckout';
        $data['PAYMENTREQUEST_0_PAYMENTACTION'] = 'Authorization';
        $data['PAYMENTREQUEST_0_AMT'] = $this->getAmount();
        $data['PAYMENTREQUEST_0_CURRENCYCODE'] = $this->getCurrency();
        $data['PAYMENTREQUEST_0_INVNUM'] = $this->getTransactionId();
        $data['PAYMENTREQUEST_0_DESC'] = $this->getDescription();

        // pp express specific fields
        $data['SOLUTIONTYPE'] = $this->getSolutionType();
        $data['LANDINGPAGE'] = $this->getLandingPage();
        $data['RETURNURL'] = $this->getReturnUrl();
        $data['CANCELURL'] = $this->getCancelUrl();
        $data['HDRIMG'] = $this->getHeaderImageUrl();
        $data['BRANDNAME'] = $this->getBrandName();
        $data['NOSHIPPING'] = $this->getNoShipping();
        $data['ALLOWNOTE'] = $this->getAllowNote();
        $data['ADDROVERRIDE'] = $this->getAddressOverride();
        $data['LOGOIMG'] = $this->getLogoImageUrl();
        $data['CARTBORDERCOLOR'] = $this->getBorderColor();
        $data['LOCALECODE'] = $this->getLocaleCode();
        $data['CUSTOMERSERVICENUMBER'] = $this->getCustomerServiceNumber();

        $data['MAXAMT'] = $this->getMaxAmount();
        $data['PAYMENTREQUEST_0_TAXAMT'] = $this->getTaxAmount();
        $data['PAYMENTREQUEST_0_SHIPPINGAMT'] = $this->getShippingAmount();
        $data['PAYMENTREQUEST_0_HANDLINGAMT'] = $this->getHandlingAmount();
        $data['PAYMENTREQUEST_0_SHIPDISCAMT'] = $this->getShippingDiscount();
        $data['PAYMENTREQUEST_0_INSURANCEAMT'] = $this->getInsuranceAmount();
        $data['PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID'] = $this->getSellerPaypalAccountId();

        $card = $this->getCard();
        if ($card) {
            $data['PAYMENTREQUEST_0_SHIPTONAME'] = $card->getName();
            $data['PAYMENTREQUEST_0_SHIPTOSTREET'] = $card->getAddress1();
            $data['PAYMENTREQUEST_0_SHIPTOSTREET2'] = $card->getAddress2();
            $data['PAYMENTREQUEST_0_SHIPTOCITY'] = $card->getCity();
            $data['PAYMENTREQUEST_0_SHIPTOSTATE'] = $card->getState();
            $data['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $card->getCountry();
            $data['PAYMENTREQUEST_0_SHIPTOZIP'] = $card->getPostcode();
            $data['PAYMENTREQUEST_0_SHIPTOPHONENUM'] = $card->getPhone();
            $data['EMAIL'] = $card->getEmail();
        }

        $data = array_merge($data, $this->getItemData());

        return $data;
    }

    protected function createResponse($data)
    {
        return $this->response = new ExpressAuthorizeResponse($this, $data);
    }
}
PK       ! f  f  (  src/Message/ExpressAuthorizeResponse.phpnu [        <?php

namespace Omnipay\PayPal\Message;

use Omnipay\Common\Message\RedirectResponseInterface;

/**
 * PayPal Express Authorize Response
 */
class ExpressAuthorizeResponse extends Response implements RedirectResponseInterface
{
    protected $liveCheckoutEndpoint = 'https://www.paypal.com/cgi-bin/webscr';
    protected $testCheckoutEndpoint = 'https://www.sandbox.paypal.com/cgi-bin/webscr';

    public function isSuccessful()
    {
        return false;
    }

    public function isRedirect()
    {
        return isset($this->data['ACK']) && in_array($this->data['ACK'], array('Success', 'SuccessWithWarning'));
    }

    public function getRedirectUrl()
    {
        $query = array(
            'cmd' => '_express-checkout',
            'useraction' => 'commit',
            'token' => $this->getTransactionReference(),
        );

        return $this->getCheckoutEndpoint().'?'.http_build_query($query, '', '&');
    }

    public function getTransactionReference()
    {
        return isset($this->data['TOKEN']) ? $this->data['TOKEN'] : null;
    }

    public function getRedirectMethod()
    {
        return 'GET';
    }

    public function getRedirectData()
    {
        return null;
    }

    protected function getCheckoutEndpoint()
    {
        return $this->getRequest()->getTestMode() ? $this->testCheckoutEndpoint : $this->liveCheckoutEndpoint;
    }
}
PK       ! OZ  Z    src/ProGateway.phpnu [        <?php

namespace Omnipay\PayPal;

use Omnipay\Common\AbstractGateway;

/**
 * PayPal Pro Class
 */
class ProGateway extends AbstractGateway
{
    public function getName()
    {
        return 'PayPal Pro';
    }

    public function getDefaultParameters()
    {
        return array(
            'username' => '',
            'password' => '',
            'signature' => '',
            'testMode' => false,
        );
    }

    public function getUsername()
    {
        return $this->getParameter('username');
    }

    public function setUsername($value)
    {
        return $this->setParameter('username', $value);
    }

    public function getPassword()
    {
        return $this->getParameter('password');
    }

    public function setPassword($value)
    {
        return $this->setParameter('password', $value);
    }

    public function getSignature()
    {
        return $this->getParameter('signature');
    }

    public function setSignature($value)
    {
        return $this->setParameter('signature', $value);
    }

    public function authorize(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\ProAuthorizeRequest', $parameters);
    }

    public function purchase(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\ProPurchaseRequest', $parameters);
    }

    public function capture(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\CaptureRequest', $parameters);
    }

    public function refund(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\RefundRequest', $parameters);
    }

    public function fetchTransaction(array $parameters = array())
    {
        return $this->createRequest('\Omnipay\PayPal\Message\FetchTransactionRequest', $parameters);
    }
}
PK       ! >j      composer.jsonnu [        {
    "name": "omnipay/paypal",
    "type": "library",
    "description": "PayPal gateway for Omnipay payment processing library",
    "keywords": [
        "gateway",
        "merchant",
        "omnipay",
        "pay",
        "payment",
        "paypal",
        "purchase"
    ],
    "homepage": "https://github.com/thephpleague/omnipay-paypal",
    "license": "MIT",
    "authors": [
        {
            "name": "Adrian Macneil",
            "email": "adrian@adrianmacneil.com"
        },
        {
            "name": "Omnipay Contributors",
            "homepage": "https://github.com/thephpleague/omnipay-paypal/contributors"
        }
    ],
    "autoload": {
        "psr-4": { "Omnipay\\PayPal\\" : "src/" }
    },
    "require": {
        "omnipay/common": "~2.0"
    },
    "require-dev": {
        "omnipay/tests": "~2.0"
    },
    "extra": {
        "branch-alias": {
            "dev-master": "2.3.x-dev"
        }
    }
}
PK         ! H                    src/ExpressGateway.phpnu [        PK         ! eE9                   src/Message/CaptureRequest.phpnu [        PK         ! fΏJ  J  #            k  src/Message/ProAuthorizeRequest.phpnu [        PK         ! 91c                  src/Message/AbstractRequest.phpnu [        PK         ! qd    '            \8  src/Message/FetchTransactionRequest.phpnu [        PK         ! ('a<                R:  src/Message/Response.phpnu [        PK         !     "            )?  src/Message/ExpressVoidRequest.phpnu [        PK         !  M  M  .            A  src/Message/ExpressCompletePurchaseRequest.phpnu [        PK         ! p}  }  /            B  src/Message/ExpressCompleteAuthorizeRequest.phpnu [        PK         ! \vte  e  +            I  src/Message/ExpressFetchCheckoutRequest.phpnu [        PK         ! *ar  r              HL  src/Message/RefundRequest.phpnu [        PK         ! 0Kш    "            O  src/Message/ProPurchaseRequest.phpnu [        PK         ! c:  :  '            pP  src/Message/ExpressAuthorizeRequest.phpnu [        PK         ! f  f  (            \  src/Message/ExpressAuthorizeResponse.phpnu [        PK         ! OZ  Z              a  src/ProGateway.phpnu [        PK         ! >j                [i  composer.jsonnu [        PK        Gm    