Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2013 Ning, Inc.
   *
   * Ning 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 com.ning.billing.payment.api;
 
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
 
 import static com.ning.billing.security.Permission.INVOICE_CAN_ADJUST;
 import static com.ning.billing.security.Permission.INVOICE_CAN_ITEM_ADJUST;
 import static com.ning.billing.security.Permission.PAYMENT_CAN_CREATE_EXTERNAL_PAYMENT;
 import static com.ning.billing.security.Permission.PAYMENT_CAN_REFUND;
 import static com.ning.billing.security.Permission.PAYMENT_CAN_TRIGGER_PAYMENT;
 
 public interface PaymentApi {

    

Parameters:
account the account
invoiceId the invoice id
amount the amount to pay
context the call context
Returns:
the payment
Throws:
PaymentApiException
 
     public Payment createPayment(Account accountUUID invoiceIdBigDecimal amountCallContext context)
             throws PaymentApiException;

    

Parameters:
account the account
invoiceId the invoice id
amount the amount to pay
context the call context
Returns:
the payment
Throws:
PaymentApiException
 
     public Payment createExternalPayment(Account accountUUID invoiceIdBigDecimal amountCallContext context)
             throws PaymentApiException;


    

Parameters:
account the account
paymentId the payment id
context
Returns:
Throws:
PaymentApiException
 
     public Payment retryPayment(Account accountUUID paymentIdCallContext context)
             throws PaymentApiException;

    
Create a refund for a given payment. The associated invoice is not adjusted.

Parameters:
account account to refund
paymentId payment associated with that refund
refundAmount amount to refund
context the call context
Returns:
the created Refund
Throws:
PaymentApiException
 
     public Refund createRefund(Account accountUUID paymentIdBigDecimal refundAmountCallContext context)
             throws PaymentApiException;

    

Parameters:
refundId the refund id
withPluginInfo whether to fetch plugin info
context the call context @return the refund
Throws:
PaymentApiException
 
     public Refund getRefund(UUID refundIdfinal boolean withPluginInfoTenantContext context)
             throws PaymentApiException;

    
Create a refund for a given payment. The associated invoice is adjusted.

Parameters:
account account to refund
paymentId payment associated with that refund
refundAmount amount to refund
context the call context
Returns:
the created Refund
Throws:
PaymentApiException
    public Refund createRefundWithAdjustment(Account accountUUID paymentIdBigDecimal refundAmountCallContext context)
            throws PaymentApiException;

    
Create a refund for a given payment. The specified invoice items are fully adjusted. The refund amount will be the sum of all invoice items amounts.

Parameters:
account account to refund
paymentId payment associated with that refund
invoiceItemIds invoice item ids to adjust
context the call context
Returns:
the created Refund
Throws:
PaymentApiException
    public Refund createRefundWithItemsAdjustments(Account accountUUID paymentIdSet<UUIDinvoiceItemIdsCallContext context)
            throws PaymentApiException;

    
Create a refund for a given payment. The specified invoice items are partially adjusted. The refund amount will be the sum of all adjustments.

Parameters:
account account to refund
paymentId payment associated with that refund
invoiceItemIdsWithAmounts invoice item ids and associated amounts to adjust
context the call context
Returns:
the created Refund
Throws:
PaymentApiException
    public Refund createRefundWithItemsAdjustments(Account accountUUID paymentIdMap<UUIDBigDecimalinvoiceItemIdsWithAmountsCallContext context)
            throws PaymentApiException;

    

Parameters:
account the account
context the call context
Returns:
the list of refund on this account
Throws:
PaymentApiException
    public List<RefundgetAccountRefunds(Account accountTenantContext context)
            throws PaymentApiException;

    

Parameters:
paymentId the payment id
context the call context
Returns:
the list of refund on this account
Throws:
PaymentApiException
    public List<RefundgetPaymentRefunds(UUID paymentIdTenantContext context)
            throws PaymentApiException;

    

Parameters:
invoiceId the invoice id
context the call context
Returns:
the list of payment on this invoice
Throws:
PaymentApiException
    public List<PaymentgetInvoicePayments(UUID invoiceIdTenantContext context)
            throws PaymentApiException;

    

Parameters:
accountId the account id
context the call context
Returns:
the list of payment on this account
Throws:
PaymentApiException
    public List<PaymentgetAccountPayments(UUID accountIdTenantContext context)
            throws PaymentApiException;

    

Parameters:
paymentId the payment id
withPluginInfo whether to fetch plugin info
context the call context
Returns:
the payment
Throws:
PaymentApiException
    public Payment getPayment(UUID paymentIdfinal boolean withPluginInfoTenantContext context)
            throws PaymentApiException;

    

Returns:
a list of all the payment plugins registered
    public Set<StringgetAvailablePlugins();

    

Parameters:
pluginName the plugin name
account the account
setDefault whether this should be set as a default payment method
paymentMethodInfo the details for the payment method
context the call context
Returns:
the uuid of the payment method
Throws:
PaymentApiException
    public UUID addPaymentMethod(String pluginNameAccount accountboolean setDefaultPaymentMethodPlugin paymentMethodInfoCallContext context)
            throws PaymentApiException;

    

Parameters:
account the account id
withPluginInfo whether we want to retrieve the plugin info for that payment method
context the call context
Returns:
the list of payment methods
Throws:
PaymentApiException
    public List<PaymentMethodgetPaymentMethods(Account accountfinal boolean withPluginInfoTenantContext context)
            throws PaymentApiException;

    

Parameters:
paymentMethodId the payment methid 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
context the call context @return the payment method
Throws:
PaymentApiException
    public PaymentMethod getPaymentMethodById(UUID paymentMethodIdfinal boolean includedInactivefinal boolean withPluginInfoTenantContext 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
context the user context
Returns:
the list of payment methods for that tenant
    public Pagination<PaymentMethodgetPaymentMethods(Long offsetLong limitTenantContext 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
context the user context
Returns:
the list of payment methods for that tenant
Throws:
PaymentApiException
    public Pagination<PaymentMethodgetPaymentMethods(Long offsetLong limitString pluginNameTenantContext 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
context the user context
Returns:
the list of payment methods matching this search key for that tenant
    public Pagination<PaymentMethodsearchPaymentMethods(String searchKeyLong offsetLong limitTenantContext 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
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 pluginNameTenantContext 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
context the call context
Throws:
PaymentApiException
    public void deletedPaymentMethod(Account accountUUID paymentMethodIdboolean deleteDefaultPaymentMethodWithAutoPayOffCallContext context)
            throws PaymentApiException;

    

Parameters:
account the account
paymentMethodId the payment method id
context the call context
Throws:
PaymentApiException
    public void setDefaultPaymentMethod(Account accountUUID paymentMethodIdCallContext context)
            throws PaymentApiException;

    

Parameters:
pluginName the name of the plugin
account the account
context the call context
Returns:
the list of payment methods for that account
Throws:
PaymentApiException
    public List<PaymentMethodrefreshPaymentMethods(String pluginNameAccount accountCallContext context)
            throws PaymentApiException;

    
Refresh all payment methods across all plugins

This call is not atomic.

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