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

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

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

        $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));

        if ($this->authAmount != null) {
            $hpsBlock1->appendChild($xml->createElement('hps:AuthAmt', $this->authAmount));
        }

        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 {
            $hpsBlock1->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
        }

        if ($this->details != null) {
            $hpsBlock1->appendChild($this->service->_hydrateAdditionalTxnFields($this->details, $xml));
        }

        $hpsCreditReversal->appendChild($hpsBlock1);
        $hpsTransaction->appendChild($hpsCreditReversal);

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

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

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

        $hpsBlock1->appendChild($xml->createElement('hps:Amt', $this->amount));

        if ($this->authAmount != null) {
            $hpsBlock1->appendChild($xml->createElement('hps:AuthAmt', $this->authAmount));
        }

        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 {
            $hpsBlock1->appendChild($xml->createElement('hps:GatewayTxnId', $this->transactionId));
        }

        if ($this->details != null) {
            $hpsBlock1->appendChild($this->service->_hydrateAdditionalTxnFields($this->details, $xml));
        }

        $hpsCreditReversal->appendChild($hpsBlock1);
        $hpsTransaction->appendChild($hpsCreditReversal);

        return $this->service->_submitTransaction($hpsTransaction, 'CreditReversal', (isset($this->details->clientTransactionId) ? $this->details->clientTransationId : null));
    }
public function execute ( ) { parent :: execute ( ) ; HpsInputValidation :: checkCurrency ( $ this -> currency ) ; HpsInputValidation :: checkAmount ( $ this -> amount ) ; $ xml = new DOMDocument ( ) ; $ hpsTransaction = $ xml -> createElement ( 'hps:Transaction' ) ; $ hpsCreditReversal = $ xml -> createElement ( 'hps:CreditReversal' ) ; $ hpsBlock1 = $ xml -> createElement ( 'hps:Block1' ) ; $ hpsBlock1 -> appendChild ( $ xml -> createElement ( 'hps:Amt' , $ this -> amount ) ) ; if ( $ this -> authAmount != null ) { $ hpsBlock1 -> appendChild ( $ xml -> createElement ( 'hps:AuthAmt' , $ this -> authAmount ) ) ; } 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 { $ hpsBlock1 -> appendChild ( $ xml -> createElement ( 'hps:GatewayTxnId' , $ this -> transactionId ) ) ; } if ( $ this -> details != null ) { $ hpsBlock1 -> appendChild ( $ this -> service -> _hydrateAdditionalTxnFields ( $ this -> details , $ xml ) ) ; } $ hpsCreditReversal -> appendChild ( $ hpsBlock1 ) ; $ hpsTransaction -> appendChild ( $ hpsCreditReversal ) ; return $ this -> service -> _submitTransaction ( $ hpsTransaction , 'CreditReversal' , ( isset ( $ this -> details -> clientTransactionId ) ? $ this -> details -> clientTransationId : null ) ) ; }
Creates a reverse transaction through the HpsCreditService
Creates a reverse transaction through the HpsCreditService