Source for file doexpresscheckoutpayment.php

Documentation is available at doexpresscheckoutpayment.php

  1. <?php
  2.  
  3. /**
  4.  * DoExpressCheckoutPayment Object
  5.  *
  6.  * This class is used to perform the DoExpressCheckoutPayment operation
  7.  * 
  8.  * @author Israel Ekpo <perfectvista@users.sourceforge.net>
  9.  * @copyright Israel Ekpo, 2006-2007
  10.  * @license http://phppaypalpro.sourceforge.net/LICENSE.txt BSD License
  11.  * @version 0.1.0
  12.  * @package ExpressCheckout
  13.  * @filesource
  14.  */
  15.  
  16.  
  17. /**
  18.  * Used to invoke the DoExpressCheckoutPayment Operation
  19.  * 
  20.  * @author Israel Ekpo <perfectvista@users.sourceforge.net>
  21.  * @copyright Copyright 2007, Israel Ekpo
  22.  * @license http://phppaypalpro.sourceforge.net/LICENSE.txt BSD License
  23.  * @package ExpressCheckout
  24.  */
  25. final class DoExpressCheckoutPayment extends PaypalAPI implements OperationsTemplate
  26. {   
  27.     /**
  28.      * Message Sent to the Webservice
  29.      *
  30.      * @var array 
  31.      * @access private
  32.      */
  33.     private $apiMessage;
  34.  
  35.     /**
  36.      * Prepares the message to be sent
  37.      *
  38.      * This method prepares the message to be sent to the
  39.      * Paypal Webservice
  40.      * 
  41.      * @access public
  42.      * @param string $PaymentAction 
  43.      * @param string $Token 
  44.      * @param string $PayerID 
  45.      * @param string $PaymentDetails 
  46.      */
  47.     public function setParams($PaymentAction$Token$PayerID$PaymentDetails)
  48.     {
  49.         $this->apiMessage PayPalTypes::DoExpressCheckoutPaymentRequestDetailsType($PaymentAction$Token$PayerID$PaymentDetails);
  50.     }
  51.     
  52.     /**
  53.      * Adds Item to the Payment Details
  54.      *
  55.      * @param string $Name 
  56.      * @param float $Number 
  57.      * @param integer $Quantity 
  58.      * @param float $Tax 
  59.      * @param float $Amount 
  60.      * @param string $currencyID 
  61.      */
  62.     public function addPaymentItem($Name ''$Number ''$Quantity 1$Tax ''$Amount ''$currencyID 'USD')
  63.     {              
  64.         $this->apiMessage['PaymentDetails']['PaymentDetailsItem'][PayPalTypes::PaymentDetailsItemType($Name$Number$Quantity$Tax$Amount$currencyID);
  65.     }
  66.     
  67.     /**
  68.      * Executes the DoExpressCheckoutPayment Operation
  69.      *
  70.      * Prepares the final message and the calls the Webservice operation. If it is successfull the response is registered
  71.      * and the OperationStatus is set to true, otherwise the Operation status will be set to false and an Exception of the type
  72.      * soapFault will be registered instead.
  73.      * 
  74.      * @throws SoapFault
  75.      * @access public
  76.      */
  77.     public function execute()
  78.     {
  79.         try
  80.         {
  81.             $this->apiMessage['Version'API_VERSION;
  82.             
  83.             $this->apiMessage['DoExpressCheckoutPaymentRequestDetails'$this->apiMessage;
  84.         
  85.             $this->apiMessage array('DoExpressCheckoutPaymentRequest' => $this->apiMessage);
  86.             
  87.             $this->apiMessage array($this->apiMessage);
  88.             
  89.             parent::registerAPIResponse(PayPalBase::getSoapClient()->__soapCall('DoExpressCheckoutPayment'$this->apiMessagenullPayPalBase::getSoapHeader()));
  90.             
  91.             PaypalBase::setOperationStatus(true);          
  92.         }
  93.         
  94.         catch (SoapFault $Exception)
  95.         {
  96.             parent::registerAPIException($Exception);
  97.             
  98.             PaypalBase::setOperationStatus(false);
  99.         }
  100.     }
  101. }
  102. ?>

Documentation generated on Sat, 03 Feb 2007 20:59:00 -0800 by phpDocumentor 1.3.1