PHP code example of frankperez87 / pma-fulfillment
1. Go to this page and download the library: Download frankperez87/pma-fulfillment library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
frankperez87 / pma-fulfillment example snippets
MA\Account;
use PMA\BillingAddress;
use PMA\Order;
use PMA\PMA;
use PMA\Product;
use PMA\ShippingAddress;
try {
// Instantiate PMA Account Class
$account = new Account('client number here', "username", "password");
// Instantiate Order Class
$order = new Order();
// Set Order Details
$order->setTransactionNumber('TEST123');
//$order->setEmail(''); // Optional
$order->setOrderDate('01-01-2015');
//$order->setCustomerNumber(''); // Optional
$order->setOrderType('BULK');
$order->setPaymentAmount(11.08);
$order->setShippingAmount(2.50);
$order->setTaxAmount(2.59);
$order->setSourceCode('Internet');
$order->setSource('Internet');
// Add Products
$order->addProduct(new Product('PROD123', 1, 5.99));
// Instantiate Shipping Class
$shipping = new ShippingAddress();
//$shipping->setAttn('Test'); Optional
$shipping->setFirstName('Frank');
$shipping->setLastName('Test'); // Optional
$shipping->setAddressOne('123 Main Street');
//$shipping->setAddressTwo(''); // Optional
$shipping->setCity('Davie');
$shipping->setState('FL');
$shipping->setZip('33314');
$shipping->setCountry('USA');
//$shipping->setPhoneNumber(''); // Optional
$shipping->setAddressType('RESIDENTIAL');
$shipping->setShipMethod('UPSMI');
// Instantiate Shipping Class
$billing = new BillingAddress();
$billing->setFirstName('Frank');
$billing->setLastName('Test'); // Optional
$billing->setAddressOne('123 Main Street');
//$billing->setAddressTwo(''); // Optional
$billing->setCity('Davie');
$billing->setState('FL');
$billing->setZip('33314');
$billing->setCountry('USA');
// Add Shipping and Billing Objects to Order
$order->addShippingAddress($shipping);
$order->addBillingAddress($billing);
$pma = new PMA($account);
$pma->setOrder($order);
$response = $pma->send();
} catch(InvalidArgumentException $e) {
echo $e->getMessage(); // Outputs any errors returned
}