Source:
public void processInvoiceEvent(final InvoiceCreationInternalEvent event) { log.info("Received invoice creation notification for account and invoice {}", event.getAccountId(), event.getInvoiceId()); final Account account; try { final InternalCallContext internalContext = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "PaymentRequestProcessor", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken()); final Invoice invoice = invoiceApi.getInvoiceById(event.getInvoiceId(), internalContext); if (!InvoiceStatus.COMMITTED.equals(invoice.getStatus())) { log.info("Ignoring payment for non COMMITTED invoice " + event.getInvoiceId()); return; } account = accountApi.getAccountById(event.getAccountId(), internalContext); final List<PluginProperty> properties = new ArrayList<PluginProperty>(); final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, event.getInvoiceId().toString(), false); properties.add(prop1); final CallContext callContext = internalCallContextFactory.createCallContext(internalContext); final BigDecimal amountToBePaid = null; final List<String> paymentControlPluginNames = paymentConfig.getPaymentControlPluginNames() != null ? new LinkedList<String>(paymentConfig.getPaymentControlPluginNames()) : new LinkedList<String>(); paymentControlPluginNames.add(InvoicePaymentControlPluginApi.PLUGIN_NAME); pluginControlPaymentProcessor.createPurchase(false, account, account.getPaymentMethodId(), null, amountToBePaid, account.getCurrency(), UUIDs.randomUUID().toString(), UUIDs.randomUUID().toString(), properties, paymentControlPluginNames, callContext, internalContext); } catch (final AccountApiException e) { log.error("Failed to process invoice payment", e); } catch (InvoiceApiException e) { log.error("Failed to process invoice payment", e); } catch (final PaymentApiException e) { if (e.getCode() != ErrorCode.PAYMENT_NULL_INVOICE.getCode() && e.getCode() != ErrorCode.PAYMENT_CREATE_PAYMENT.getCode() ) { log.error("Failed to process invoice payment {}", e.toString()); } } }

Target:
public void processInvoiceEvent(final InvoiceCreationInternalEvent event) { log.info("Received invoice creation notification for account and invoice {}", event.getAccountId(), event.getInvoiceId()); final Account account; try { final InternalCallContext internalContext = internalCallContextFactory.createInternalCallContext(event.getSearchKey2(), event.getSearchKey1(), "PaymentRequestProcessor", CallOrigin.INTERNAL, UserType.SYSTEM, event.getUserToken()); account = accountApi.getAccountById(event.getAccountId(), internalContext); final List<PluginProperty> properties = new ArrayList<PluginProperty>(); final PluginProperty prop1 = new PluginProperty(InvoicePaymentControlPluginApi.PROP_IPCD_INVOICE_ID, event.getInvoiceId().toString(), false); properties.add(prop1); final CallContext callContext = internalCallContextFactory.createCallContext(internalContext); final BigDecimal amountToBePaid = null; final List<String> paymentControlPluginNames = paymentConfig.getPaymentControlPluginNames() != null ? new LinkedList<String>(paymentConfig.getPaymentControlPluginNames()) : new LinkedList<String>(); paymentControlPluginNames.add(InvoicePaymentControlPluginApi.PLUGIN_NAME); pluginControlPaymentProcessor.createPurchase(false, account, account.getPaymentMethodId(), null, amountToBePaid, account.getCurrency(), UUIDs.randomUUID().toString(), UUIDs.randomUUID().toString(), properties, paymentControlPluginNames, callContext, internalContext); } catch (final AccountApiException e) { log.error("Failed to process invoice payment", e); } catch (final PaymentApiException e) { if (e.getCode() != ErrorCode.PAYMENT_NULL_INVOICE.getCode() && e.getCode() != ErrorCode.PAYMENT_CREATE_PAYMENT.getCode() ) { log.error("Failed to process invoice payment {}", e.toString()); } } }