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

    
Authorize a specific amount in the Gateway.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id
kbTransactionId killbill transaction id
kbPaymentMethodId killbill payment method id
amount amount to charge
currency currency
properties custom properties for the gateway
context call context
Returns:
information about the authorization in the gateway
Throws:
PaymentPluginApiException
 
     public PaymentTransactionInfoPlugin authorizePayment(UUID kbAccountIdUUID kbPaymentIdUUID kbTransactionIdUUID kbPaymentMethodIdBigDecimal amountCurrency currencyIterable<PluginPropertypropertiesCallContext context)
             throws PaymentPluginApiException;

    
Capture a specific amount in the Gateway.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id
kbTransactionId killbill transaction id
kbPaymentMethodId killbill payment method id
amount amount to charge
currency currency
properties custom properties for the gateway
context call context
Returns:
information about the capture in the gateway
Throws:
PaymentPluginApiException
 
     public PaymentTransactionInfoPlugin capturePayment(UUID kbAccountIdUUID kbPaymentIdUUID kbTransactionIdUUID kbPaymentMethodIdBigDecimal amountCurrency currencyIterable<PluginPropertypropertiesCallContext context)
             throws PaymentPluginApiException;

    
Charge a specific amount in the Gateway.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id
kbTransactionId killbill transaction id
kbPaymentMethodId killbill payment method id
amount amount to charge
currency currency
properties custom properties for the gateway
context call context
Returns:
information about the payment in the gateway
Throws:
PaymentPluginApiException
 
     public PaymentTransactionInfoPlugin purchasePayment(UUID kbAccountIdUUID kbPaymentIdUUID kbTransactionIdUUID kbPaymentMethodIdBigDecimal amountCurrency currencyIterable<PluginPropertypropertiesCallContext context)
             throws PaymentPluginApiException;

    
Void an authorization in the Gateway.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id
kbTransactionId killbill transaction id
kbPaymentMethodId killbill payment method id
properties custom properties for the gateway
context call context
Returns:
information about the capture in the gateway
Throws:
PaymentPluginApiException
 
     public PaymentTransactionInfoPlugin voidPayment(UUID kbAccountIdUUID kbPaymentIdUUID kbTransactionIdUUID kbPaymentMethodIdIterable<PluginPropertypropertiesCallContext context)
             throws PaymentPluginApiException;

    
Credit a specific amount in the Gateway.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id
kbTransactionId killbill transaction id
kbPaymentMethodId killbill payment method id
amount amount to credit
currency currency
properties custom properties for the gateway
context call context
Returns:
information about the credit in the gateway
Throws:
PaymentPluginApiException
    public PaymentTransactionInfoPlugin creditPayment(UUID kbAccountIdUUID kbPaymentIdUUID kbTransactionIdUUID kbPaymentMethodIdBigDecimal amountCurrency currencyIterable<PluginPropertypropertiesCallContext context)
            throws PaymentPluginApiException;

    
Process a refund against a given payment.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id
kbTransactionId killbill transaction id
kbPaymentMethodId killbill payment method id
amount refund amount
currency currency
properties custom properties for the gateway
context call context
Returns:
information about the refund in the gateway
Throws:
PaymentPluginApiException
    public PaymentTransactionInfoPlugin refundPayment(UUID kbAccountIdUUID kbPaymentIdUUID kbTransactionIdUUID kbPaymentMethodIdBigDecimal amountCurrency currencyIterable<PluginPropertypropertiesCallContext context)
            throws PaymentPluginApiException;

    
Retrieve information about a given payment.

