List of usage examples for com.google.common.collect Multimap putAll
boolean putAll(@Nullable K key, Iterable<? extends V> values);
From source file:org.killbill.billing.client.KillBillClient.java
public Payment voidPayment(final UUID paymentId, final String paymentExternalKey, final String transactionExternalKey, @Nullable final List<String> controlPluginNames, final Map<String, String> pluginProperties, final RequestOptions inputOptions) throws KillBillClientException { Preconditions.checkState(paymentId != null || paymentExternalKey != null, "PaymentTransaction#paymentId or PaymentTransaction#paymentExternalKey cannot be null"); final String uri = (paymentId != null) ? JaxrsResource.PAYMENTS_PATH + "/" + paymentId : JaxrsResource.PAYMENTS_PATH; final PaymentTransaction paymentTransaction = new PaymentTransaction(); if (paymentExternalKey != null) { paymentTransaction.setPaymentExternalKey(paymentExternalKey); }/* w ww. ja v a2 s. co m*/ paymentTransaction.setTransactionExternalKey(transactionExternalKey); final Multimap<String, String> params = LinkedListMultimap.create(inputOptions.getQueryParams()); storePluginPropertiesAsParams(pluginProperties, params); if (controlPluginNames != null) { params.putAll(KillBillHttpClient.CONTROL_PLUGIN_NAME, controlPluginNames); } final Boolean followLocation = MoreObjects.firstNonNull(inputOptions.getFollowLocation(), Boolean.TRUE); final RequestOptions requestOptions = inputOptions.extend().withQueryParams(params) .withFollowLocation(followLocation).build(); return httpClient.doDelete(uri, paymentTransaction, Payment.class, requestOptions); }
From source file:org.killbill.billing.client.KillBillClient.java
public Payment createPayment(final UUID accountId, @Nullable final UUID paymentMethodId, final PaymentTransaction paymentTransaction, @Nullable final List<String> controlPluginNames, final Map<String, String> pluginProperties, final RequestOptions inputOptions) throws KillBillClientException { Preconditions.checkNotNull(accountId, "accountId cannot be null"); Preconditions.checkNotNull(paymentTransaction.getTransactionType(), "PaymentTransaction#transactionType cannot be null"); Preconditions.checkArgument(//from w w w . ja va2 s . com "AUTHORIZE".equals(paymentTransaction.getTransactionType()) || "CREDIT".equals(paymentTransaction.getTransactionType()) || "PURCHASE".equals(paymentTransaction.getTransactionType()), "Invalid paymentTransaction type " + paymentTransaction.getTransactionType()); Preconditions.checkNotNull(paymentTransaction.getAmount(), "PaymentTransaction#amount cannot be null"); Preconditions.checkNotNull(paymentTransaction.getCurrency(), "PaymentTransaction#currency cannot be null"); final String uri = JaxrsResource.ACCOUNTS_PATH + "/" + accountId + "/" + JaxrsResource.PAYMENTS; final Multimap<String, String> params = LinkedListMultimap.create(inputOptions.getQueryParams()); if (paymentMethodId != null) { params.put("paymentMethodId", paymentMethodId.toString()); } if (controlPluginNames != null) { params.putAll(KillBillHttpClient.CONTROL_PLUGIN_NAME, controlPluginNames); } storePluginPropertiesAsParams(pluginProperties, params); final Boolean followLocation = MoreObjects.firstNonNull(inputOptions.getFollowLocation(), Boolean.TRUE); final RequestOptions requestOptions = inputOptions.extend().withQueryParams(params) .withFollowLocation(followLocation).build(); return httpClient.doPost(uri, paymentTransaction, Payment.class, requestOptions); }