BEA Logo BEA WebLogic Portal Release 4.0

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   WebLogic Portal Documentation   |   Order Guide   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Payment Services

 

WebLogic Portal includes a flexible payment service that lets you connect to a third-party payment product for authorizing and settling orders. The payment service itself currently allows credit card payments to be made. This topic describes the Payment Services in detail.

This topic includes the following sections:

 


How the Payment Service Works

For an introduction to Web services, see Introduction to Web Services in Taxation Services.

Figure 6-1 shows the basic architecture of WebLogic Portal's payment service. The key component of this architecture is the Credit Card Web Service, which is the connection point between WebLogic Portal and any third-party payment product.

Figure 6-1 Payment Service Architecture


 

Following is a description of each piece of the architecture.

1

The PaymentPC Pipeline component instantiates and makes calls to the CreditCardService EJB.

For information on Pipeline components, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

2

The payment JSPs provide various functions, including form fields and information that the customer uses to make payment. The payment_admin.jsp, which calls the CreditCardService EJB, also lets you search transactions and resubmit them if necessary. On submit, the JSP passes the customer payment data to the CreditCardService EJB.

3

The CreditCardService EJB handles the business logic for the payment. The EJB converts payment service calls to XML for transporting SOAP messages to the Credit Card Web Service.

4

The CreditCardService EJB persists the payment transactions.

5

The CreditCardService EJB in WebLogic Portal sends SOAP messages to the Credit Card Web Service (a stateless session EJB), where those SOAP messages are converted to the language of the third-party product's API.

The third-party payment service processes payments and sends confirmation or exceptions back to the application.

Caution: The default Payment Web service that ships with WebLogic Portal always sends payment information through without any errors, as if it were connected to and approved by a third-party payment service. This default processing of payment is not designed for production use. You must integrate with your third-party vendor's payment service to process payment correctly.


 

Because no industry standards exist yet for handling payment tasks (such as authorization, retry, and settle), third-party payment products have their own APIs handling these tasks. There are two keys to connecting an enterprise application with a third-party payment Web service:

For information on connecting an enterprise application to a Web service, see Integrating with a Payment Service.

 


JavaServer Pages (JSPs)

A primary goal of Order services is to allow you to quickly establish a fully-functioning e-commerce site. To this end, the Payment Service provides you with a Java Server Page (JSP) template that you can use as is, or customize to better meet your needs. This section describes this page in detail.

Note: For a description of the complete set of JSPs used in the WebLogic Portal Web application and a listing of their locations in the directory structure, see the E-Commerce Summary of JSP Templates documentation.

payment.jsp Template

If a customer has already specified payment information in their user profile, the payment.jsp template (shown in Figure 6-2) provides the customer with a list of credit cards (by type and last 4 digits) for selection. Customers wanting to use an existing credit card can simply click its associated Use button to proceed to the next part of the checkout process.

Note: For more information about user profiles, see "Customer Profile Services" in the Guide to Registering Customers and Managing Customer Services.

Customers can also choose to update the information associated with this credit card by clicking the Update This Card button. If your customer wants to use a credit card they have never used on your e-commerce site before, the customer can click the Add Card button to add it to the list (using the paymentnewcc.jsp template). If a customer wants to go back to the previous page, the customer can click the Back button.

Sample Browser View

Figure 6-2 shows an annotated version of the payment.jsp template. The Payment region uses a combination of the WebLogic Server and WebLogic Portal JSP tags to obtain and display the customer's saved credit card(s).

Note: For information on other elements in the payment.jsp template, see Common JSP Template Elements.

Figure 6-2 Annotated payment.jsp Template


 

Location in the WebLogic Portal Directory Structure

You can find the payment.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed WebLogic Portal:

%PORTAL_HOME%\applications\wlcsApp\wlcs\commerce\order\
payment.jsp
(Windows)
$PORTAL_HOME/applications/wlcsApp/wlcs/commerce/order/
payment.jsp
(UNIX)

Tag Library Imports

The payment.jsp template uses existing WebLogic Server and WebLogic Portal's User Management JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="webflow.tld" prefix="webflow" %>
<%@ taglib uri="um.tld" prefix="um" %>
<%@ taglib uri="weblogic.tld" prefix="wl" %>

Note: For more information on the WebLogic Server JSP tags or the WebLogic Portal JSP tags, see "JSP Tag Reference" in the Guide to Building Personalized Applications.

These files reside in the lib directory within PORTAL_HOME.

Java Package Imports

