/**
  * @param OrderService            $service
  * @param Payment                 $payment
  * @param TransactionDetails|null $transactionDetails
  */
 public function __construct(OrderService $service, Payment $payment, TransactionDetails $transactionDetails = null)
 {
     parent::__construct($service);
     $ccTxType = $this->document->createElement('ns1:CreditCardTxType');
     $ccType = $this->document->createElement('ns1:Type');
     $ccType->nodeValue = 'sale';
     $ccTxType->appendChild($ccType);
     $paymentData = $payment->getXML($this->document);
     $this->getTransactionElement()->appendChild($ccTxType);
     $this->getTransactionElement()->appendChild($paymentData);
     if (null !== $transactionDetails) {
         $transactionDetailsData = $transactionDetails->getXML($this->document);
         $this->getTransactionElement()->appendChild($transactionDetailsData);
     }
 }
Beispiel #2
0
 /**
  * @param OrderService   $service
  * @param CreditCardData $creditCardData
  * @param float          $amount
  * @param string         $text
  */
 public function __construct(OrderService $service, CreditCardData $creditCardData, $amount = 1.0, $text = null)
 {
     parent::__construct($service);
     $xml = $this->document->createElement('ns2:Validate');
     $ccData = $creditCardData->getXML($this->document);
     $xml->appendChild($ccData);
     if ($amount > 1.0) {
         $payment = new Payment(null, $amount);
         $paymentData = $payment->getXML($this->document);
         $xml->appendChild($paymentData);
     }
     if (!empty($text)) {
         $transactionDetails = new TransactionDetails('ns2', $text);
         $transactionDetailsData = $transactionDetails->getXML($this->document);
         $xml->appendChild($transactionDetailsData);
     }
     $this->element->getElementsByTagName('ns2:Action')->item(0)->appendChild($xml);
 }