コード例 #1
0
 public static function getValue($szXMLVariable, $xtlTagList, &$szValue)
 {
     $boReturnValue = false;
     $lszHierarchicalNames;
     $szXMLTagName;
     $szLastXMLTagName;
     $nCount = 0;
     $xtCurrentTag = null;
     $xaXmlAttribute = null;
     $lXmlTagAttributeList;
     if (xtlTagList == null) {
         $szValue = null;
         return false;
     }
     $lszHierarchicalNames = new CSV_StringList();
     $szValue = null;
     $lszHierarchicalNames = CSV_SharedFunctions::getStringListFromCharSeparatedString($szXMLVariable, '.');
     if (count($lszHierarchicalNames) == 1) {
         $szXMLTagName = $lszHierarchicalNames->getAt(0);
         $xtCurrentTag = CSV_SharedFunctions::GetNamedTagInTagList($szXMLTagName, $xtlTagList);
         if ($xtCurrentTag != null) {
             $lXmlTagAttributeList = $xtCurrentTag->getAttributes();
             $xaXmlAttribute = $lXmlTagAttributeList->getAt($szXMLTagName);
             if ($xaXmlAttribute != null) {
                 $szValue = $xaXmlAttribute->getValue();
                 $boReturnValue = true;
             } else {
                 $szValue = $xtCurrentTag->getContent();
                 $boReturnValue = true;
             }
         }
     } else {
         if (count($lszHierarchicalNames) > 1) {
             $szXMLTagName = $lszHierarchicalNames->getAt(0);
             $szLastXMLTagName = $lszHierarchicalNames->getAt($lszHierarchicalNames->getCount() - 1);
             // need to remove the last variable from the passed name
             for ($nCount = 1; $nCount < $lszHierarchicalNames->getCount() - 1; $nCount++) {
                 $szXMLTagName .= "." . $lszHierarchicalNames->getAt($nCount);
             }
             $xtCurrentTag = CSV_SharedFunctions::getNamedTagInTagList($szXMLTagName, $xtlTagList);
             // first check the attributes of this tag
             if ($xtCurrentTag != null) {
                 $lXmlTagAttributeList = $xtCurrentTag->getAttributes();
                 $xaXmlAttribute = $lXmlTagAttributeList->getXmlAttributeForAttributeName($szLastXMLTagName);
                 if ($xaXmlAttribute != null) {
                     $szValue = $xaXmlAttribute->getValue();
                     $boReturnValue = true;
                 } else {
                     // check to see if it's actually a tag
                     $xtCurrentTag = CSV_SharedFunctions::getNamedTagInTagList($szLastXMLTagName, $xtCurrentTag->getChildTags());
                     if ($xtCurrentTag != null) {
                         $szValue = CSV_SharedFunctions::replaceEntitiesInStringWithChars($xtCurrentTag->getContent());
                         $boReturnValue = true;
                     }
                 }
             }
         }
     }
     return $boReturnValue;
 }
コード例 #2
0
 public static function getPaymentMessageGatewayOutput($GatewayOutput, CSV_GatewayOutput $goGatewayOutput = null)
 {
     $nPreviousStatusCode = null;
     $szPreviousMessage = null;
     $ptdPreviousTransactionResult = null;
     $pmgoPaymentMessageGatewayOutput = null;
     $boAuthorisationAttempted = null;
     if ($GatewayOutput->attributes()) {
         try {
             $szAuthorisationAttempted = current($GatewayOutput->attributes()->AuthorisationAttempted);
             if (strtolower($boAuthorisationAttempted) == 'false') {
                 $boAuthorisationAttempted = new CSV_NullableBool(false);
             } elseif (strtolower($boAuthorisationAttempted) == 'true') {
                 $boAuthorisationAttempted = new CSV_NullableBool(true);
             } else {
                 throw new Exception('Return value must be true or false');
             }
         } catch (Exception $e) {
             $boAuthorisationAttempted = null;
         }
     }
     //check to see if there is any previous transaction data
     if ($GatewayOutput->PreviousTransactionResult->StatusCode) {
         $nPreviousStatusCode = new CSV_NullableInt(current($GatewayOutput->PreviousTransactionResult->StatusCode[0]));
     }
     if ($GatewayOutput->PreviousTransactionResult->Message) {
         $szPreviousMessage = current($GatewayOutput->PreviousTransactionResult->Message[0]);
     }
     if ($nPreviousStatusCode != null && !CSV_SharedFunctions::isStringNullOrEmpty($szPreviousMessage)) {
         $ptdPreviousTransactionResult = new CSV_PreviousTransactionResult($nPreviousStatusCode, $szPreviousMessage);
     }
     $pmgoPaymentMessageGatewayOutput = new CSV_PaymentMessageGatewayOutput($goGatewayOutput->getStatusCode(), $goGatewayOutput->getMessage(), $boAuthorisationAttempted, $ptdPreviousTransactionResult, $goGatewayOutput->getErrorMessages());
     return $pmgoPaymentMessageGatewayOutput;
 }