The payment.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="com.beasys.commerce.webflow.tags.*" %>
<%@ page import="com.beasys.commerce.axiom.contact.*" %>
<%@ page import="com.beasys.commerce.ebusiness.customer.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>

Location in Default Webflow

Customers arrive at payment.jsp from the page where they select their shipping address (selectaddress.jsp). If they choose to add a new credit card, they will be directed to the paymentnewcc.jsp template. If the customer chooses to edit one of the cards that appears in the list, the customer will be directed to the paymenteditcc.jsp template. After selecting a credit card for payment, customers move on to the final page in the checkout process, where they can review their order prior to committing it (checkout.jsp).

Note: For more information about the default Webflow, see Overview of Managing Purchases and Processing Orders.

Included JSP Templates

The following JSP templates are included in the payment.jsp template:

Events

The payment.jsp template presents a customer with several buttons, each of which is considered an event. These events trigger a particular response in the default Webflow that allows customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 6-1 provides information about these events and the business logic they invoke.

Table 6-1 payment.jsp Events

Event

Webflow Response(s)

button.addNewCreditCard

No business logic required. Loads paymentnewcc.jsp.

button.continue

AuthorizePaymentIP

button.updatePaymentInfo

No business logic required. Loads paymenteditcc.jsp.


 

Dynamic Data Display

The purpose of the payment.jsp template is to display a list of the customer's previously saved credit cards. This is accomplished on the payment.jsp template using a combination of WebLogic Server and WebLogic Portal JSP tags and accessor methods/attributes.

First, the getProfile JSP tag is used to set the customer profile (context) for which the credit cards should be retrieved, as shown in Listing 6-1.

Listing 6-1 Setting the Customer Context

<um:getProfile
	profileKey="<%=request.getRemoteUser()%>"
	profileType="WLCS_Customer" />

Next, the getProperty JSP tag is used to retrieve a cached copy of the possible credit cards for the customer from the database, as shown in Listing 6-2.

Listing 6-2 Retrieving the CreditCardsMap for the Customer

<um:getProperty propertySet="CustomerProperties" propertyName="creditCardsMap" id="creditCardsMapObject" />

You can now iterate through the credit cards contained within the creditCardsMap (using the WebLogic Server JSP tag) and display each credit card in the collection (using a Java scriptlet) as shown in Listing 6-3.

Listing 6-3 Iterating Through and Displaying the Credit Cards

<table>
<wl:repeat
   set="<%=((Map)creditCardsMapObject).keySet().iterator()%>"
   id="creditCard" type="String" count="100000">
    <tr>
    <!-- Output the credit card name -->
      <td width="50%"><div class="tabletext"><%=creditCard%></div></td>
    <!-- The update button -->
      <td width="30%" align="right">
      <%
      String extraParams = HttpRequestConstants.CREDITCARD_KEY + "=" + creditCard;
      %>
 
      <a
      href="<webflow:createWebflowURL event="button.updatePaymentInfo"  httpsInd="calculate" namespace="sampleapp_order" extraParams="<%= extraParams   %>" />"><img src="<webflow:createResourceURL resource="/commerce/images/btn_updatecard.gif" />" border="0">
      </a>
      </td>
      <!-- The use button -->
      <td width="20%" align="right">
      <a
      href="<webflow:createWebflowURL event="button.continue" httpsInd="calculate" namespace="sampleapp_order" extraParams="<%= extraParams %>" />"><img src="<webflow:createResourceURL resource="/commerce/images/btn_use.gif" />" border="0">
      </a>
      </td>
    </tr>
    <tr>
      <td colspan="3"><hr size="1"></td>
    </tr>
  </wl:repeat>
</table>

Note: For more information on the WebLogic Server JSP tags or the WebLogic Portal JSP tags, see "JSP Tag Reference" in the Guide to Building Personalized Applications.

Form Field Specification

The payment.jsp template does not make use of any form fields.

paymentnewcc.jsp Template

The paymentnewcc.jsp template (shown in Figure 6-3) allows customers to enter information about a new credit card, which will be added to their profile. This information includes the credit card type (VISA, MasterCard, and so on), the name on the card, the card number, the card expiration date (month and 4-digit year), and the billing address (including a street address, city, state, zip/postal code, and country). The customer must click the Save button for the new credit card to be added to the customer's list of credit cards.

Sample Browser View

