Part 2 - Integrating Plug 'N Pay with Storefront Shopping Cart

by Erik Lane 7. March 2006 17:28

This is post number two in the process of integrating a new payment system into Storefront 6.0 (SF6).  The payment system we are integrating is Plug 'N Pay (PNP).  Last time we completed steps one and two in the five step process.  Just as a reminder here are the 5 steps needed to accomplish this task.

Step 1: Adding the Payment Processing Service to the Store's Database
Step 2: Add a new case to CProcessor.CallProcessor()
Step 3: Creating a New Processor Class
Step 4: Handling the Results of the Transaction
Step 5: Indicating the Success of a Transaction

Lets start step  #3:  Creating the New Processor Class.  Our new Processor Class will encapsulate all of the functionality to process the payment through PNP and log the transaction into the SF6 database.  Create an empty class file (I saved it to XEBusinessRules\Processors) and have it inherit from BusinessRule.Processors.CProcessorBase.  In the code snippet below I'm doing this, providing the constructor that accepts object of type COrder, added a protected PNP object, and instantiate it.

Imports StoreFront.SystemBase
Imports StoreFront.BusinessRule.Orders

    Public Class CPlugNPay
        Inherits BusinessRule.Processors.CProcessorBase
 Protected m_objPlugNPay As PNPCOMLib.mainClass
 
        Sub New(ByVal objOrder As Orders.COrder)
            MyBase.New(objOrder)
            Me.fillProcessorInfo("PlugNPay")
            m_objPlugNPay = New PNPCOMLib.mainClass
        End Sub

We are also importing namespaces that contain useful tools for payment processor integration.  The Order is passed to the constructor of our base class, CProcessorBase. CProcessorBase uses the information stored in objOrder to retrieve the payment method used by the customer, then the FillProcessorInfo method is called to retrieve the information stored for my processor in the PaymentProcessors table (see Step 1).

Part 3 will cover Handling the Results of the Transaction.

Tags:
Comments are closed