Exemplo n.º 1
0
$oauth_token = "107d74ab-4a18-4713-88ff-69bd05710086";
//Defining data for the SALE transaction
// Merchant data (obtained from the payHub Virtual Terminal (3rd party integration)
$merchant = new Merchant();
$merchant->setOrganizationId(10127);
$merchant->setTerminalId(215);
//Credit card data
$card_data = new CardData();
$card_data->setCardNumber("5466410004374507");
$card_data->setCardExpiryDate("202011");
$card_data->setCvvData("998");
$card_data->setBillingAddress1("2350 Kerner Blvd");
$card_data->setBillingAddress2("On the corner");
$card_data->setBillingCity("San Rafael");
$card_data->setBillingState("CA");
$card_data->setBillingZip("99997-0003");
// Customer data
$customer = new Customer();
$customer->setFirstName("First");
$customer->setLastName("Contact");
$customer->setCompanyName("Payhub Inc");
$customer->setJobTitle("Software Engineer");
$customer->setEmailAddress("*****@*****.**");
$customer->setWebAddress("http://payhub.com");
$customer->setPhoneNumber("(415) 479 1349");
$customer->setPhoneExt("123");
$customer->setPhoneType("M");
$object = new Verify($merchant, $customer, $card_data);
$transaction = new TransactionManager($merchant, $WsURL, $oauth_token);
$result = $transaction->doVerify($object);
if ($result->getErrors() == null) {
include_once $path_to_IncludeClases;
//Defining the Web Service URL
$WsURL = "https://sandbox-api.payhub.com/api/v2/";
$oauth_token = "2a5d6a73-d294-4fba-bfba-957a4948d4a3";
//Defining data for the SALE transaction
// Merchant data (obtained from the payHub Virtual Terminal (3rd party integration)
$merchant = new Merchant();
$merchant->setOrganizationId(10074);
$merchant->setTerminalId(134);
$bill = new Bill();
$bill->setBaseAmount(1.0);
//Credit card data
$card_data = new CardData();
$card_data->setCardNumber("4012881888818888");
$card_data->setCardExpiryDate("202012");
$card_data->setBillingZip("60527");
// Customer data
$customer = new Customer();
$customer->setFirstName("Joe");
$customer->setLastName("Tester");
$customer->setPhoneNumber("844-217-1631");
$customer->setPhoneType("M");
$montly_s = new MontlySchedule();
$montly_s->monthly_type = "E";
$montly_s->monthly_each_days = array(15);
$start = new DateTime("2016-1-29");
$start = $start->format('Y-m-d');
$type = "O";
$endDate = new DateTime("2016-8-29");
$endDate = $endDate->format('Y-m-d');
$scheduleSandE = new ScheduleSartAndEnd();
$bill->setBaseAmount(10.0);
$bill->setShippingAmount(1.23);
$bill->setTaxAmount(1.0);
$bill->setNote("this a sample note");
$bill->setInvoiceNumber("a-00240");
$bill->setPoNumber("56");
//Credit card data
$card_data = new CardData();
$card_data->setCardNumber("5466410004374507");
$card_data->setCardExpiryDate("202011");
$card_data->setCvvData("988");
$card_data->setBillingAddress1("2350 Kerner Blvd");
$card_data->setBillingAddress2("On the corner");
$card_data->setBillingCity("San Rafael");
$card_data->setBillingState("CA");
$card_data->setBillingZip("94901");
// Customer data
$customer = new Customer();
$customer->setFirstName("First");
$customer->setLastName("Contact");
$customer->setCompanyName("Payhub Inc");
$customer->setJobTitle("Software Engineer");
$customer->setEmailAddress("*****@*****.**");
$customer->setWebAddress("http://payhub.com");
$customer->setPhoneNumber("(415) 479 1349");
$customer->setPhoneExt("123");
$customer->setPhoneType("M");
$authorization = new AuthOnly($merchant, $bill, $card_data, $customer);
$transaction = new TransactionManager($merchant, $WsURL, $oauth_token);
$result = $transaction->doAuthonly($authorization);
if ($result->getErrors() == null) {