Source for file dodirectpayment.php

Documentation is available at dodirectpayment.php

  1. <?php
  2.  
  3. /**
  4.  * DirectPayment Object
  5.  *
  6.  * This class is used to perform the DoDirectPayment operation
  7.  * 
  8.  * @author Israel Ekpo <perfectvista@users.sourceforge.net>
  9.  * @copyright Copyright 2007, Israel Ekpo
  10.  * @license http://phppaypalpro.sourceforge.net/LICENSE.txt BSD License
  11.  * @version 0.1.0
  12.  * @package DoDirectPayment
  13.  * @filesource
  14.  */
  15.  
  16.  
  17. /**
  18.  * Used to invoke the DoDirectPayment 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 DoDirectPayment
  24.  */
  25. final class DoDirectPayment 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 PaymentDetailsType $PaymentDetails 
  44.      * @param CreditCardDetailsType $CreditCard 
  45.      * @param string $IPAddress 
  46.      * @param string $MerchantSessionId 
  47.      */
  48.     public function setParams($PaymentAction$PaymentDetails$CreditCard$IPAddress$MerchantSessionId)
  49.     {
  50.         $this->apiMessage PayPalTypes::DoDirectPaymentRequestDetailsType($PaymentAction$PaymentDetails$CreditCard$IPAddress$MerchantSessionId);
  51.     }
  52.     
  53.     /**
  54.      * Adds Item to the Payment Details
  55.      *
  56.      * @param string $Name 
  57.      * @param float $Number 
  58.      * @param integer $Quantity 
  59.      * @param float $Tax 
  60.      * @param float $Amount 
  61.      * @param string $currencyID 
  62.      */
  63.     public function addPaymentItem($Name ''$Number ''$Quantity 1$Tax ''$Amount ''$currencyID 'USD')
  64.     {              
  65.         $this->apiMessage['PaymentDetails']['PaymentDetailsItem'][PayPalTypes::PaymentDetailsItemType($Name$Number$Quantity$Tax$Amount$currencyID);
  66.     }
  67.     
  68.     /**
  69.      * Executes the DoDirectPayment Operation
  70.      *
  71.      * Prepares the final message and the calls the Webservice operation. If it is successfull the response is registered
  72.      * and the OperationStatus is set to true, otherwise the Operation status will be set to false and an Exception of the type
  73.      * soapFault will be registered instead.
  74.      * 
  75.      * @throws SoapFault
  76.      * @access public
  77.      */
  78.     public function execute()
  79.     {
  80.         try
  81.         {
  82.             $this->apiMessage['Version'API_VERSION;
  83.             
  84.             $this->apiMessage['DoDirectPaymentRequestDetails'$this->apiMessage;
  85.             
  86.             $this->apiMessage array('DoDirectPaymentRequest' => $this->apiMessage);
  87.             
  88.             $this->apiMessage array($this->apiMessage);
  89.             
  90.             parent::registerAPIResponse(PayPalBase::getSoapClient()->__soapCall('DoDirectPayment'$this->apiMessagenullPayPalBase::getSoapHeader()));
  91.             
  92.             PaypalBase::setOperationStatus(true);           
  93.         }
  94.         
  95.         catch (SoapFault $Exception)
  96.         {
  97.             parent::registerAPIException($Exception);
  98.             
  99.             PaypalBase::setOperationStatus(false);
  100.         }
  101.     }
  102. }
  103.  
  104. ?>

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