跳到主要内容

付款查询

本指南介绍了如何在商户网站应用程序中应用相应的源代码,形成UPP支付查询处理的强制支付请求参数并将其发送给PayMaster。

第 1 步:图书馆

商户必须在其应用程序中包含 PayMaster 商户插件 (MPI) Java 库 PayMaster.jar

第 2 步:导入

对于 UPP 付款,商家应将以下内容导入其代码中:

  • com.PayMaster.Entities.PayMasterEntity
  • com.PayMaster.PropertiesReader.PropertiesReader
  • com.PayMaster.MessageRequestBuilder.WebservicePaymentRequestMessageBuilder

第 3 步:源代码

import com.PayMaster.Entities.PayMasterEntity;
import com.PayMaster.PropertiesReader.PropertiesReader;
import com.PayMaster.MessageRequestBuilder.WebservicePaymentRequestMessageBuilder;

// Declare variable for Payment Master Properties - 1st Parameter = File Path, 2nd Parameter = File Name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "UPPPayment.properties");

// Declare variable for Payment Master Entity
PayMasterEntity paymentRequestEntity = new PayMasterEntity();

// Get all the parameter values from the user side and set them into Payment Master Entity
paymentRequestEntity.setter("PaymentID", "U02");
paymentRequestEntity.setter("MerchantID", "000010000099939");
paymentRequestEntity.setter("ServiceID", "FNX");
paymentRequestEntity.setter("MerchRefNo", "MYB2023030315435025LL");
paymentRequestEntity.setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp");

// Call Payment Master Payment Request Message Builder to generate the message
WebservicePaymentRequestMessageBuilder messageBuilder = new WebservicePaymentRequestMessageBuilder();
messageBuilder.buildUPPQueryRequestMessage(paymentRequestEntity, propertiesReader);

// Retrieve values from Payment Master Entity
String MerchantID = paymentRequestEntity.getter("MerchantID");
String CardNo = paymentRequestEntity.getter("CardNo");
String TxnDtTm = paymentRequestEntity.getter("TxnDtTm");
String TxnAmt = paymentRequestEntity.getter("TxnAmt");
String TxnStatus = paymentRequestEntity.getter("TxnStatus");
String CurrCode = paymentRequestEntity.getter("CurrCode");
String AuthIDRespCode = paymentRequestEntity.getter("AuthIDRespCode");
String ExpTxnAmt = paymentRequestEntity.getter("ExpTxnAmt");
String RetrievalRefNo = paymentRequestEntity.getter("RetrievalRefNo");
String OrgRespCode = paymentRequestEntity.getter("OrgRespCode");
String OrigTxnAmt = paymentRequestEntity.getter("OrigTxnAmt");
String OrigCurrCode = paymentRequestEntity.getter("OrigCurrCode");
String TxnChannel = paymentRequestEntity.getter("TxnChannel");
String FICode = paymentRequestEntity.getter("FICode");
String PymtGwRefNo = paymentRequestEntity.getter("PymtGwRefNo");
String TxnStatDetCde = paymentRequestEntity.getter("TxnStatDetCde");
String TxnStatMsg = paymentRequestEntity.getter("TxnStatMsg");
String ServiceID = paymentRequestEntity.getter("ServiceID");
String MerchHostID = paymentRequestEntity.getter("MerchHostID");
String MerchSessionID = paymentRequestEntity.getter("MerchSessionID");
String MerchRefNo = paymentRequestEntity.getter("MerchRefNo");
String OrderRefNo = paymentRequestEntity.getter("OrderRefNo");
String QueryStatus = paymentRequestEntity.getter("QueryStatus");
String FPXRefNo = paymentRequestEntity.getter("FPXRefNo");
String UppPymtMode = paymentRequestEntity.getter("UppPymtMode");
String OrigRespCode = paymentRequestEntity.getter("OrigRespCode");
String ExporigTxnAmt = paymentRequestEntity.getter("ExporigTxnAmt");

.....

第 4 步:指示 PayMaster 属性文件位置

商家必须使用PropertiesReader指定 PayMaster 属性文件的位置。

第 5 步:为 PayMaster 请求实体分配值

商家应向 PayMaster 请求实体分配值。该代码必须包含示例代码中指定的所有字段,因为它们是强制性的。

  • setter函数用于赋值,接受两个参数:setter(参数名,参数值)

第 6 步: 调用 Web 服务支付请求消息生成器

分配所有强制值后,商家应使用buildUPPPaymentQueryRequest函数调用 Web 服务支付请求消息生成器。

  • 将生成付款查询请求消息并将其提交到 PayMaster 网关。
  • 从 PayMaster 网关收到的查询响应将被处理并分配回 PayMaster 请求实体。

第 7 步: 从 PayMaster 请求实体检索值

商家可以使用相同的 PayMaster 请求实体从查询响应中检索信息。

  • getter 函数用于检索值,接受一个参数:getter(参数名称)

PayMaster商户插件(MPI)支持的字段请参考 UPP支付查询参数