public function execute()
    {
        parent::execute();

        HpsInputValidation::checkAmount($this->amount);

        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsRecurringBilling = $xml->createElement('hps:RecurringBilling');
        $hpsBlock1 = $xml->createElement('hps:Block1');

        $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', 'Y'));
        $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));
        if ($this->cardHolder != null) {
            $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder, $xml));
        }
        if ($this->details != null) {
            $hpsBlock1->appendChild($this->service->_hydrateAdditionalTxnFields($this->details, $xml));
        }

        if ($this->card != null) {
            $cardData = $xml->createElement('hps:CardData');
            $cardData->appendChild($this->service->_hydrateManualEntry($this->card, $xml));
            $hpsBlock1->appendChild($cardData);
        } else if ($this->token != null) {
            $cardData = $xml->createElement('hps:CardData');
            $cardData->appendChild($this->service->_hydrateTokenData($this->token, $xml));
            $hpsBlock1->appendChild($cardData);
        } else if ($this->paymentMethodKey != null) {
            $hpsBlock1->appendChild($xml->createElement('hps:PaymentMethodKey', $this->paymentMethodKey));
        }

        $recurringData = $xml->createElement('hps:RecurringData');
        if ($this->schedule != null) {
            $id = $this->schedule;
            if ($this->schedule instanceof HpsPayPlanSchedule) {
                $id = $this->schedule->scheduleIdentifier;
            }
            $recurringData->appendChild($xml->createElement('hps:ScheduleID', $id));
        }
        $recurringData->appendChild($xml->createElement('hps:OneTime', ($this->oneTime ? 'Y' : 'N')));

        $hpsBlock1->appendChild($recurringData);
        $hpsRecurringBilling->appendChild($hpsBlock1);
        $hpsTransaction->appendChild($hpsRecurringBilling);

        return $this->service->_submitTransaction($hpsTransaction, 'RecurringBilling', (isset($this->details->clientTransactionId) ? $this->details->clientTransactionId : null));
    }
public function execute()
    {
        parent::execute();

        HpsInputValidation::checkAmount($this->amount);

        $xml = new DOMDocument();
        $hpsTransaction = $xml->createElement('hps:Transaction');
        $hpsRecurringBilling = $xml->createElement('hps:RecurringBilling');
        $hpsBlock1 = $xml->createElement('hps:Block1');

        $hpsBlock1->appendChild($xml->createElement('hps:AllowDup', 'Y'));
        $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));
        if ($this->cardHolder != null) {
            $hpsBlock1->appendChild($this->service->_hydrateCardHolderData($this->cardHolder, $xml));
        }
        if ($this->details != null) {
            $hpsBlock1->appendChild($this->service->_hydrateAdditionalTxnFields($this->details, $xml));
        }

        if ($this->card != null) {
            $cardData = $xml->createElement('hps:CardData');
            $cardData->appendChild($this->service->_hydrateManualEntry($this->card, $xml));
            $hpsBlock1->appendChild($cardData);
        } else if ($this->token != null) {
            $cardData = $xml->createElement('hps:CardData');
            $cardData->appendChild($this->service->_hydrateTokenData($this->token, $xml));
            $hpsBlock1->appendChild($cardData);
        } else if ($this->paymentMethodKey != null) {
            $hpsBlock1->appendChild($xml->createElement('hps:PaymentMethodKey', $this->paymentMethodKey));
        }

        $recurringData = $xml->createElement('hps:RecurringData');
        if ($this->schedule != null) {
            $id = $this->schedule;
            if ($this->schedule instanceof HpsPayPlanSchedule) {
                $id = $this->schedule->scheduleIdentifier;
            }
            $recurringData->appendChild($xml->createElement('hps:ScheduleID', $id));
        }
        $recurringData->appendChild($xml->createElement('hps:OneTime', ($this->oneTime ? 'Y' : 'N')));

        $hpsBlock1->appendChild($recurringData);
        $hpsRecurringBilling->appendChild($hpsBlock1);
        $hpsTransaction->appendChild($hpsRecurringBilling);

        return $this->service->_submitTransaction($hpsTransaction, 'RecurringBilling', (isset($this->details->clientTransactionId) ? $this->details->clientTransactionId : null));
    }
public function execute ( ) { parent :: execute ( ) ; HpsInputValidation :: checkAmount ( $ this -> amount ) ; $ xml = new DOMDocument ( ) ; $ hpsTransaction = $ xml -> createElement ( 'hps:Transaction' ) ; $ hpsRecurringBilling = $ xml -> createElement ( 'hps:RecurringBilling' ) ; $ hpsBlock1 = $ xml -> createElement ( 'hps:Block1' ) ; $ hpsBlock1 -> appendChild ( $ xml -> createElement ( 'hps:AllowDup' , 'Y' ) ) ; $ hpsBlock1 -> appendChild ( $ xml -> createElement ( 'hps:Amt' , $ this -> amount ) ) ; if ( $ this -> cardHolder != null ) { $ hpsBlock1 -> appendChild ( $ this -> service -> _hydrateCardHolderData ( $ this -> cardHolder , $ xml ) ) ; } if ( $ this -> details != null ) { $ hpsBlock1 -> appendChild ( $ this -> service -> _hydrateAdditionalTxnFields ( $ this -> details , $ xml ) ) ; } if ( $ this -> card != null ) { $ cardData = $ xml -> createElement ( 'hps:CardData' ) ; $ cardData -> appendChild ( $ this -> service -> _hydrateManualEntry ( $ this -> card , $ xml ) ) ; $ hpsBlock1 -> appendChild ( $ cardData ) ; } else if ( $ this -> token != null ) { $ cardData = $ xml -> createElement ( 'hps:CardData' ) ; $ cardData -> appendChild ( $ this -> service -> _hydrateTokenData ( $ this -> token , $ xml ) ) ; $ hpsBlock1 -> appendChild ( $ cardData ) ; } else if ( $ this -> paymentMethodKey != null ) { $ hpsBlock1 -> appendChild ( $ xml -> createElement ( 'hps:PaymentMethodKey' , $ this -> paymentMethodKey ) ) ; } $ recurringData = $ xml -> createElement ( 'hps:RecurringData' ) ; if ( $ this -> schedule != null ) { $ id = $ this -> schedule ; if ( $ this -> schedule instanceof HpsPayPlanSchedule ) { $ id = $ this -> schedule -> scheduleIdentifier ; } $ recurringData -> appendChild ( $ xml -> createElement ( 'hps:ScheduleID' , $ id ) ) ; } $ recurringData -> appendChild ( $ xml -> createElement ( 'hps:OneTime' , ( $ this -> oneTime ? 'Y' : 'N' ) ) ) ; $ hpsBlock1 -> appendChild ( $ recurringData ) ; $ hpsRecurringBilling -> appendChild ( $ hpsBlock1 ) ; $ hpsTransaction -> appendChild ( $ hpsRecurringBilling ) ; return $ this -> service -> _submitTransaction ( $ hpsTransaction , 'RecurringBilling' , ( isset ( $ this -> details -> clientTransactionId ) ? $ this -> details -> clientTransactionId : null ) ) ; }
Creates a recurring billing transaction through the HpsCreditService
Creates a recurring billing transaction through the HpsCreditService