Figure 6-3 shows an annotated version of the paymentnewcc.jsp template. The New Credit Card region provides customers with a series of form fields that allow customers to add a credit card. This region utilizes the form fields defined in the included newcctemplate.jsp template file, which itself includes the states.jsp and countries.jsp template files. The import call in paymentnewcc.jsp is:

<%@ include file="/commerce/includes/newcctemplate.jsp" %>

Figure 6-3 Annotated paymentnewcc.jsp Template


 

Location in the WebLogic Portal Directory Structure

You can find the paymentnewcc.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed Commerce services:

%PORTAL_HOME%\applications\wlcsApp\wlcs\commerce\order\
paymentnewcc.jsp
(Windows)
$PORTAL_HOME/applications/wlcsApp/wlcs/commerce/order/
paymentnewcc.jsp
(UNIX)

Tag Library Imports

The paymentnewcc.jsp template uses Pipeline and Webflow JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="webflow.tld" prefix="webflow" %>

Note: For more information on the Webflow and Pipeline JSP tags, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline.

These files reside in the lib directory within PORTAL_HOME.

Java Package Imports

The paymentnewcc.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="com.beasys.commerce.webflow.tags.*" %>
<%@ page import="com.beasys.commerce.axiom.contact.*" %>
<%@ page import="com.beasys.commerce.ebusiness.customer.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>

Location in Default Webflow

Customers arrive at the paymentnewcc.jsp template from the page where they are given the option of selecting a credit card from their profile (payment.jsp). When customers are finished with this page, customers are returned to the payment.jsp template so customers can make their selection.

This template is in the sampleapp_order namespace.

Note: For more information about the default Webflow, see Overview of Managing Purchases and Processing Orders.

Included JSP Templates

The following JSP templates are included in the paymentnewcc.jsp template:

Events

The paymentnewcc.jsp template presents a customer with a single button, which is considered an event. This event triggers a particular response in the default Webflow that allows customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 6-2 provides information about these events and the business logic they invoke.

Table 6-2 paymentnewcc.jsp Events

Event

Webflow Response(s)

button.save

UpdatePaymentInfoIP


 

Dynamic Data Display

No dynamic data is displayed on the paymentnewcc.jsp template.

Form Field Specification

The purpose of the paymentnewcc.jsp template is to provide form fields that allow the customer to enter new credit card information. It also passes hidden information to the Webflow. The form fields used in the paymentnewcc.jsp template, and a description for each of these form fields, are listed in Table 6-3.

You could add additional fields if your payment service required them.

Table 6-3 paymentnewcc.jsp Form Fields

Parameter Name

Type

Description

"event"

Hidden

Indicates which event has been triggered. It is used by the Webflow to determine what happens next.

"origin"

Hidden

The name of the current page (paymentnewcc.jsp), used by the Webflow.

HttpRequestConstants.
CUSTOMER_CREDITCARD_TYPE

Listbox

The type of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_HOLDER

Textbox

The name on the credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_NUMBER

Textbox

The number of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_MONTH

Listbox

The month of the customer's credit card expiration date.

HttpRequestConstants.
CUSTOMER_CREDITCARD_YEAR

Listbox

The year of the customer's credit card expiration date.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ADDRESS1

Textbox

The first line in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ADDRESS2

Textbox

The second line in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_CITY

Textbox

The city in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_STATE

Listbox

The state in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ZIPCODE

Textbox

The zip/postal code in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_COUNTRY

Listbox

The country in the customer's billing address.


 

Note: Parameters that are literals in the JSP code are shown in quotes, while non-literals will require scriptlet syntax (such as
<%= HttpRequestConstants.CUSTOMER_CREDIT_CARD_COUNTRY %>) for use in the JSP.

paymenteditcc.jsp Template

The paymenteditcc.jsp template (shown in Figure 6-4) allows your customers to modify information about one of the credit cards shown in the credit card list. Editable information includes the name on the credit card, the expiration date (month and 4-digit year), and the billing address (including street address, city, state, zip/postal code, and country). The customer must click the Save button to save the modifications to their credit card.

Sample Browser View

Figure 6-4 shows an annotated version of the paymenteditcc.jsp template. The Edit Credit Card region provides customers with a series of form fields that allow customers to edit a credit card. This region utilizes the form fields defined in the included editcctemplate.jsp template file, which itself includes the states.jsp and countries.jsp template files. The import call in paymenteditcc.jsp is:

   <%@ include file="/commerce/includes/editcctemplate.inc" %>

Note: For information on other elements in the paymenteditcc.jsp template, see Common JSP Template Elements.

