Jump to content

trying to create small test script


rockbust

Recommended Posts

I am trying to create a test script using soap to create a PaymentMethodID with web services. I an new to php and am getting errors that say Object of class PaymentMethod could not be converted to string. can someone help?

 

The doc at the webservices say

createPaymentMethod(Authentication, PaymentMethod) returns PaymentMethodID

This method creates a new PaymentMethod record. The data requirements are listed in the

table below. Either the CC or eCheck fields must be present but not both. If the method is

created for a valid ClientID and no other payment methods exist for that client then the

isDefault flag will be set automatically. If successful, the new PaymentMethodID is returned and

a soap fault is returned on failure.

MerchantID Must be associated with the authentication data

ClientID If not zero, must exist and be associated with the specified MerchantID

AcctHolderName Must not be empty

CcCardNumber Must be valid card number

CcExpirationDate Must be valid YYYYMM

CcCardType Must be VISA, MAST, AMER, DISC, DINE or JCB

CcProcurementCard True/False (optional)

EcAccountNumber Must be a valid account number

EcAccountTRN Must be a valid transit routing number

EcAccountType Must be CHECKING or SAVINGS

IsDefault True/False (optional)

 

<?php
require_once('./lib/nusoap.php'); // include the nusoap classes
class Authentication
{

/**
* @var string
*/
public $APILoginID;

/**
* @var string
*/
public $SecureTransactionKey;
}

class PaymentMethod
{

/**
* @var int
*/
public $MerchantID;

/**
* @var int
*/
public $ClientID;

/**
* @var int
*/
public $PaymentMethodID;

/**
* @var string
*/
public $AcctHolderName;

/**
* @var string
*/
public $CcCardNumber;

/**
* @var string
*/
public $CcExpirationDate;

/**
* @var string
* NOTE: CcCardType should follow the following restrictions
* You can have one of the following value
* VISA
* MAST
* DISC
* AMER
* DINE
* JCB
*/
public $CcCardType;

/**
* @var boolean
*/
public $CcProcurementCard;

/**
* @var string
*/
public $EcAccountNumber;

/**
* @var string
*/
public $EcAccountTRN;

/**
* @var string
* NOTE: EcAccountType should follow the following restrictions
* You can have one of the following value
* CHECKING
* SAVINGS
*/
public $EcAccountType;

/**
* @var string
*/
public $Note;

/**
* @var boolean
*/
public $IsDefault;
}
$wsdl = "https://ws.paymentsgateway.net/Service/v1/Client.wsdl"; // URL of the live wsdl

$Authentication = new Authentication();
$Authentication->APILoginID = 'removed';
$Authentication->SecureTransactionKey = 'removed';

$client = new nusoap_client($wsdl,true); // create soap client
		$err = $client->getError();
		if ($err) {
			echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
		}
		$client->debug_flag=1;


$PaymentMethod = new PaymentMethod();
$PaymentMethod->PaymentMethodID = 0;
$PaymentMethod->MerchantID = 126981;
$PaymentMethod->ClientID = 3167620;
$PaymentMethod->AcctHolderName = 'Bob';
$PaymentMethod->EcAccountNumber = '1234567';
$PaymentMethod->EcAccountTRN = '211170101';
$PaymentMethod->EcAccountType = 'CHECKING';



$result=$client->call('createPaymentMethod',$Authentication,$PaymentMethod);
		$response =str_replace("\n","&",trim(str_replace("endofdata", "", trim($result['PaymentMethodID']))));
		//parse_str($response); //Parses the string into variables

		echo $response;


?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/184551-trying-to-create-small-test-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.