Skip to content
Open
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
12 changes: 9 additions & 3 deletions service/mantle/account/FinancialAccountServices.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ along with this software (see the LICENSE.md file). If not, see
<parameter name="entryDate" type="Timestamp" default="ec.user.nowTimestamp"/>
<!-- maybe support in the future with currency conversion: <parameter name="amountUomId"/> -->
<!-- <parameter name="isRefund" type="Boolean" default="false"/> -->
<parameter name="decimalDigits" type="Integer" default="2" required="true">
<description>Must be less than or equal to 4 due to that being the limit of currency-amount entity field type</description></parameter>
</in-parameters>
<out-parameters>
<parameter name="amount" type="BigDecimal"/>
Expand All @@ -235,7 +237,7 @@ along with this software (see the LICENSE.md file). If not, see
<parameter name="finAccountTransId"/>
</out-parameters>
<actions>
<set field="amount" from="amount.setScale(2, BigDecimal.ROUND_HALF_UP)"/>
<set field="amount" from="amount.setScale(decimalDigits, BigDecimal.ROUND_HALF_UP)"/>
<set field="performedByUserId" from="ec.user.userId"/>

<!-- do a for-update query to lock the FinancialAccount record -->
Expand Down Expand Up @@ -267,6 +269,8 @@ along with this software (see the LICENSE.md file). If not, see
<parameter name="entryDate" type="Timestamp" default="ec.user.nowTimestamp"/>
<!-- maybe support in the future with currency conversion: <parameter name="amountUomId"/> -->
<!-- <parameter name="isRefund" type="Boolean" default="false"/> -->
<parameter name="decimalDigits" type="Integer" default="2" required="true">
<description>Must be less than or equal to 4 due to that being the limit of currency-amount entity field type</description></parameter>
</in-parameters>
<out-parameters>
<parameter name="amount" type="BigDecimal"/>
Expand All @@ -277,7 +281,7 @@ along with this software (see the LICENSE.md file). If not, see
<actions>
<if condition="amount &lt; 0.0"><return error="true" message="Cannot deposit negative amount ${amount}, do a withdraw instead"/></if>

<set field="amount" from="amount.setScale(2, BigDecimal.ROUND_HALF_UP)"/>
<set field="amount" from="amount.setScale(decimalDigits, BigDecimal.ROUND_HALF_UP)"/>
<set field="performedByUserId" from="ec.user.userId"/>

<!-- do a for-update query to lock the FinancialAccount record -->
Expand Down Expand Up @@ -310,6 +314,8 @@ along with this software (see the LICENSE.md file). If not, see
<parameter name="entryDate" type="Timestamp" default="ec.user.nowTimestamp"/>
<!-- maybe support in the future with currency conversion: <parameter name="amountUomId"/> -->
<!-- <parameter name="isRefund" type="Boolean" default="false"/> -->
<parameter name="decimalDigits" type="Integer" default="2" required="true">
<description>Must be less than or equal to 4 due to that being the limit of currency-amount entity field type</description></parameter>
</in-parameters>
<out-parameters>
<parameter name="amount" type="BigDecimal"/>
Expand All @@ -322,7 +328,7 @@ along with this software (see the LICENSE.md file). If not, see
<actions>
<if condition="amount &lt; 0.0"><return error="true" message="Cannot withdraw negative amount ${amount}, do a deposit instead"/></if>

<set field="amount" from="amount.setScale(2, BigDecimal.ROUND_HALF_UP)"/>
<set field="amount" from="amount.setScale(decimalDigits, BigDecimal.ROUND_HALF_UP)"/>
<set field="performedByUserId" from="ec.user.userId"/>

<!-- do a for-update query to lock the FinancialAccount record -->
Expand Down