Scenario 14: Visual C++.NET

From UniCharge Integration Library
Jump to: navigation, search

Download Source File

#include "stdafx.h"
 
using namespace System;
using namespace System::Collections::Generic;
using namespace iBilling::Client;
 
int main(array<System::String ^> ^args)
{
	//Set up clients' settings;
	Dictionary<String^, Object^>^ config = gcnew Dictionary<String^, Object^>();
	config[SessionConnection::PROCESSOR_HOST] = "https://[server-name]/ibilling/xmlhttps";
	config["debug"] = true;
	//Login;
	Session^ session = Session::Login(2000, "welcome", config);
	//Find customer account;
	CustomerAccount^ customerAccount = session->LoadCustomerAccount("cpp.ca-1");
	//Create new payment option;
	PaymentOption^ paymentOption = customerAccount->CreatePaymentOption();
	//code is optinal; if you specify the value, make sure the code is unique;
	paymentOption->Code = "cpp.po-14";
	paymentOption->HolderName = "Jane Doe";
	paymentOption->Number = "4111111111111111";
	//expiration date;
	paymentOption->Accessory = "1209";
	paymentOption->Street1 = "233 12th Street";
	paymentOption->City = "Columbus";
	paymentOption->State = "CA";
	paymentOption->ZipCode = "31904";
	//Find statement payment plan;
	PaymentPlan^ paymentPlan = session->LoadPaymentPlan("cpp.pp-1");
	//Set payment option;
	paymentPlan->PaymentOption = paymentOption;
	//Mark object for persistence;
	session->Save(customerAccount);
	//Synchronize changes with the server;
	try{
		session->Synchronize();
	}
	catch(Exception^ ex){
		//Be sure to properly handle exception, this is just a sample solution;
		Console::WriteLine(ex->Message);
		return 0;
	}
	//logout;
	session->Logout();
return 0;
}
Personal tools
Namespaces

Variants
Actions
Integration Info
Library Documentation
Toolbox