예제 #1
0
 /**
  * @param OrderService                $service
  * @param string                      $function
  * @param Payment                     $payment
  * @param RecurringPaymentInformation $paymentInformation
  * @param string                      $orderId
  */
 public function __construct(OrderService $service, $function, Payment $payment = null, RecurringPaymentInformation $paymentInformation = null, $orderId = null)
 {
     parent::__construct($service);
     $this->function = $function;
     $this->payment = $payment;
     $this->paymentInformation = $paymentInformation;
     $this->orderId = $orderId;
     $xml = $this->document->createElement('ns2:RecurringPayment');
     $function = $this->document->createElement('ns2:Function');
     $function->textContent = $this->function;
     $xml->appendChild($function);
     if ($this->function === self::FUNCTION_MODIFY || $this->function === self::FUNCTION_CANCEL) {
         $orderId = $this->document->createElement('ns2:OrderId');
         $orderId->textContent = $this->orderId;
         $xml->appendChild($orderId);
     }
     if ($this->paymentInformation !== null) {
         $paymentInformation = $this->paymentInformation->getXML($this->document);
         $xml->appendChild($paymentInformation);
     }
     if ($this->payment !== null) {
         $payment = $this->payment->getXML($this->document);
         $xml->appendChild($payment);
     }
     $this->element->getElementsByTagName('ns2:Action')->item(0)->appendChild($xml);
 }
예제 #2
0
 /**
  * @param OrderService $service
  * @param Payment      $payment
  */
 public function __construct(OrderService $service, Payment $payment)
 {
     parent::__construct($service);
     $xml = $this->document->createElement('ns2:Validate');
     $ccData = $payment->getXML($this->document);
     $xml->appendChild($ccData);
     $this->element->getElementsByTagName('ns2:Action')->item(0)->appendChild($xml);
 }
예제 #3
0
 /**
  * @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);
     }
 }
예제 #4
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);
 }