/** * @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); }
/** * @param OrderService $service * @param DataStorageItem $storageItem */ public function __construct(OrderService $service, DataStorageItem $storageItem) { parent::__construct($service); $xml = $this->document->createElement('ns2:StoreHostedData'); $storageData = $storageItem->getXML($this->document); $xml->appendChild($storageData); $this->element->getElementsByTagName('ns2:Action')->item(0)->appendChild($xml); }
/** * @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); }
/** * @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); }