@Override public boolean apply(final PaymentMethodPlugin input) { return (input.getAddress1() != null && input.getAddress1().contains(searchKey)) || (input.getAddress2() != null && input.getAddress2().contains(searchKey)) || (input.getCCLast4() != null && input.getCCLast4().contains(searchKey)) || (input.getCCName() != null && input.getCCName().contains(searchKey)) || (input.getCity() != null && input.getCity().contains(searchKey)) || (input.getState() != null && input.getState().contains(searchKey)) || (input.getCountry() != null && input.getCountry().contains(searchKey)); } }));
public DefaultNoOpPaymentMethodPlugin(final UUID kbPaymentMethodId, final PaymentMethodPlugin src) { this.kbPaymentMethodId = kbPaymentMethodId; this.externalId = UUID.randomUUID().toString(); this.isDefault = src.isDefaultPaymentMethod(); this.props = src.getProperties(); }
@Override public UUID apply(@Nullable final Payment input) { if (input == null) { return null; } else { return input.getId(); } } });
public PaymentJson(final Payment payment, final String bundleExternalKey, final List<RefundJson> refunds, final List<ChargebackJson> chargebacks, @Nullable final List<AuditLog> auditLogs) { this(payment.getAmount(), payment.getPaidAmount(), payment.getAccountId().toString(), payment.getInvoiceId().toString(), payment.getId().toString(), payment.getPaymentNumber().toString(), payment.getPaymentMethodId().toString(), payment.getEffectiveDate(), payment.getEffectiveDate(), payment.getAttempts().size(), payment.getCurrency().toString(), payment.getPaymentStatus().toString(), payment.getAttempts().get(payment.getAttempts().size() - 1).getGatewayErrorCode(), payment.getAttempts().get(payment.getAttempts().size() - 1).getGatewayErrorMsg(), bundleExternalKey, refunds, chargebacks, toAuditLogJson(auditLogs)); }
@Override public Void call() throws Exception { throw new PaymentApiException(ErrorCode.PAYMENT_ADD_PAYMENT_METHOD, "foo", "foo"); } }, 100, TimeUnit.MILLISECONDS);
public static String getPaymentMethodType(@Nullable final PaymentMethodPlugin pluginDetail) { if (pluginDetail == null) { return null; } return pluginDetail.getValueString(TYPE_KEY); } }
@Override public Boolean call() throws Exception { final Payment payment = getPaymentForInvoice(invoice.getId()); return payment.getPaymentStatus() == PaymentStatus.SUCCESS; } });
@Override public PaymentMethod apply(final PaymentMethodPlugin paymentMethodPlugin) { if (paymentMethodPlugin.getKbPaymentMethodId() == null) { // Garbage from the plugin? log.debug("Plugin {} returned a payment method without a kbPaymentMethodId for searchKey {}", pluginName, searchKey); return null; } final PaymentMethodModelDao paymentMethodModelDao = paymentDao.getPaymentMethodIncludedDeleted(paymentMethodPlugin.getKbPaymentMethodId(), internalTenantContext); if (paymentMethodModelDao == null) { log.warn("Unable to find payment method id " + paymentMethodPlugin.getKbPaymentMethodId() + " present in plugin " + pluginName); return null; } return new DefaultPaymentMethod(paymentMethodModelDao, paymentMethodPlugin); } }
public List<Refund> toRefunds(final List<RefundModelDao> in) { return new ArrayList<Refund>(Collections2.transform(in, new Function<RefundModelDao, Refund>() { @Override public Refund apply(final RefundModelDao cur) { return new DefaultRefund(cur.getId(), cur.getCreatedDate(), cur.getUpdatedDate(), cur.getPaymentId(), cur.getAmount(), cur.getCurrency(), cur.isAdjusted(), cur.getCreatedDate(), cur.getRefundStatus()); } })); }
@Test(groups = "fast") public void testSimplePaymentWithInvoiceAmount() throws Exception { final BigDecimal invoiceAmount = new BigDecimal("10.0011"); final BigDecimal requestedAmount = invoiceAmount; final BigDecimal expectedAmount = invoiceAmount; testSimplePayment(invoiceAmount, requestedAmount, expectedAmount); }
@Override public int compare(final PaymentAttempt o1, final PaymentAttempt o2) { return o1.getEffectiveDate().compareTo(o2.getEffectiveDate()); } });
@Override public boolean apply(final PaymentMethodPlugin input) { return (input.getAddress1() != null && input.getAddress1().contains(searchKey)) || (input.getAddress2() != null && input.getAddress2().contains(searchKey)) || (input.getCCLast4() != null && input.getCCLast4().contains(searchKey)) || (input.getCCName() != null && input.getCCName().contains(searchKey)) || (input.getCity() != null && input.getCity().contains(searchKey)) || (input.getState() != null && input.getState().contains(searchKey)) || (input.getCountry() != null && input.getCountry().contains(searchKey)); } }));
public TestPaymentMethodPlugin(final UUID kbPaymentMethodId, final PaymentMethodPlugin src, final String externalPaymentId) { this.kbPaymentMethodId = kbPaymentMethodId; this.externalPaymentMethodId = externalPaymentId; this.isDefaultPaymentMethod = src.isDefaultPaymentMethod(); this.properties = src.getProperties(); }
@Override public Payment getPayment(final UUID paymentId, final InternalTenantContext context) throws PaymentApiException { final Payment payment = paymentProcessor.getPayment(paymentId, false, context); if (payment == null) { throw new PaymentApiException(ErrorCode.PAYMENT_NO_SUCH_PAYMENT, paymentId); } return payment; }
public static String getCardType(@Nullable final PaymentMethodPlugin pluginDetail) { if (pluginDetail == null) { return null; } return pluginDetail.getValueString(CARD_TYPE_KEY); }
@Override public Refund apply(final RefundModelDao cur) { return new DefaultRefund(cur.getId(), cur.getCreatedDate(), cur.getUpdatedDate(), cur.getPaymentId(), cur.getAmount(), cur.getCurrency(), cur.isAdjusted(), cur.getCreatedDate(), cur.getRefundStatus()); } }));
@Test(groups = "fast") public void testSimplePaymentWithLowerAmount() throws Exception { final BigDecimal invoiceAmount = new BigDecimal("10.0011"); final BigDecimal requestedAmount = new BigDecimal("8.0091"); final BigDecimal expectedAmount = requestedAmount; testSimplePayment(invoiceAmount, requestedAmount, expectedAmount); }
protected PaymentPluginApi getPaymentPluginApi(final String pluginName) throws PaymentApiException { final PaymentPluginApi pluginApi = pluginRegistry.getServiceForName(pluginName); if (pluginApi == null) { throw new PaymentApiException(ErrorCode.PAYMENT_NO_SUCH_PAYMENT_PLUGIN, pluginName); } return pluginApi; }
public static String getCardCountry(@Nullable final PaymentMethodPlugin pluginDetail) { if (pluginDetail == null) { return null; } return pluginDetail.getValueString(COUNTRY_KEY); }
protected PaymentPluginApi getPaymentProviderPlugin(final Account account, final InternalTenantContext context) throws PaymentApiException { final UUID paymentMethodId = account.getPaymentMethodId(); if (paymentMethodId == null) { throw new PaymentApiException(ErrorCode.PAYMENT_NO_DEFAULT_PAYMENT_METHOD, account.getId()); } return getPaymentProviderPlugin(paymentMethodId, context); }