Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

persist transaction seq filter added. #45

Open
wants to merge 3 commits into
base: consent-management
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,13 @@
<artifact name="mandateCheckSeq" groupId="com.wso2telco.dep.gw.sequence" version="2.1.1-SNAPSHOT" type="synapse/sequence" serverRole="EnterpriseServiceBus">
<file>src/main/synapse-config/sequences/mandateCheckSeq.xml</file>
</artifact>
<artifact name="persistTransactionSeq" groupId="com.wso2telco.dep.gw.sequence" version="2.1.1-SNAPSHOT" type="synapse/sequence" serverRole="EnterpriseServiceBus">
<file>src/main/synapse-config/sequences/persistTransactionSeq.xml</file>
</artifact>
<artifact name="updateSuccessLastPaymentDateSeq" groupId="com.wso2telco.dep.gw.sequence" version="2.1.1-SNAPSHOT" type="synapse/sequence" serverRole="EnterpriseServiceBus">
<file>src/main/synapse-config/sequences/updateSuccessLastPaymentDateSeq.xml</file>
</artifact>
<artifact name="updateSuccessLastPaymentDateEndpoint" groupId="com.wso2telco.dep.gw.endpoint" version="2.1.1-SNAPSHOT" type="synapse/endpoint" serverRole="EnterpriseServiceBus">
<file>src/main/synapse-config/endpoints/updateSuccessLastPaymentDateEndpoint.xml</file>
</artifact>
</artifacts>
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="paymentOutMainSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<switch source="get-property('HANDLER')" xmlns:ns="http://org.apache.synapse/xsd">
<case regex="ListTransactionsHandler">
<switch source="$axis2:HTTP_SC">
<case regex="(200|201)">
<sequence key="replaceResourceURLForListSeq"/>
</case>
<default/>
</switch>
<switch source="get-property('HANDLER')" xmlns:ns="http://org.apache.synapse/xsd">
<case regex="ListTransactionsHandler">
<switch source="$axis2:HTTP_SC">
<case regex="(200|201)">
<sequence key="replaceResourceURLForListSeq"/>
</case>
<case regex="(AmountChargeHandler|AmountRefundHandler)">
<switch source="$axis2:HTTP_SC">
<case regex="(200|201)">
<sequence key="replaceResourceURLSeq"/>
</case>
<default/>
</switch>
<default/>
</switch>
</case>
<case regex="(AmountChargeHandler|AmountRefundHandler)">
<switch source="$axis2:HTTP_SC">
<case regex="(200|201)">
<sequence key="persistTransactionSeq"/>
<sequence key="replaceResourceURLSeq"/>
</case>
<default/>
</switch>
</switch>
</case>
<default/>
</switch>
</sequence>
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="persistTransactionSeq" onError="commonFault"
trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<filter description="" regex="sb" source="fn:normalize-space($func:direction)">
<then>
<filter regex="AmountChargeHandler" source="$ctx:HANDLER">
<sequence name="persistTransactionSeq" onError="commonFault" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property expression="fn:normalize-space(get-property('direction'))" name="direction" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<property expression="fn:normalize-space(get-property('HANDLER'))" name="normalizedHandler" scope="default" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<filter regex="AmountChargeHandler" source="get-property('HANDLER')" xmlns:ns="http://org.apache.synapse/xsd">
<then>
<filter regex="201" source="$axis2:HTTP_SC">
<then>
<dbreport>
<connection>
<pool>
<dsName>jdbc/WSO2TELCO_DEP_DB</dsName>
</pool>
</connection>
<statement>
<sql><![CDATA[insert into persisttansaction(consumerKey,msisdn,amount,currency) values(?,?,?,?)]]></sql>
<parameter expression="$ctx:CONSUMER_KEY" type="VARCHAR"/>
<parameter
expression="fn:substring-after($ctx:MSISDN,'tel:+')" type="VARCHAR"/>
<parameter expression="$ctx:chargeAmount" type="DECIMAL"/>
<parameter expression="//currency" type="VARCHAR"/>
</statement>
</dbreport>
</then>
<else/>
</filter>
<filter regex="(200|201)" source="$axis2:HTTP_SC">
<then>
<dbreport>
<connection>
<pool>
<dsName>jdbc/WSO2TELCO_DEP_DB</dsName>
</pool>
</connection>
<statement>
<sql><![CDATA[insert into persisttansaction(consumerKey,msisdn,amount,currency) values(?,?,?,?)]]></sql>
<parameter expression="$ctx:CONSUMER_KEY" type="VARCHAR"/>
<parameter expression="fn:substring-after($ctx:MSISDN,'tel:+')" type="VARCHAR"/>
<parameter expression="$ctx:chargeAmount" type="DECIMAL"/>
<parameter expression="//currency" type="VARCHAR"/>
</statement>
</dbreport>
</then>
<else/>
</filter>
</then>
<else/>
</filter>
</then>
<else/>
</filter>
</filter>
</sequence>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="updateSuccessLastPaymentDateSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<sequence key="com.wso2telco.dep.subscriptionapi.main.request.Sequence"/>
<!-- Parameter for retrieving -->
<property expression="json-eval($.appId)" name="appId" scope="default" type="STRING"/>
<property expression="json-eval($.msisdn)" name="msisdn" scope="default" type="STRING"/>
<property expression="json-eval($.)" name="ORIGINAL_PAYLOAD" scope="default" type="STRING"/>
<!-- retrieve endpoint from registry -->
<property name="API_ENDPOINT" scope="default" type="STRING" value="http://localhost:9763/mandate-server/mandates/updateLastPaymentTime"/>
<sequence key="com.wso2telco.dep.subscriptionapi.mandate.call.Sequence"/>
<filter regex="200|201" source="get-property('axis2', 'HTTP_SC')">
<then/>
<else>
<log level="full">
<property name="ERROR_MSG" value="Failure in mandate engine"/>
</log>
</else>
</filter>
<sequence key="com.wso2telco.dep.common.main.response.Sequence"/>
</sequence>