Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2013 Ning, Inc.
   * Copyright 2014 Groupon, Inc
   * Copyright 2014 The Billing Project, LLC
   *
   * The Billing Project licenses this file to you under the Apache License, version 2.0
   * (the "License"); you may not use this file except in compliance with the
   * License.  You may obtain a copy of the License at:
   *
  *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
  * License for the specific language governing permissions and limitations
  * under the License.
  */
 
 package org.killbill.billing.payment.api;
 
 import java.util.List;
 import java.util.UUID;
 
 
 import static org.killbill.billing.security.Permission.PAYMENT_CAN_CHARGEBACK;
 import static org.killbill.billing.security.Permission.PAYMENT_CAN_REFUND;
 import static org.killbill.billing.security.Permission.PAYMENT_CAN_TRIGGER_PAYMENT;
 
 public interface PaymentApi extends KillbillApi {

    
Authorize a payment.

Parameters:
account the account
paymentMethodId the payment method id to use
paymentId the payment id (non-null for multi-steps flows, such as 3D Secure)
amount the amount to pay
currency the amount currency
paymentExternalKey the payment external key
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
context the call context
Returns:
the payment
Throws:
PaymentApiException
 
     public Payment createAuthorization(Account accountUUID paymentMethodIdUUID paymentIdBigDecimal amountCurrency currency,
                                        String paymentExternalKeyString paymentTransactionExternalKey,
                                        Iterable<PluginPropertypropertiesCallContext context)
             throws PaymentApiException;


    
Authorize a payment and allow to go through registered routing plugins

Parameters:
account the account
paymentMethodId the payment method id to use
paymentId the payment id (non-null for multi-steps flows, such as 3D Secure)
amount the amount to pay
currency the amount currency
paymentExternalKey the payment external key
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
paymentOptions options to control payment behavior
context the call context
Returns:
the payment
Throws:
PaymentApiException
 
     public Payment createAuthorizationWithPaymentControl(Account accountUUID paymentMethodIdUUID paymentIdBigDecimal amountCurrency currency,
                                        String paymentExternalKeyString paymentTransactionExternalKey,
                                        Iterable<PluginPropertypropertiesPaymentOptions paymentOptionsCallContext context)
             throws PaymentApiException;

    
Capture a previously authorized payment.

Parameters:
account the account
amount the amount to pay
currency the amount currency
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
context the call context
Returns:
the payment
Throws:
PaymentApiException
 
     public Payment createCapture(Account accountUUID paymentIdBigDecimal amountCurrency currency,
                                  String paymentTransactionExternalKeyIterable<PluginPropertyproperties,
                                  CallContext context)
             throws PaymentApiException;

    
Capture a previously authorized payment and allow to go through registered routing plugins

Parameters:
account the account
amount the amount to pay
currency the amount currency
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
paymentOptions options to control payment behavior
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createCaptureWithPaymentControl(Account accountUUID paymentIdBigDecimal amountCurrency currency,
                                 String paymentTransactionExternalKeyIterable<PluginPropertyproperties,
                                 PaymentOptions paymentOptionsCallContext context)
            throws PaymentApiException;


    
Combine an authorize and capture payment.

Parameters:
account the account
paymentMethodId the payment method id to use
paymentId the payment id (non-null for multi-steps flows, such as 3D Secure)
amount the amount to pay
currency the amount currency
paymentExternalKey the payment external key
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createPurchase(Account accountUUID paymentMethodIdUUID paymentIdBigDecimal amountCurrency currency,
                                        String paymentExternalKeyString paymentTransactionExternalKey,
                                        Iterable<PluginPropertypropertiesCallContext context)
            throws PaymentApiException;

    
Combine an authorize and capture payment and allow to go through registered routing plugins

Parameters:
account the account
paymentMethodId the payment method id to use
paymentId the payment id (non-null for multi-steps flows, such as 3D Secure)
amount the amount to pay
currency the amount currency
paymentExternalKey the payment external key
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
paymentOptions options to control payment behavior
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createPurchaseWithPaymentControl(Account accountUUID paymentMethodIdUUID paymentIdBigDecimal amountCurrency currency,
                                                          String paymentExternalKeyString paymentTransactionExternalKey,
                                                          Iterable<PluginPropertypropertiesPaymentOptions paymentOptionsCallContext context)
            throws PaymentApiException;

    
Void a previously authorized payment.

Parameters:
account the account
paymentId the payment id
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createVoid(Account accountUUID paymentIdString paymentTransactionExternalKeyIterable<PluginPropertyproperties,
                              CallContext context)
            throws PaymentApiException;


    
Void a previously authorized payment and allow to go through registered routing plugins

Parameters:
account the account
paymentId the payment id
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
paymentOptions options to control payment behavior
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createVoidWithPaymentControl(Account accountUUID paymentIdString paymentTransactionExternalKeyIterable<PluginPropertyproperties,
                                                PaymentOptions paymentOptionsCallContext context)
            throws PaymentApiException;



    
Refund a previously captured payment.

Parameters:
account the account
paymentId the payment id
amount the amount to refund
currency the amount currency
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createRefund(Account accountUUID paymentIdBigDecimal amountCurrency currency,
                                      String paymentTransactionExternalKeyIterable<PluginPropertyproperties,
                                      CallContext context)
            throws PaymentApiException;

    
Refund a previously captured payment and allow to go through registered routing plugins

Parameters:
account the account
paymentId the payment id
amount the amount to refund
currency the amount currency
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
paymentOptions options to control payment behavior
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createRefundWithPaymentControl(Account accountUUID paymentIdBigDecimal amountCurrency currency,
                                                        String paymentTransactionExternalKeyIterable<PluginPropertyproperties,
                                                        PaymentOptions paymentOptionsCallContext context)
            throws PaymentApiException;

    
Credit a payment method.

This is also known as payment in reverse.

Parameters:
account the account
paymentMethodId the payment method id to use
paymentId the payment id (non-null for multi-steps flows)
amount the amount to credit
currency the amount currency
paymentExternalKey the payment external key
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createCredit(Account accountUUID paymentMethodIdUUID paymentIdBigDecimal amountCurrency currency,
                                String paymentExternalKeyString paymentTransactionExternalKey,
                                Iterable<PluginPropertypropertiesCallContext context)
            throws PaymentApiException;


    
Credit a payment method and allow to go through registered routing plugins

This is also known as payment in reverse.

Parameters:
account the account
paymentMethodId the payment method id to use
paymentId the payment id (non-null for multi-steps flows)
amount the amount to credit
currency the amount currency
paymentExternalKey the payment external key
paymentTransactionExternalKey the payment transaction external key
properties plugin specific properties
paymentOptions options to control payment behavior
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createCreditWithPaymentControl(Account accountUUID paymentMethodIdUUID paymentIdBigDecimal amountCurrency currency,
                                String paymentExternalKeyString paymentTransactionExternalKey,
                                Iterable<PluginPropertypropertiesPaymentOptions paymentOptionsCallContext context)
            throws PaymentApiException;


    
Record a chargeback

Parameters:
account the account
paymentId the payment id
paymentTransactionExternalKey the chargeback external key
amount the amount to chargeback
currency the amount currency
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createChargeback(Account accountUUID paymentIdBigDecimal amountCurrency currencyString paymentTransactionExternalKeyCallContext contextthrows PaymentApiException;

    
Record a chargeback

Parameters:
account the account
paymentId the payment id
paymentTransactionExternalKey the chargeback external key
amount the amount to chargeback
currency the amount currency
paymentOptions options to control payment behavior
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment createChargebackWithPaymentControl(Account accountUUID paymentIdBigDecimal amountCurrency currencyString paymentTransactionExternalKeyfinal PaymentOptions paymentOptionsCallContext contextthrows PaymentApiException;

    
Transition a currently PENDING transaction into either a SUCCESS or a FAILURE

Parameters:
account the account
paymentTransactionId the transaction id
isSuccess whether the transaction is successful or not
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment notifyPendingTransactionOfStateChanged(Account accountUUID paymentTransactionIdboolean isSuccessCallContext contextthrows PaymentApiException;



    
Transition a currently PENDING transaction into either a SUCCESS or a FAILURE

Parameters:
account the account
paymentTransactionId the transaction id
isSuccess whether the transaction is successful or not
paymentOptions options to control payment behavior
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment notifyPendingTransactionOfStateChangedWithPaymentControl(Account accountUUID paymentTransactionIdboolean isSuccessPaymentOptions paymentOptionsCallContext contextthrows PaymentApiException;

    

Parameters:
accountId the account id
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the call context
Returns:
the list of payments on this account
Throws:
PaymentApiException
    public List<PaymentgetAccountPayments(UUID accountIdboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentApiException;

    

Parameters:
paymentId the payment id
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment getPayment(UUID paymentIdboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentApiException;

    

Parameters:
paymentExternalKey the payment external key
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment getPaymentByExternalKey(String paymentExternalKeyboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentApiException;

    
Find all payments across all plugins

Parameters:
offset the offset of the first result
limit the maximum number of results to retrieve
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the user context
Returns:
the list of payments for that tenant
    public Pagination<PaymentgetPayments(Long offsetLong limitboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context);

    
Find all payments in a given plugin

Parameters:
offset the offset of the first result
limit the maximum number of results to retrieve
pluginName the payment plugin name
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the user context
Returns:
the list of payments for that tenant
Throws:
PaymentApiException
    public Pagination<PaymentgetPayments(Long offsetLong limitString pluginNameboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext contextthrows PaymentApiException;

    
Find all payments matching the search key across all plugins

The match will be plugin specific: for instance some plugins will try to match the key against the transaction ids, etc.

Parameters:
searchKey the search key
offset the offset of the first result
limit the maximum number of results to retrieve
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the user context
Returns:
the list of payments matching this search key for that tenant
    public Pagination<PaymentsearchPayments(String searchKeyLong offsetLong limitboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context);

    
Find all payments matching the search key in a given plugin

The match will be plugin specific: for instance some plugins will try to match the key against the transaction ids, etc.

Parameters:
searchKey the search key
offset the offset of the first result
limit the maximum number of results to retrieve
pluginName the payment plugin name
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the user context
Returns:
the list of payments matching this search key for that tenant
Throws:
PaymentApiException
    public Pagination<PaymentsearchPayments(String searchKeyLong offsetLong limitString pluginNameboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext contextthrows PaymentApiException;

    

Parameters:
account the account
paymentMethodExternalKey the external key
pluginName the plugin name
setDefault whether this should be set as a default payment method
paymentMethodInfo the details for the payment method
properties plugin specific properties
context the call context
Returns:
the uuid of the payment method
Throws:
PaymentApiException
    public UUID addPaymentMethod(Account accountString paymentMethodExternalKeyString pluginNameboolean setDefaultPaymentMethodPlugin paymentMethodInfoIterable<PluginPropertypropertiesCallContext context)
            throws PaymentApiException;

    

Parameters:
accountId the account id
withPluginInfo whether we want to retrieve the plugin info for that payment method
properties plugin specific properties
context the call context
Returns:
the list of payment methods
Throws:
PaymentApiException
    public List<PaymentMethodgetAccountPaymentMethods(UUID accountIdboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentApiException;

    

Parameters:
paymentMethodId the payment method id
includedInactive returns the payment method even if this is not active
withPluginInfo whether we want to retrieve the plugin info for that payment method
properties plugin specific properties
context the call context @return the payment method
Throws:
PaymentApiException
    public PaymentMethod getPaymentMethodById(UUID paymentMethodIdboolean includedInactiveboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentApiException;

    

Parameters:
paymentMethodExternalKey the payment method external key
includedInactive returns the payment method even if this is not active
withPluginInfo whether we want to retrieve the plugin info for that payment method
properties plugin specific properties
context the call context @return the payment method
Throws:
PaymentApiException
    public PaymentMethod getPaymentMethodByExternalKey(String paymentMethodExternalKeyboolean includedInactiveboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentApiException;

    
Find all payment methods across all plugins

Parameters:
offset the offset of the first result
limit the maximum number of results to retrieve
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the user context
Returns:
the list of payment methods for that tenant
    public Pagination<PaymentMethodgetPaymentMethods(Long offsetLong limitboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context);

    
Find all payment methods in a given plugin

Parameters:
offset the offset of the first result
limit the maximum number of results to retrieve
pluginName the payment plugin name
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the user context
Returns:
the list of payment methods for that tenant
Throws:
PaymentApiException
    public Pagination<PaymentMethodgetPaymentMethods(Long offsetLong limitString pluginNameboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext contextthrows PaymentApiException;

    
Find all payment methods matching the search key across all plugins

The match will be plugin specific: for instance some plugins will try to match the key against the last 4 credit cards digits, agreement ids, etc.

Parameters:
searchKey the search key
offset the offset of the first result
limit the maximum number of results to retrieve
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the user context
Returns:
the list of payment methods matching this search key for that tenant
    public Pagination<PaymentMethodsearchPaymentMethods(String searchKeyLong offsetLong limitboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext context);

    
Find all payment methods matching the search key in a given plugin

The match will be plugin specific: for instance some plugins will try to match the key against the last 4 credit cards digits, agreement ids, etc.

Parameters:
searchKey the search key
offset the offset of the first result
limit the maximum number of results to retrieve
pluginName the payment plugin name
withPluginInfo whether to fetch plugin info
properties plugin specific properties
context the user context
Returns:
the list of payment methods matching this search key for that tenant
Throws:
PaymentApiException
    public Pagination<PaymentMethodsearchPaymentMethods(String searchKeyLong offsetLong limitString pluginNameboolean withPluginInfoIterable<PluginPropertypropertiesTenantContext contextthrows PaymentApiException;

    

Parameters:
account the account
paymentMethodId the id of the payment method
deleteDefaultPaymentMethodWithAutoPayOff whether to allow deletion of default payment method and set account into AUTO_PAY_OFF
properties plugin specific properties
context the call context
Throws:
PaymentApiException
    public void deletePaymentMethod(Account accountUUID paymentMethodIdboolean deleteDefaultPaymentMethodWithAutoPayOffIterable<PluginPropertypropertiesCallContext context)
            throws PaymentApiException;

    

Parameters:
account the account
paymentMethodId the payment method id
properties plugin specific properties
context the call context
Throws:
PaymentApiException
    public void setDefaultPaymentMethod(Account accountUUID paymentMethodIdIterable<PluginPropertypropertiesCallContext context)
            throws PaymentApiException;

    

Parameters:
account the account
pluginName the name of the plugin
properties plugin specific properties
context the call context
Returns:
the list of payment methods for that account
Throws:
PaymentApiException
    public List<PaymentMethodrefreshPaymentMethods(Account accountString pluginNameIterable<PluginPropertypropertiesCallContext context)
            throws PaymentApiException;

    
Refresh all payment methods across all plugins

This call is not atomic.

Parameters:
account the account
properties plugin specific properties
context the call context
Returns:
the list of payment methods for that account
Throws:
PaymentApiException
    public List<PaymentMethodrefreshPaymentMethods(Account accountIterable<PluginPropertypropertiesCallContext context)
            throws PaymentApiException;
New to GrepCode? Check out our FAQ X