Figure 6-4 Annotated paymenteditcc.jsp Template


 

Location in the WebLogic Portal Directory Structure

You can find the paymenteditcc.jsp template file at the following location, where PORTAL_HOME is the directory in which you installed WebLogic Portal:

%PORTAL_HOME%\applications/wlcsApp\wlcs\commerce\order\
paymenteditcc.jsp
(Windows)
$PORTAL_HOME/applications/wlcsApp/wlcs/commerce/order/
paymenteditcc.jsp
(UNIX)

Tag Library Imports

The paymenteditcc.jsp template uses the existing WebLogic Portal's User Management JSP tags, and the Pipeline and Webflow JSP tags. Therefore, the template includes the following JSP tag libraries:

<%@ taglib uri="webflow.tld" prefix="webflow" %>
<%@ taglib uri="um.tld" prefix="um" %>

Note: For more information on the Webflow and Pipeline JSP tags, see the Guide to Managing Presentation and Business Logic: Using Webflow and Pipeline. For more information on the WebLogic Portal JSP tags, see "JSP Tag Reference" in the Guide to Building Personalized Applications.

These files reside in the lib directory within PORTAL_HOME.

Java Package Imports

The paymenteditcc.jsp template uses Java classes in the following packages and therefore includes these import statements:

<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="com.beasys.commerce.webflow.tags.*" %>
<%@ page import="com.beasys.commerce.axiom.contact.*" %>
<%@ page import="com.beasys.commerce.ebusiness.customer.*" %>
<%@ page import="com.beasys.commerce.webflow.HttpRequestConstants" %>

Location in Default Webflow

Customers arrive at paymenteditcc.jsp template from the page where they are given the option of selecting a credit card from their profile (payment.jsp). When customers are finished with this page, they are returned to the payment.jsp template so they can make their selection.

This template is in the sampleapp_order namespace.

Note: For more information about the default Webflow, see Overview of Managing Purchases and Processing Orders.

Included JSP Templates

The following JSP templates are included in the paymenteditcc.jsp template:

Events

The paymenteditcc.jsp template presents a customer with a single button, which is considered an event. This event triggers a particular response in the default Webflow that allows customers to continue. While this response can be to load another JSP, it is usually the case that an input processor or Pipeline is invoked first. Table 6-4 provides information about these events and the business logic they invoke.

Table 6-4 paymenteditcc.jsp Events

Event

Webflow Response(s)

button.save

UpdatePaymentInfoIP


 

Dynamic Data Display

One purpose of the paymenteditcc.jsp template is to prepare the credit card information a customer had previously entered, so the editcctemplate.jsp template can display this information in the payment information form fields. This is accomplished on the paymenteditcc.jsp template using a combination WebLogic Portal's User Management JSP tags and accessor methods/attributes.

First, the getProfile JSP tag is used to set the customer profile (context) for which the customer information should be retrieved, as shown in Listing 6-4.

Listing 6-4 Setting the Customer Context

<um:getProfile
profileKey="<%=request.getRemoteUser()%>"
profileType="WLCS_Customer" />

Note: For more information on the WebLogic Portal User Management JSP tags, see "JSP Tag Reference" in the Guide to Building Personalized Applications.

Next, the getProperty JSP tag is used to obtain the customer's list of credit cards (and related billing information), which is then initialized with data from the customer object, as shown in Listing 6-5.

Listing 6-5 Obtaining the Customer's Credit Cards and Billing Information

<um:getProperty propertySet="CustomerProperties" propertyName="creditCardsMap" id="creditCards" />
<%
    String creditCardKey = request.getParameter(HttpRequestConstants.CREDITCARD_KEY);
    CreditCard defaultCreditCard = null;
    if(creditCardKey != null)
    {
        defaultCreditCard = (CreditCard)((Map)creditCards).get(creditCardKey);
    }
    else
    {
        defaultCreditCard = CreditCardHome.create();
    }
    Address billingAddress = (Address) defaultCreditCard.getBillingAddress();
%>

The data stored within the defaultCreditCard and billingAddress objects can now be accessed by calling accessor methods/attributes within Java scriptlets. Table 6-5 provides more detailed information about the methods/attributes for the default credit card, while Table 6-6 provides more information about the accessor methods/attributes on billingAddress.

Table 6-5 defaultCreditCard Accessor Methods/Attributes

Method/Attribute

Description

getType()

The credit card type (VISA, MasterCard, AMEX, and so on).

getName()

The credit card holder's name.

