Tabnine Logo
PaymentMethodPlugin
Code IndexAdd Tabnine to your IDE (free)

How to use
PaymentMethodPlugin
in
org.killbill.billing.payment.api

Best Java code snippets using org.killbill.billing.payment.api.PaymentMethodPlugin (Showing top 9 results out of 315)

origin: org.kill-bill.billing/killbill-jaxrs

public static PaymentMethodJson toPaymentMethodJson(final Account account, final PaymentMethod in, @Nullable final AccountAuditLogs accountAuditLogs) {
  final boolean isDefault = account.getPaymentMethodId() != null && account.getPaymentMethodId().equals(in.getId());
  final PaymentMethodPlugin pluginDetail = in.getPluginDetail();
  PaymentMethodPluginDetailJson pluginDetailJson = null;
  if (pluginDetail != null) {
    List<PluginPropertyJson> properties = null;
    if (pluginDetail.getProperties() != null) {
      properties = new ArrayList<PluginPropertyJson>(Collections2.transform(pluginDetail.getProperties(), new Function<PluginProperty, PluginPropertyJson>() {
        @Override
        public PluginPropertyJson apply(final PluginProperty input) {
          return new PluginPropertyJson(input.getKey(), input.getValue() == null ? null : input.getValue().toString(), input.getIsUpdatable());
        }
      }));
    }
    pluginDetailJson = new PaymentMethodPluginDetailJson(pluginDetail.getExternalPaymentMethodId(),
                               pluginDetail.isDefaultPaymentMethod(),
                               properties);
  }
  return new PaymentMethodJson(in.getId(), in.getExternalKey(), account.getId(), isDefault, in.getPluginName(),
                 pluginDetailJson, toAuditLogJson(accountAuditLogs == null ? null : accountAuditLogs.getAuditLogsForPaymentMethod(in.getId())));
}
origin: org.kill-bill.billing/killbill-payment

  @Override
  public boolean apply(final PaymentMethodPlugin input) {
    if (input.getProperties() !=  null) {
      for (PluginProperty cur : input.getProperties()) {
        if (cur.getValue().equals(searchKey)) {
          return true;
        }
      }
    }
    return (input.getKbPaymentMethodId().toString().equals(searchKey));
  }
}));
origin: org.kill-bill.billing/killbill-payment

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();
}
origin: org.kill-bill.billing.plugin.java/killbill-base-plugin

Assert.assertEquals(plugin.getKbPaymentMethodId(), kbPaymentMethodId, "Wrong kbPaymentMethodId");
Assert.assertEquals(plugin.getExternalPaymentMethodId(), null, "Wrong externalPaymentMethodId");
Assert.assertEquals(plugin.isDefaultPaymentMethod(), true, "Wrong defaultPaymentMethod");
Assert.assertNotNull(plugin.getProperties(), "Wrong properties");
Assert.assertEquals(plugin.getProperties().size(), 0, "Wrong properties size");
origin: org.kill-bill.billing/killbill-payment

public UUID addTestPaymentMethod(final String pluginName, final Account account, final PaymentMethodPlugin paymentMethodInfo, final Iterable<PluginProperty> pluginProperties) throws Exception {
  final boolean setDefault = paymentMethodInfo.isDefaultPaymentMethod();
  final UUID paymentMethodId = paymentApi.addPaymentMethod(account, paymentMethodInfo.getExternalPaymentMethodId(), pluginName, setDefault, paymentMethodInfo, pluginProperties, context);
  if (isFastTest() && setDefault) {
    final Account account1 = new MockAccountBuilder(account).paymentMethodId(paymentMethodId).build();
    accountApi.updateAccount(account1, context);
  }
  return paymentMethodId;
}
origin: org.kill-bill.billing.plugin.java/killbill-base-plugin

