@@ -89,6 +89,7 @@ along with this software (see the LICENSE.md file). If not, see
8989 <set field =" expireDateFormatted" value =" ${expireYear}-${expireMonth}" />
9090 <!-- correct masking if needed, use only 'X' -->
9191 <set field =" cardNumber" from =" creditCard.cardNumber?.replaceAll(/\D/, 'X')" />
92+ <if condition =" paymentMethod.gatewayCimId" ><then >
9293 <!-- current paymentMethod has a gatewayCimId -->
9394 <set field =" foundGatewayCimId" from =" paymentMethod.gatewayCimId" />
9495 </then ><else >
@@ -220,8 +221,13 @@ along with this software (see the LICENSE.md file). If not, see
220221
221222 <!-- set the gatewayCimId values for Party and PaymentMethod as needed -->
222223 <if condition =" paymentMethod.gatewayCimId" ><then >
223- <!-- have a payment profile, called updateCustomerPaymentProfileRequest, no need to do anything -->
224- </then ><else-if condition =" party.gatewayCimId" >
224+ <!-- current paymentMethod has a profile, no need to do anything -->
225+ </then ><else-if condition =" foundGatewayCimId" >
226+ <!-- Updating a previous profile, attach to the current paymentMethod -->
227+ <set field =" paymentMethod.gatewayCimId" from =" foundGatewayCimId" />
228+ <set field =" paymentMethod.paymentGatewayConfigId" from =" paymentGatewayConfigId" />
229+ <entity-update value-field =" paymentMethod" />
230+ </else-if ><else-if condition =" party.gatewayCimId" >
225231 <!-- no payment profile but we have a customer profile, called createCustomerPaymentProfileRequest -->
226232 <set field =" paymentMethod.gatewayCimId" from =" responseNode.customerPaymentProfileId.text()" />
227233 <set field =" paymentMethod.paymentGatewayConfigId" from =" paymentGatewayConfigId" />
0 commit comments