コード例 #3
0
ファイル: SOAP.php プロジェクト: sohagan/magento-modules
 public function addParam2(CSV_SOAPParameter $spSOAPParam, $boOverWriteValue)
 {
     $lszHierarchicalNames;
     $nCurrentIndex = 0;
     $szTagNameToFind;
     $szString;
     $nCount = 0;
     $nCount2 = 0;
     $lspParamList;
     $spWorkingSOAPParam;
     $spNewSOAPParam;
     $boFound = false;
     $lspaAttributeList;
     $spaAttribute;
     $spaNewAttribute;
     $spaSOAPParamAttributeList;
     // need to check the name of the incoming item to see if it is a
     // complex soap parameter
     $lszHierarchicalNames = new CSV_StringList();
     $lszHierarchicalNames = CSV_SharedFunctions::getStringListFromCharSeparatedString($spSOAPParam->getName(), '.');
     if ($lszHierarchicalNames->getCount() == 1) {
         $this->m_lspSOAPParamList->add($spSOAPParam);
     } else {
         $lspParamList = $this->m_lspSOAPParamList;
         //complex
         for ($nCount = 0; $nCount < $lszHierarchicalNames->getCount(); $nCount++) {
             // get the current tag name
             $szString = (string) $lszHierarchicalNames->getAt($nCount);
             //continuework
             $szTagNameToFind = CSV_SharedFunctions::getArrayNameAndIndex($szString, $nCurrentIndex);
             // first thing is to try to find the tag in the list
             if ($boFound || $nCount == 0) {
                 // try to find this tag name in the list
                 $spWorkingSOAPParam = CSV_Functions::isSOAPParamInParamList($lspParamList, $szTagNameToFind, $nCurrentIndex);
                 if ($spWorkingSOAPParam == null) {
                     $boFound = false;
                 } else {
                     $boFound = true;
                     // is this the last item in the hierarchy?
                     if ($nCount == $lszHierarchicalNames->getCount() - 1) {
                         if ($boOverWriteValue) {
                             // change the value
                             $spWorkingSOAPParam->setValue($spSOAPParam->getValue());
                         }
                         // add the attributes to the list
                         for ($nCount2 = 0; $nCount2 < $spSOAPParam->getSOAPParamAttributeList()->getCount(); $nCount2++) {
                             //$spaAttribute = $spaSOAPParamAttributeList[$nCount2];
                             $spaAttribute = $spSOAPParam->getSOAPParamAttributeList()->getAt($nCount2);
                             if ($spaAttribute != null) {
                                 $spaNewAttribute = new CSV_SOAPParamAttribute($spaAttribute->getName(), $spaAttribute->getValue());
                                 $spWorkingSOAPParam->getSOAPParamAttributeList()->add($spaNewAttribute);
                             }
                         }
                     }
                     $lspParamList = $spWorkingSOAPParam->getSOAPParamList();
                 }
             }
             if (!$boFound) {
                 // is this the last tag?
                 if ($nCount == $lszHierarchicalNames->getCount() - 1) {
                     $lspaAttributeList = new CSV_SOAPParamAttributeList();
                     for ($nCount2 = 0; $nCount2 < $spSOAPParam->getSOAPParamAttributeList()->getCount(); $nCount2++) {
                         $spaSOAPParamAttributeList = $spSOAPParam->getSOAPParamAttributeList();
                         $spaAttribute = $spaSOAPParamAttributeList->getAt($nCount2);
                         if ($spaAttribute != null) {
                             $spaNewAttribute = new CSV_SOAPParamAttribute($spaAttribute->getName(), $spaAttribute->getValue());
                             $lspaAttributeList->add($spaNewAttribute);
                         }
                     }
                     $spNewSOAPParam = new CSV_SOAPParameter($szTagNameToFind, $spSOAPParam->getValue(), $lspaAttributeList);
                     $lspParamList->add($spNewSOAPParam);
                 } else {
                     $spNewSOAPParam = new CSV_SOAPParameter($szTagNameToFind, '', null);
                     $lspParamList->add($spNewSOAPParam);
                     $lspParamList = $spNewSOAPParam->getSOAPParamList();
                 }
             }
         }
     }
     $this->m_boPacketBuilt = false;
 }