protected Payment getPaymentByIdOrKey(@Nullable final UUID paymentId, @Nullable final String externalKey, final Iterable<PluginProperty> pluginProperties, final TenantContext tenantContext) throws PaymentApiException { Preconditions.checkArgument(paymentId != null || externalKey != null, "Need to set either paymentId or payment externalKey"); if (paymentId != null) { return paymentApi.getPayment(paymentId, false, false, pluginProperties, tenantContext); } else { return paymentApi.getPaymentByExternalKey(externalKey, false, false, pluginProperties, tenantContext); } }
@TimedResource(name = "getPayment") @GET @Produces(APPLICATION_JSON) @ApiOperation(value = "Retrieve a payment by external key", response = PaymentJson.class) @ApiResponses(value = {@ApiResponse(code = 404, message = "Payment not found")}) public Response getPaymentByExternalKey(@QueryParam(QUERY_WITH_PLUGIN_INFO) @DefaultValue("false") final Boolean withPluginInfo, @QueryParam(QUERY_WITH_ATTEMPTS) @DefaultValue("false") final Boolean withAttempts, @ApiParam(required=true) @QueryParam(QUERY_EXTERNAL_KEY) final String paymentExternalKey, @QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString, @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode, @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException { verifyNonNullOrEmpty(paymentExternalKey, "Payment externalKey needs to be specified"); final Iterable<PluginProperty> pluginProperties = extractPluginProperties(pluginPropertiesString); final TenantContext tenantContext = context.createTenantContextNoAccountId(request); final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, withPluginInfo, withAttempts, pluginProperties, tenantContext); final AccountAuditLogs accountAuditLogs = auditUserApi.getAccountAuditLogs(payment.getAccountId(), auditMode.getLevel(), tenantContext); final PaymentJson result = new PaymentJson(payment, accountAuditLogs); return Response.status(Response.Status.OK).entity(result).build(); }
INVOICE_PAYMENT, callContext); final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext); assertEquals(payment.getExternalKey(), paymentExternalKey); assertEquals(payment.getPaymentMethodId(), account.getPaymentMethodId());
PAYMENT_OPTIONS, callContext); final Payment paymentInfo = paymentApi.getPaymentByExternalKey(invoice.getId().toString(), false, false, ImmutableList.<PluginProperty>of(), callContext); if (requestedAmount != null && expectedAmount == null) { fail("Expected to fail because requested amount > invoice amount");
INVOICE_PAYMENT, callContext); final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
INVOICE_PAYMENT, callContext); final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
INVOICE_PAYMENT, callContext); final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
testListener.assertListenerStatus(); final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext);
INVOICE_PAYMENT, callContext); final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext); testListener.assertListenerStatus(); assertEquals(payment.getTransactions().size(), 1);
INVOICE_PAYMENT, callContext); final Payment payment = paymentApi.getPaymentByExternalKey(paymentExternalKey, false, false, ImmutableList.<PluginProperty>of(), callContext); testListener.assertListenerStatus();