Adding custom payment method for info purpose

1. Add PaymentMethodConfigurations.xml
<PaymentMethodConfiguration humanEditable="true"
        maximumAmount="Unbounded" minimumAmount="0"
        name="MyPaymentAccountOffline" partiallyConsumable="true"
        paymentSystemName="SimpleOffline" priority="LOW"
        refundAllowed="false" systemEditable="true"/>

2. Add PaymentMappings.xml
<Mapping paymentActionRule="Early Approval"
        paymentConfiguration="MyPaymentAccountOffline" paymentMethod="MyPaymentAccountOffline"/>

3. PaymentDeployment.xml :  Used for protocol data to save in PPCEXTDATA
<ProtocolProperties>
  <ProtocolProperty name="card_number" keep="true"/>
  <ProtocolProperty name="account" keep="true"/>
  <ProtocolProperty name="cc_brand" keep="true"/>
  <ProtocolProperty name="expire_month" keep="true"/>
  <ProtocolProperty name="expire_year" keep="true"/>
  <ProtocolProperty name="billto_firstname" keep="true"/>
  <ProtocolProperty name="billto_lastname" keep="true"/>
  <ProtocolProperty name="billto_address1" keep="true"/>
  <ProtocolProperty name="billto_city" keep="true"/>
  <ProtocolProperty name="billto_stateprovince" keep="true"/>
  <ProtocolProperty name="billto_zipcode" keep="true"/>
  <ProtocolProperty name="billto_country" keep="true"/>
  <ProtocolProperty name="customParam1" keep="true"/>
  <ProtocolProperty name="customParam2" keep="true"/>
  <ProtocolProperty name="customParam3" keep="true"/>
  <ProtocolProperty name="customParam4" keep="true"/>
  <ProtocolProperty name="customParam5" keep="true"/>
  </ProtocolProperties>

4 Insert for payment policy 
insert into policy( policy_id, policyname, policytype_id,storeent_id, properties) values( <policyId>, 'MyPaymentAccount', 'Payment', 10051,
'attrPageName=MyPaymentAccountView&paymentConfigurationId=default&display=true& compatibleMode=false&uniqueKey=token');

insert into policydesc(policy_id, language_id, Description,longDescription ) values ( <policyId>, -1, 'MyPaymentAccount', 'MyPaymentAccount' );

insert into policycmd (policy_id, businesscmdclass) values ( <policyId>, 'com.ibm.commerce.payment.actions.commands.DoPaymentActionsPolicyCmdImpl') ;

insert into policycmd (policy_id, businesscmdclass) values ( <policyId>, 'com.ibm.commerce.payment.actions.commands.EditPaymentInstructionPolicyCmdImpl') ;

insert into policycmd (policy_id, businesscmdclass) values ( <policyId>, 'com.ibm.commerce.payment.actions.commands.QueryPaymentsInfoPolicyCmdImpl');

5. Create a jsp at Visa.js location 

<input type="hidden" name="paymentTCId" value="<c:out value="${paymentTCId}"/>" id="WC_StandardBillMeLater_inputs_1_<c:out value='${paymentAreaNumber}'/>"/>
<input type="hidden" id="mandatoryFields_<c:out value='${paymentAreaNumber}'/>" name="mandatoryFields"  value="billing_address_id"/>\
<table>
<tr><td>*Custom Param1:</td><td><input type="text" name="customParam1" id="customParam1" value=""/></td></tr>
<tr><td>*Custom Param2:</td><td><input type="text" name="customParam2" id="customParam2" value=""/></td></tr>
<tr><td>*Custom Param3:</td><td><input type="text" name="customParam3" id="customParam3" value=""/></td></tr>
<tr><td>Custom Param4:</td><td><input type="text" name="customParam4" id="customParam4" value=""/></td></tr>
<tr><td>*Custom Param5:</td><td><input type="text" name="customParam5" id="customParam5" value=""/></td></tr>

</table>


6. Change the rest template  :
/Stores/WebContent/WEB-INF/config/com.ibm.commerce.order/rest-template-config.xml

<method name="addPaymentInstruction" httpMethod="POST" path="@self/payment_instruction">
<template>
<![CDATA[{
"orderId" : "$orderId",
"piId" : "$piId",
"billing_address_id" : "$billing_address_id",
"piAmount" : "$piAmount",
"payMethodId" : "$payMethodId",
"paymentTermConditionId" : "$paymentTCId",
"cc_brand" : "$cc_brand",
"cc_cvc" : "$cc_cvc",
"account" : "$account",
"expire_month" : "$expire_month",
"expire_year" : "$expire_year",
"check_routing_number" : "$check_routing_number",
"checkingAccountNumber" : "$checkingAccountNumber",
"checkRoutingNumber" : "$checkRoutingNumber",
"valueFromProfileOrder" : "$valueFromProfileOrder",
"valueFromPaymentTC" : "$valueFromPaymentTC",
"requesttype" : "$requesttype",
"authToken" : "$authToken",
"x_unbound" : "$unbound",
"customParam1" : "$customParam1",
"customParam2" : "$customParam2",
"customParam3" : "$customParam3",
"customParam4" : "$customParam4",
"customParam5" : "$customParam5"
}]]>
</template>
</method>

7. Created a view and ac policy for the view "MyPaymentAccountView", with struts entry.

Comments

Popular posts from this blog

Merging / Migrating / Combining User Session Data (Cart Merge while User Logon in Websphere Commerce)

Calculation Framework in Websphere Commerce.

Websphere Commerce Catalog Subsystem