getDisplayNumber()

The credit card number for display (12 Xs and last 4 digits).

getNumber()

The credit card number.

getExpirationDate()

The credit card's expiration date.


 

Table 6-6 billingAddress Accessor Methods/Attributes

Method/Attribute

Description

getStreet1()

The first line in the customer's billing street address.

getStreet2()

The second line in the customer's billing street address.

getCity()

The city in the customer's billing address.

getCounty()

The county in the customer's billing address.

getState()

The state in the customer's billing address.

getPostalCode()

The zip/postal code in the customer's billing address.

getCountry()

The country in the customer's billing address.


 

Form Field Specification

Another purpose of the paymenteditcc.jsp template is to provide the form fields for the customer's modifications and to pass hidden information to the Webflow. The form fields used in the paymenteditcc.jsp, and a description for each of these form fields, are listed in Table 6-7.

You could add additional fields if your payment service required them.

Table 6-7 paymenteditcc.jsp Form Fields

Parameter Name

Type

Description

"event"

Hidden

Indicates which event has been triggered. It is used by the Webflow to determine what happens next.

"origin"

Hidden

The name of the current page (paymenteditcc.jsp), used by the Webflow.

HttpRequestConstants.
CUSTOMER_CREDITCARD_TYPE

Listbox

The type of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_HOLDER

Textbox

The name on the credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_NUMBER

Textbox

The number of the customer's credit card.

HttpRequestConstants.
CUSTOMER_CREDITCARD_MONTH

Listbox

The month of the customer's credit card expiration date.

HttpRequestConstants.
CUSTOMER_CREDITCARD_YEAR

Listbox

The year of the customer's credit card expiration date.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ADDRESS1

Textbox

The first line in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ADDRESS2

Textbox

The second line in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_CITY

Textbox

The city in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_STATE

Listbox

The state in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_ZIPCODE

Textbox

The zip/postal code in the customer's billing address.

HttpRequestConstants.
CUSTOMER_CREDITCARD_COUNTRY

Listbox

The country in the customer's billing address.


 

Note: Parameters that are literals in the JSP code are shown in quotes, while non-literals will require scriptlet syntax (such as
<%= HttpRequestConstants.CUSTOMER_CREDIT_CARD_COUNTRY %>) for use in the JSP.

payment_admin.jsp, paymenthistory.jsp, and payment_info.jsp Templates

Following are descriptions of the payment_admin.jsp, the payment_info.jsp, and the paymenthistory.jsp.

payment_admin.jsp

The payment_admin.jsp is the main page used for payment administration. All payment administration functions go through this page. It interfaces with the CreditCardService EJB for many operations.

payment_info.jsp

The payment_info.jsp provides developer-level information about the Payment JSP files. This file is, out of the box, only available as a popup from the main admin page when you click the More Explanation link under the Payment Administration section.

paymenthistory.jsp

The paymenthistory.jsp lets customers view their payment history by clicking the Payments link under View History in the left side of the window.

 


Input Processors

This section provides a brief description of each input processor associated with the Payment Services JSP template(s).

PaymentAuthorizationIP

Class Name

examples.wlcs.sampleapp.payment.webflow.
PaymentAuthorizationIP

Description

Retrieves the shopping cart from the Pipeline session, the CreditCardMapKey from the request, and determines the total price of the order associated with the shopping cart. Adds the amount and credit card associated with the key to the Pipeline session.

Required
HTTPServletRequest
Parameters

HttpRequestConstants.CREDITCARD_KEY

Required Pipeline
Session Attributes

PipelineSessionConstants.SHOPPING_CART

Updated Pipeline
Session Attributes

PipelineSessionConstants.PAYMENT_CREDIT_CARD

PipelineSessionConstants.PAYMENT_AUTHORIZATION_AMOUNT

Removed Pipeline
Session Attributes

None

Validation

Verifies that the credit card key is valid and that it references an existing credit card.

Exceptions

ProcessingException, thrown for invalid types of CREDITCARD_KEY, PAYMENT_CREDIT_CARD, or SHOPPING_CART. Also thrown if these attributes are not available.


 

UpdatePaymentInfoIP

Class Name

examples.wlcs.sampleapp.customer.webflow.

UpdatePaymentInfoIP

Description

Processes the customer's input from paymentnewcc.jsp and paymenteditcc.jsp. Retrieves the customer name from the Pipeline session, creates a new CustomerValue object, and sets it in the Pipeline session.

Required
HTTPServletRequest
Parameters