@Override
public void addPaymentMethod(final UUID kbAccountId, final UUID kbPaymentMethodId, final PaymentMethodPlugin paymentMethodProps, final boolean setDefault, final Iterable<PluginProperty> properties, final CallContext context) throws PaymentPluginApiException {
  // Note: query parameters have precedence by convention
  final Map<String, String> mergedProperties = PluginProperties.toStringMap(paymentMethodProps.getProperties(), properties);
  final DateTime utcNow = clock.getUTCNow();
  try {
    dao.addPaymentMethod(kbAccountId, kbPaymentMethodId, setDefault, mergedProperties, utcNow, context.getTenantId());
  } catch (final SQLException e) {
    throw new PaymentPluginApiException("Unable to add payment method for kbPaymentMethodId " + kbPaymentMethodId, e);
  }
}
origin: org.kill-bill.billing/killbill-payment

private Account addTestExternalPaymentMethod(final Account account, final PaymentMethodPlugin paymentMethodInfo)
    throws Exception {
  final UUID paymentMethodId = paymentApi.addPaymentMethod(account, paymentMethodInfo.getExternalPaymentMethodId(),
                               ExternalPaymentProviderPlugin.PLUGIN_NAME, true,
                               paymentMethodInfo, ImmutableList.<PluginProperty>of(), callContext);
  return accountApi.getAccountById(account.getId(), internalCallContext);
}
origin: org.kill-bill.billing.plugin.java/killbill-base-plugin

Assert.assertEquals(plugin.getKbPaymentMethodId(), kbPaymentMethodId, "Wrong kbPaymentMethodId");
Assert.assertEquals(plugin.getExternalPaymentMethodId(), "myToken", "Wrong externalPaymentMethodId");
Assert.assertEquals(plugin.isDefaultPaymentMethod(), true, "Wrong defaultPaymentMethod");
Assert.assertNotNull(plugin.getProperties(), "Wrong properties");
final List<PluginProperty> pluginProperties = plugin.getProperties();
Assert.assertEquals(pluginProperties.size(), 3, "Wrong properties size");
Assert.assertEquals(PluginProperties.getValue("Foo", null, pluginProperties), "myFooXX", "Wrong extra property Foo");
origin: org.kill-bill.billing/killbill-payment

@Test(groups = "slow")
public void testGetPaymentMethodsWithAndWithoutPluginInfo() throws PaymentApiException, PaymentPluginApiException {
  final BigDecimal requestedAmount = BigDecimal.TEN;
  final String paymentExternalKey = "externalKey";
  final String transactionExternalKey = "transactionKey";
  final Payment payment = paymentApi.createPurchase(account, account.getPaymentMethodId(), null, requestedAmount,
                           Currency.AED, null, paymentExternalKey, transactionExternalKey,
                           ImmutableList.<PluginProperty>of(), callContext);
  final Pagination<PaymentMethod> paymentMethods = paymentApi.getPaymentMethods(0L, 10L, false, null, callContext);
  final Pagination<PaymentMethod> paymentMethodsPlugin = paymentApi.getPaymentMethods(0L, 10L, true, null, callContext);
  Assert.assertTrue(paymentMethods.getTotalNbRecords() == 1);
  Assert.assertTrue(paymentMethodsPlugin.getTotalNbRecords() == 1);
  PaymentMethod paymentMethod = paymentMethods.iterator().next();
  PaymentMethod paymentMethodPlugin = paymentMethodsPlugin.iterator().next();
  Assert.assertEquals(paymentMethod.getAccountId(), paymentMethodPlugin.getAccountId());
  Assert.assertEquals(paymentMethod.getId(), paymentMethodPlugin.getId());
  Assert.assertEquals(paymentMethod.getExternalKey(), paymentMethodPlugin.getExternalKey());
  Assert.assertEquals(paymentMethod.getPluginName(), paymentMethodPlugin.getPluginName());
  Assert.assertNull(paymentMethod.getPluginDetail());
  Assert.assertNotNull(paymentMethodPlugin.getPluginDetail());
  Assert.assertTrue(paymentMethodPlugin.getPluginDetail().getProperties().isEmpty());
}
org.killbill.billing.payment.apiPaymentMethodPlugin

Most used methods

  • getProperties
  • getExternalPaymentMethodId
  • isDefaultPaymentMethod
  • getKbPaymentMethodId

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • getSharedPreferences (Context)
  • addToBackStack (FragmentTransaction)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now