I want to use a VposCOMAPI.dll, written by vs2010, from PB9 or later.
I use the following code:
OLEObject obj
int ret_code, ret_Code2
obj = create OLEObject
String Auth_code, Rsp_code, Rsp_msg
ret_code = obj.ConnectToNewObject("VposCOMAPI.dll")
if ret_code <> 0 then
destroy obj
messagebox("error", "Error !" + string(ret_code))
return
else
obj.apiInit()
obj.CARD_NO="9999111188882222"
obj.MERCHANTID = "0909090909"
obj.executeAuth()
ret_Code2 = obj.AUTH_RETCODE
if ret_Code2 = 0 then
Auth_code = obj.APPROVE_CODE
Rsp_code = obj.RESPONSE_CODE
Rsp_msg = obj.RESPONSE_MSG
messagebox("OK", "OK !")
else
messagebox("error2", "Error2 !")
end if
destroy obj
end if
I got the ret_code “ Errorcode -2 ( Class name not found )”.
Anybody could help me ?
Could I use the VposCOMAPI.dll in this way ?
Thanks !
Jack
PS : The VposCOMAPI.dll works in VS2010
1 Add Reference --> Browse
2 VB sample code
Public Class Form1
Dim ac As New VposCOMAPI.ApiClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim retCode As Integer
rspCode.Text = ""
rspMsg.Text = ""
approveCode.Text = ""
txnNo.Text = ""
txnDate.Text = ""
apiResult.Text = ""
ac.setPORT(443)
ac.setLogFile("D:\workTemp\vposApi.log")
ac.setURL("nccnet-vpostest.nccc.com.tw", "/vposMert/servlets/apiControl")
ac.setMERCHANT_ID(merchantId.Text)
ac.setTERMINAL_ID(posId.Text)
ac.setEXPIRE_DATE(expireDate.Text)
ac.setCARD_NO(cardNo.Text)
…
3 C# sample code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using VposCOMAPI;
namespace testCSapi
{
public partial class Form1 : Form
{
public Form1() {InitializeComponent();}
private void send_Click(object sender, EventArgs e)
{
int retCode = 0;
ApiClient ac = new VposCOMAPI.ApiClient();
ac.setURL("nccnet-vpostest.nccc.com.tw", "/vposMert/servlets/apiControl");
ac.setLOGFILE("D:/workTemp/vpos/log/testCSapi.log");
ac.setMERCHANT_ID(merchantId.Text);
ac.setTERMINAL_ID(posId.Text);
ac.setEXPIRE_DATE(expireDate.Text);
ac.setCARD_NO(cardNo.Text);
…