HttpRequestConstants.CUSTOMER_CREDITCARD_TYPE

HttpRequestConstants.CUSTOMER_CREDITCARD_HOLDER

HttpRequestConstants.CUSTOMER_CREDITCARD_NUMBER

HttpRequestConstants.CUSTOMER_CREDITCARD_MONTH

HttpRequestConstants.CUSTOMER_CREDITCARD_YEAR

HttpRequestConstants.CUSTOMER_CREDITCARD_ADDRESS1

HttpRequestConstants.CUSTOMER_CREDITCARD_ADDRESS2

HttpRequestConstants.CUSTOMER_CREDITCARD_CITY

HttpRequestConstants.CUSTOMER_CREDITCARD_STATE

HttpRequestConstants.CUSTOMER_CREDITCARD_ZIPCODE

HttpRequestConstants.CUSTOMER_CREDITCARD_COUNTRY

Required Pipeline
Session Attributes

PipelineSessionConstants.USER_NAME

Updated Pipeline
Session Attributes

PipelineSessionConstants.CUSTOMER

Removed Pipeline
Session Attributes

None

Validation

Verifies that the required fields contain values.

Exceptions

InvalidInputException, thrown if invalid credit card information is obtained from the HttpServletRequest.


 

 


Pipeline Components

This section provides a brief description of each Pipeline component associated with the Payment Services JSP templates.

Note: Some Pipeline components extend other, base Pipeline components. For more information on the base classes, see the Javadoc.

PaymentAuthorizationHostPC

Class Name

examples.wlcs.sampleapp.payment.pipeline.
PaymentAuthorizationHostPC

Description

Authorizes a given credit card for a specified amount. Used for host-based payment models, shown in the weblogiccommerce.properties file as:

HOST_AUTH_CAPTURE

HOST_AUTH_CAPTURE_AVS

HOST_POST_AUTH_CAPTURE

HOST_POST_AUTH_CAPTURE_AVS

Required Pipeline
Session Attributes

PipelineSessionConstants.PAYMENT_CREDIT_CARD

PipelineSessionConstants.PAYMENT_AUTHORIZATION_AMOUNT

PipelineSessionConstants.ORDER_HANDLE (Request scope)

Updated Pipeline
Session Attributes

None

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

AuthorizationFailureException, thrown when the credit card being used for authorization is invalid (that is, the number or other associated information is incorrect).

AuthorizationRejectedException
, thrown when the credit card used for authorization is valid but cannot be authorized (overdrawn, expired, and so on).


PipelineNonFatalException
, thrown when the external payment service is unavailable. The transaction is recorded for retry.


PipelineException
, thrown when there is a configuration error, a general service error, or a system-level exception from a back-end component.


 

PaymentAuthorizationTerminalPC

Class Name

examples.wlcs.sampleapp.payment.pipeline.
PaymentAuthorizationTerminalPC

Description

Authorizes a given credit card for a specified amount. Used for terminal-based payment models, shown in your application's Meta-inf\application-config.xml file as the following MBean properties:

AUTO_MARK_AUTO_SETTLE

AUTO_MARK_AUTO_SETTLE_AVS

AUTO_MARK_MANUAL_SETTLE

AUTO_MARK_MANUAL_SETTLE_AVS

MANUAL_MARK_AUTO_SETTLE

MANUAL_MARK_AUTO_SETTLE_AVS

MANUAL_MARK_MANUAL_SETTLE

MANUAL_MARK_MANUAL_SETTLE_AVS

Required Pipeline
Session Attributes

PipelineSessionConstants.PAYMENT_CREDIT_CARD

PipelineSessionConstants.PAYMENT_AUTHORIZATION_AMOUNT

PipelineSessionConstants.ORDER_HANDLE (Request scope)

Updated Pipeline
Session Attributes

None

Removed Pipeline
Session Attributes

None

Type

Java object

JNDI Name

None

Exceptions

AuthorizationFailureException, thrown when the credit card being used for authorization is invalid (that is, the number or other associated information is incorrect).

AuthorizationRejectedException
, thrown when the credit card used for authorization is valid but cannot be authorized (overdrawn, expired, and so on).


PipelineNonFatalException
, thrown when the external payment service is unavailable. The transaction is recorded for retry.


PipelineFatalException
, thrown when there is a configuration error, a general service error, or a system-level exception from a back-end component.


 

 


Integrating with a Payment Service