Parameters:
kbAccountId killbill accountId
kbPaymentId killbill payment id
properties custom properties for the gateway
context call context
Returns:
information about the payment in the gateway
Throws:
PaymentPluginApiException
    public List<PaymentTransactionInfoPlugingetPaymentInfo(UUID kbAccountIdUUID kbPaymentIdIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentPluginApiException;

    
Search payments.

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

Parameters:
offset the offset of the first result
limit the maximum number of results to retrieve
properties custom properties for the gateway
context call context
Returns:
payments matching the search key
Throws:
PaymentPluginApiException
    public Pagination<PaymentTransactionInfoPluginsearchPayments(String searchKeyLong offsetLong limitIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentPluginApiException;

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

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
properties custom properties for the gateway
context call context
Throws:
PaymentPluginApiException
    public void addPaymentMethod(UUID kbAccountIdUUID kbPaymentMethodIdPaymentMethodPlugin paymentMethodPropsboolean setDefaultIterable<PluginPropertypropertiesCallContext context)
            throws PaymentPluginApiException;

    
Delete a payment method in the gateway.

Parameters:
kbAccountId killbill accountId
kbPaymentMethodId killbill payment method id
properties custom properties for the gateway
context call context
Throws:
PaymentPluginApiException
    public void deletePaymentMethod(UUID kbAccountIdUUID kbPaymentMethodIdIterable<PluginPropertypropertiesCallContext context)
            throws PaymentPluginApiException;

    
Get payment method details for a given payment method.

Parameters:
kbAccountId killbill account id
kbPaymentMethodId killbill payment method id
properties custom properties for the gateway
context call context
Returns:
PaymentMethodPlugin info for the payment method
Throws:
PaymentPluginApiException
    public PaymentMethodPlugin getPaymentMethodDetail(UUID kbAccountIdUUID kbPaymentMethodIdIterable<PluginPropertypropertiesTenantContext context)
            throws PaymentPluginApiException;

    
Set a payment method as default in the gateway.

Parameters:
kbAccountId killbill accountId
kbPaymentMethodId killbill payment method id
properties custom properties for the gateway
context call context
Throws:
PaymentPluginApiException
    public void setDefaultPaymentMethod(UUID kbAccountIdUUID kbPaymentMethodIdIterable<PluginPropertypropertiesCallContext 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 Kill Bill needs to refresh its state.

Parameters:
kbAccountId killbill accountId
refreshFromGateway fetch the list of existing payment methods from gateway -- if supported
properties custom properties for the gateway
context call context
Returns:
all payment methods for that account
Throws:
PaymentPluginApiException
    public List<PaymentMethodInfoPlugingetPaymentMethods(UUID kbAccountIdboolean refreshFromGatewayIterable<PluginPropertypropertiesCallContext context)
            throws PaymentPluginApiException;

    
Search payment methods

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

Parameters:
offset the offset of the first result
limit the maximum number of results to retrieve
properties custom properties for the gateway
context call context
Returns:
payment methods matching the search key
Throws:
PaymentPluginApiException
    public Pagination<PaymentMethodPluginsearchPaymentMethods(String searchKeyLong offsetLong limitIterable<PluginPropertypropertiesTenantContext 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
properties custom properties for the gateway
context call context
Throws:
PaymentPluginApiException
    public void resetPaymentMethods(UUID kbAccountIdList<PaymentMethodInfoPluginpaymentMethodsIterable<PluginPropertypropertiesCallContext context)
            throws PaymentPluginApiException;

    
Build metadata for the client to create a redirect form

Parameters:
kbAccountId killbill accountId
customFields form fields
properties custom properties for the gateway
context call context
Returns:
redirect form metadata
Throws:
PaymentPluginApiException
    public HostedPaymentPageFormDescriptor buildFormDescriptor(UUID kbAccountIdIterable<PluginPropertycustomFieldsIterable<PluginPropertypropertiesCallContext context)
            throws PaymentPluginApiException;

    
Process a notification from the gateway

This potentially does more than just deserialize the payload. The plugin may have to acknowledge it with the gateway.

Parameters:
notification serialized notification object
properties custom properties for the gateway
context call context
Returns:
gateway notification object used to build the response to the gateway
Throws:
PaymentPluginApiException
    public GatewayNotification processNotification(String notificationIterable<PluginPropertypropertiesCallContext context)
            throws PaymentPluginApiException;
New to GrepCode? Check out our FAQ X