Login   Register  
PHP Classes
elePHPant
Icontem

File: test_pg_webservice.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gezim Muja  >  PG Web Service  >  test_pg_webservice.php  >  Download  
File: test_pg_webservice.php
Role: Example script
Content type: text/plain
Description: Add new client, assign a payment method and finally do a transaction.
Class: PG Web Service
Process payments using Payments Gateway API
Author: By
Last change: add the require_once function
Date: 2012-10-11 07:30
Size: 2,084 bytes
 

Contents

Class file image Download
<?php
// ----------------------------- Testing the payment gateway api --------------------------------------------------------------
require_once('pg_webservice.php');

$client = new ClientRecord;
$client->FirstName "Gezim";
$client->LastName "Muja";
$client->CompanyName "Test company";
$client->Address1 "123 main street";
$client->City 'Miami';
$client->State "FL";
$client->PostalCode "12434";
$client->PhoneNumber '789-987-7899';
$client->EmailAddress 'gezimi005@gmail.com';
$client->ShiptoFirstName 'RT';
$client->ShiptoLastName 'Designer';
$client->ShiptoCompanyName "RT Designer";
$client->ShiptoAddress1 "7899 Alb Street";
$client->ShiptoPhoneNumber "369-963-9999";
$client->ConsumerID uniqid();
//$client->Status = '1';
$ticket = new Authentication;

$webServ = new PG_WebService;
$webServ->insertNewClient($ticket$client);
$client_id $webServ->insertNewClient($ticket$client);
echo 
"Client id: ".$client_id;
echo 
"\n\n\n\n\n\nError array: ";
print_r($webServ->getError());
echo 
"\n\n\n\n\n\n";

$paymentMethod = new PaymentMethod;
$paymentMethod->AcctHolderName "GEZIM MUJA";
$paymentMethod->ClientID $client_id;//$client_id;
$paymentMethod->EcAccountNumber '12345678';
$paymentMethod->EcAccountTRN '021000021';
$paymentMethod->EcAccountType EcAccountType::SAVE;
$paymentMethod->Note 'New payment method using bank data';
$paymentMethod->IsDefault TRUE;

$paymentMethod_id $webServ->insertNewPaymentMethod($ticket$paymentMethod);
echo 
"Payment method id: ".$paymentMethod_id;
echo 
"\n\n\n\n\n\nError array: ";
print_r($webServ->getError());

$agiTrxObj = new AGI_Transaction;
$agiTrxObj->pg_client_id $client_id;
$agiTrxObj->pg_payment_method_id $paymentMethod_id;
$agiTrxObj->pg_transaction_type EFT_TRXType::SALE;
$agiTrxObj->pg_total_amount 0.1;

$resp $webServ->agiDoTransaction($agiTrxObj);
echo 
"Response: ".$resp;
echo 
"\n\n\n\n\n\nError array: ";
print_r($webServ->getError());
echo 
"\n\n\n\nResponse:";print_r($webServ->getAgiTrxResponseArr());