The Credit Card Web Service that is installed with WebLogic Portal provides a default framework for handling authorization, capture, and settlement of credit card transactions received from the default CreditCardService EJB in the enterprise application. The business methods within the CreditCardService EJB implement a standard workflow that is associated with the completion of credit card transactions, and the current state of the transaction is maintained and each action is journaled. (The Credit Card Web Service, by comparison, is a stateless session EJB wrapped in code that makes it a Web service.)

Integrating your enterprise applications with the payment Web service involves modifying either the CreditCardService EJB and/or the Credit Card Web Service, depending on who will host the Web service: your organization or the third-party payment vendor.

In either case, it helps to understand the connection relationship between the pieces in the WebLogic Portal payment services and the pieces in the Credit Card Web Service. Figure 6-5 illustrates the connection between the two.

Figure 6-5 The Relationship Between the Credit Card Web Service and the CreditCardService EJB


 

Caution: The default payment Web service that is shipped with WebLogic Portal always sends payment information through without any errors, as if it were connected to and approved by a third-party payment service. This default processing of payment is not designed for production use. You must integrate with your third-party vendor's payment service to process payment correctly.

If the Third-Party Vendor Hosts the Web Service

If the third-party vendor hosts the Credit Card Web Service, the vendor will integrate the Web service with their product's API.

Here is what your organization must do to connect to the vendor-hosted Web service:

  1. If the vendor has modified any of PS*.class files in the Web service's payment.jar file, copy those modifications in your enterprise application. You can find the source code for these classes in:
    PORTAL_HOME\applications\wlcsApp\src\examples\wlcs\
    sampleapp\payment\PS*.java

    Compile the source files.

  2. Make any vendor-required modifications to the CreditCardService EJB in your enterprise application so that it makes appropriate SOAP calls to the vendor's payment Web service. You can find the source code for the CreditCardService EJB in the following files:
    PORTAL_HOME\applications\wlcsApp\src\examples\wlcs\
    sampleapp\payment\CreditCardService*.java

    Compile the source files.

  3. After you compile your source code, add the class files to the wlcsSample.jar in wlcsApp application directory. When you add the class files to the JAR, make sure you maintain their relative directory structure.

  4. Run the EJB compiler (ejbc) on the wlcsSample.jar file.

  5. In the WebLogic Server Console for portalServer, select Deployments > Applications > wlcsApp > Service Configuration > Payment Service Client, and in the Payment Web Service WSDL field, modify the URL to the payment vendor's WSDL file. Click Apply in the Console to apply the new URL. The new URL is written to the following file: PORTAL_HOME\applications\wlcsApp\META-INF\
    application-config.xml
    .

    Note: At startup, WebLogic Server reads the application-config.xml file, so it knows where to find the Web service.

If Your Organization Hosts the Web Service

If your organization hosts the Credit Card Web Service, we strongly recommend that you deploy the Web service on a separate instance of WebLogic Server (that is, use a separate Java Virtual Machine [JVM]) than what your enterprise applications are running on. This way, your enterprise applications are insulated from failures or incidents in the Web service.

Here is what you must do if your organization hosts the Credit Card Web Service:

Caution: These are general, simplified guidelines for integrating with a vendor's API. In actual practice, such integration requires close collaboration with your vendor. We strongly recommend you contact your vendor for assistance.

  1. Obtain your third-party vendor's payment product API.

  2. Modify the CreditCardWebService EJB (the Web service EJB) so that it translates SOAP calls into the language of the third-party product's API. (See Default Payment Services Shipped With WebLogic Portal.) You can find the source code for the CreditCardWebService EJB in the following files:
    PORTAL_HOME\applications\paymentWSApp\src\examples\wlcs\
    sampleapp\payment\CreditCardWebService*.java

    Compile the source files.

  3. After you have compiled the source code, replace the class files in payment.jar, located in the paymentWSApp directory. When you add the class files to the JAR, make sure you maintain their relative directory structure.

  4. Use the Web service generator (wsgen) on the payment.jar file to build a file called payment-webservice.war, as shown in Figure 6-5.

    For information on using wsgen, see Programming WebLogic Server Web Services at http://download.oracle.com/docs/cd/E13222_01/wls/docs61/webServices/index.html.

  5. Make any necessary modifications to the CreditCardService EJB in the wlcsApp application so that it makes appropriate SOAP calls to the CreditCardWebService EJB. You can find the source code for the CreditCardService EJB in the following files:
    PORTAL_HOME\applications\wlcsApp\src\examples\wlcs\
    sampleapp\payment\CreditCardService*.java

    Compile the source files.

  6. After you compile the source files, add the class files to wlcsSample.jar in the wlcsApp application directory. When you add the file to the JAR, maintain its relative directory structure.

  7. Run the EJB compiler (ejbc) on the wlcsSample.jar file.

  8. In the WebLogic Server Console for portalServer, select Deployments > Applications > wlcsApp > Service Configuration > Payment Service Client, and in the Payment Web Service WSDL field, modify the URL to the payment WSDL file. Click Apply in the Console to apply the new URL. The new URL is written to the following file: PORTAL_HOME\applications\wlcsApp\META-INF\
    application-config.xml
    .

    Note: At startup, WebLogic Server reads the application-config.xml file, so it knows where to find the Web service.

