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.plugin.api;
 
 import java.util.List;
 import java.util.UUID;
 
 
 public interface PaymentPluginApi {

    
Charge a specific amount in the Gateway. Required.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id (for reference)
kbPaymentMethodId killbill payment method id
amount amount to charge
currency currency
context call context
Returns:
information about the payment in the gateway
Throws:
PaymentPluginApiException
 
     public PaymentInfoPlugin processPayment(UUID kbAccountIdUUID kbPaymentIdUUID kbPaymentMethodIdBigDecimal amountCurrency currencyCallContext context)
             throws PaymentPluginApiException;


    
Retrieve information about a given payment. Optional (not all gateways will support it).

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id (for reference)
context call context
Returns:
information about the payment in the gateway
Throws:
PaymentPluginApiException
 
     public PaymentInfoPlugin getPaymentInfo(UUID kbAccountIdUUID kbPaymentIdTenantContext context)
             throws PaymentPluginApiException;

    
Search payments

The search is plugin specific, there is no constraint on how the searchKey should be interpreted.

Parameters:
context call context
offset the offset of the first result
limit the maximum number of results to retrieve
Returns:
payments matching the search key
 
     public Pagination<PaymentInfoPluginsearchPayments(String searchKeyLong offsetLong limitTenantContext contextthrows PaymentPluginApiException;

    
Process a refund against a given payment. Required.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id (for reference)
refundAmount refund amount
currency currency
context call context
Returns:
information about the refund in the gateway
Throws:
PaymentPluginApiException
 
     public RefundInfoPlugin processRefund(UUID kbAccountIdUUID kbPaymentIdBigDecimal refundAmountCurrency currencyCallContext context)
             throws PaymentPluginApiException;


    

Parameters:
kbAccountId killbill account id
kbPaymentId killbill payment id
context call context
Returns:
information about the refunds in the gateway
Throws:
PaymentPluginApiException
 
     public List<RefundInfoPlugingetRefundInfo(UUID kbAccountIdUUID kbPaymentIdTenantContext context)
             throws PaymentPluginApiException;

    
Search refunds

The search is plugin specific, there is no constraint on how the searchKey should be interpreted.

Parameters:
context call context
offset the offset of the first result
limit the maximum number of results to retrieve
Returns:
refunds matching the search key
    public Pagination<RefundInfoPluginsearchRefunds(String searchKeyLong offsetLong limitTenantContext contextthrows PaymentPluginApiException;

    
Add a payment method for a Killbill account in the gateway. Optional.

Note: the payment method doesn't exist yet in Killbill when receiving the call in the plugin (kbPaymentMethodId is a placeholder).

Parameters:
kbAccountId killbill accountId
paymentMethodProps payment method details
setDefault set it as the default payment method in the gateway
context call context
Throws:
PaymentPluginApiException
    public void addPaymentMethod(UUID kbAccountIdUUID kbPaymentMethodIdPaymentMethodPlugin paymentMethodPropsboolean setDefaultCallContext context)
            throws PaymentPluginApiException;

    
Delete a payment method in the gateway. Optional.

Parameters:
kbAccountId killbill accountId
kbPaymentMethodId killbill payment method id
context call context
Throws:
PaymentPluginApiException
    public void deletePaymentMethod(UUID kbAccountIdUUID kbPaymentMethodIdCallContext context)
            throws PaymentPluginApiException;

    
Get payment method details for a given payment method. Optional.

Parameters:
kbAccountId killbill account id
kbPaymentMethodId killbill payment method id.
context call context
Returns:
PaymentMethodPlugin info for the payment method
Throws:
PaymentPluginApiException
    public PaymentMethodPlugin getPaymentMethodDetail(UUID kbAccountIdUUID kbPaymentMethodIdTenantContext context)
            throws PaymentPluginApiException;

    
Set a payment method as default in the gateway. Optional.

Parameters:
kbAccountId killbill accountId
kbPaymentMethodId killbill payment method id
context call context
Throws:
PaymentPluginApiException
    public void setDefaultPaymentMethod(UUID kbAccountIdUUID kbPaymentMethodIdCallContext context)
            throws PaymentPluginApiException;

    
This is used to see the view of paymentMethods kept by the plugin or the view of existing payment method on the gateway.

Sometimes payment methods have to be added directly to the gateway for PCI compliance issues and so Killbill needs to refresh its state.

Parameters:
kbAccountId killbill accountId
refreshFromGateway fetch the list of existing payment methods from gateway-- if supported
context call context
Returns:
    public List<PaymentMethodInfoPlugingetPaymentMethods(UUID kbAccountIdboolean refreshFromGatewayCallContext context)
            throws PaymentPluginApiException;

    
Search payment methods

The search is plugin specific, there is no constraint on how the searchKey should be interpreted.

Parameters:
context call context
offset the offset of the first result
limit the maximum number of results to retrieve
Returns:
payment methods matching the search key
    public Pagination<PaymentMethodPluginsearchPaymentMethods(String searchKeyLong offsetLong limitTenantContext context)
            throws PaymentPluginApiException;

    
This is used after Killbill decided to refresh its state from the gateway

Parameters:
kbAccountId killbill accountId
paymentMethods the list of payment methods
    public void resetPaymentMethods(UUID kbAccountIdList<PaymentMethodInfoPluginpaymentMethods)
            throws PaymentPluginApiException;
New to GrepCode? Check out our FAQ X