我有以下要求
URI: /IP/{Version}/Account/Payment
HTTP Method: POST
Custom Headers:
X-account-number
X- account-type
X-user-initials,
X-dda-number
X-dda-account-type
X-number-of-days-gap
X-send-ch-letter-flag
X-payment-date
X-payment-option
现在我要做的是我必须从请求中获取付款日期,然后我必须检查以下条件
如果付款日期不为空并且是未来日期并且在从今天起 180 天内。如果是这样,那么首先进行查找以确保在此日期没有安排未来的付款
如果在预定日期没有付款,则将付款插入表格
最后再次执行第一个选择查询并检索值
我正在尝试使用 XSLT 和 datapower
但我没有得到正确的逻辑。
这是我尝试过的
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dp="http://www.datapower.com/extensions"
xmlns:dpconfig="http://www.datapower.com/param/config"
xmlns:date="http://exslt.org/dates-and-times"
extension-element-prefixes="dp date"
exclude-result-prefixes="dp dpconfig"
version="1.0" >
<xsl:template match="/">
<AccountNumber><xsl:value-of select="dp:http-request-header('X-account-number')"/></AccountNumber>
<PaymentDate><xsl:value-of select="dp:http-request-header('X-payment-date')"/></PaymentDate>
<PaymentOption><xsl:value-of select="dp:http-request-header('X-payment-option')"/></PaymentOption>
<Amount><xsl:value-of select="dp:http-request-header('X-amount')"/></Amount>
<AccountType><xsl:value-of select="dp:http-request-header('X-dda-account-type')"/></AccountType>
<xsl:variable name="timestamp" select="date:date-time()"/>
<xsl:variable name="dateDifference" select="date:difference($timestamp,$PaymentDate)"/>
<xsl:if "$dateDifference" < '180' AND "$PaymentDate" != NULL>
<xsl:variable name="LookUp" Select PAYMENT_STATUS_CODE FROM TABLE WHERE WHERE ACCT_NBR ='$ACCOUNTNUMBER' AND AND PMT_DATE = '$PaymentDate'/>
<xsl:variable name ="RunQuery1">
<dp:sql-execute
source="'XXXXX'"
statement="$Lookup">
</dp:sql-execute>
<xsl:variable name="test" copy-of select ="$RunQuery1"/>
<xsl:if test = NULL>
<xsl:variable name="InsertQuery" Insert into TABLE(CREATED_DATE,ACCT_NBR,PMT_AMT_OPTION_CODE,AMOUNT,PMT_DATE,ACCOUNT_TYPE_CODE,PAYMENT_STATUS_CODE)
VALUES('$timestamp','$ACCOUNTNUMBER','$PaymentOption','$Amount','$PaymentDate','$AccountType','P'/>
<xsl:variable name="RunQuery2">
<dp:sql-execute
source="'XXXXX'"
statement="$InsertQuery">
</dp:sql-execute>
</xsl:variable>
</xsl:if>
<xsl:variable name="RetrieveQuery" SELECT PAYMENT_STATUS_CODE from TABLE/>
<xsl:variable name="RunQuery3">
<dp:sql-execute
source="'XXXXX'"
statement="$RetrieveQuery">
</dp:sql-execute>
</xsl:variable>
<xsl:copy-of select="$RunQuery3"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
我做错了什么?