Default Payment Services Shipped With WebLogic Portal

The CreditCardWebService EJB is a stateless session bean that provides services related to the authorization, capture, and settlement of credit card transactions. The CreditCardWebService EJB serves as an interface behind which integrations with various payment solutions can be implemented. The current state of each transaction is maintained, and each action is journaled, by the CreditCardService EJB in the wlcsApp application.

Caution: The CreditCardWebService EJB that is shipped with WebLogic Portal is designed to give you an example of the different payment services you can use. The default Web service always sends payment information through without any errors, as if it were connected to and approved by a third-party payment service. This default processing of payment is not designed for production use. You must integrate with your third-party vendor's payment service to process payment correctly.

General characteristics of transactions are described in the following list:

You can configure the Payment service to work with your business model. The methods/entry points are described in detail in the sections that follow.

Authorize

Use this method in the CreditCardService EJB only for terminal-based payment models. This entry point validates the credit card number and reserves credit on the supplied card for the amount specified. When validated, it creates a new entry in the WLCS_TRANSACTION table that records the incident and sets the state based on the payment model. The amount of the transaction is deducted from the open to buy in the customer's credit balance. However, the funds are not transferred to the merchant until settling.

Note: Merchants who are using a terminal-based processor must perform a capture and settlement procedure before the funds from the sale are transferred to their account. This is accomplished by a subsequent call to Capture and/or Settle, depending on the Auto Mark/Auto Settle processor configuration.

AuthorizeAndCapture

Use this method only for host-based payment models. This entry point validates the credit card number and reserves credit on the supplied card for the amount specified. When validated, it creates a new entry in the WLCS_TRANSACTION table that records the incident and sets the state based on the payment model. The amount of the transaction is deducted from the open to buy in the customer's credit balance. However, the funds are not transferred to the merchant until settling.

Note: Merchants who are using a host-based post-authorization capture processor must perform a capture and settlement procedure before the funds from the sale are transferred to their account.

BatchQuery

Use this method to update and reconcile the status of a transaction committed in a given batch. This entry point determines if a particular transaction has failed, and is essential for payment processors where the status of an item cannot be determined correctly from the output fields of a batch-commit message. BatchQuery always returns success on the query and creates a TransactionEntry to reflect this success.

Note: This method is implemented as a pass through to the underlying service provider. Subsequently, all return information is service specific. For details on return codes and results, see your service providers documentation.

QueryTransactions

Use this method to query the Payment server for transactions that match the designated parameters. You need only to supply non-null values for those parameters that you want to query against. However, you must supply at least one non-null parameter. Always returns OK.

Note: This method is implemented as a pass through to the underlying service provider. Subsequently, all return information is service specific. For details on return codes and results, see your service provider documentation.

Reauthorize

Use this method only for terminal-based payment models. This method attempts to authorize a payment transaction that is in the retry state. After authorization attempt, the payment transaction is updated with the current date and a transaction entry is added to the payment transaction. The modified payment transaction and any service-specific results are then returned.

ReauthorizeAndCapture

Use this method only for host-based payment models. This method attempts to authorize a payment transaction that is in the retry state. After authorization attempt, the payment transaction is updated with the current date and a transaction entry is added to the payment transaction. The modified payment transaction and any service-specific results are then returned.

Settle

Use this method only for terminal-based payment models with a manual-settle processor configuration. This method finalizes a transaction by transferring a portion of the funds previously captured from the customer's account to the merchant's account. The amount can be less than or equal to the captured amount. Always returns settle success.

VoidTransaction

This method aborts previously submitted transactions. Returns OK. The following transactions can be voided:

Credit Card Encryption

For information on credit card encryption, see "Credit Card Security Service" in the Security Guide.

 

back to top previous page next page