7
           
            
                
     
    
    Root Mail functions 
Root mail functions are called from the xpayment_invoice table, the function consist of the mode field, filename and enscapulation. For ModeFilenameHook($invoice).
CREATE TABLE `xpayment_invoice` (
 `iid` INT(15) UNSIGNED NOT NULL AUTO_INCREMENT,
 `mode` ENUM('PAID','UNPAID','CANCEL') NOT NULL DEFAULT 'UNPAID',
 `plugin` VARCHAR(128) NOT NULL,
 `return` VARCHAR(1000) NOT NULL,
 `cancel` VARCHAR(1000) NOT NULL,
 `ipn` VARCHAR(1000) NOT NULL,
 `invoicenumber` VARCHAR(64) DEFAULT NULL,
 `drawfor` VARCHAR(255) DEFAULT NULL,
 `drawto` VARCHAR(255) NOT NULL,
 `drawto_email` VARCHAR(255) NOT NULL,
 `paid` DECIMAL(15,2) DEFAULT '0.00',
 `amount` DECIMAL(15,2) DEFAULT '0.00',
 `grand` DECIMAL(15,2) DEFAULT '0.00',
 `shipping` DECIMAL(15,2) DEFAULT '0.00',
 `handling` DECIMAL(15,2) DEFAULT '0.00',
 `weight` DECIMAL(15,2) DEFAULT '0.00',
 `weight_unit` ENUM('lbs','kgs') DEFAULT 'kgs',
 `tax` DECIMAL(15,2) DEFAULT '0.00',
 `currency` VARCHAR(3) DEFAULT 'AUD',
 `items` INT(12) DEFAULT '0',
 `key` VARCHAR(255) DEFAULT NULL,
 `transactionid` VARCHAR(255) DEFAULT NULL,
 `gateway` VARCHAR(128) DEFAULT NULL,
 `created` INT(13) DEFAULT '0',
 `updated` INT(13) DEFAULT '0',
 `actioned` INT(13) DEFAULT '0',
 `reoccurrence` INT(8) DEFAULT '0',
 `reoccurrence_period_days` INT(8) DEFAULT '0',
 `reoccurrences` INT(8) DEFAULT '0',
 `occurrence` INT(13) DEFAULT '0',
 `previous` INT(13) DEFAULT '0',
 `occurrence_amount` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_grand` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_shipping` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_handling` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_tax` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_weight` DECIMAL(15,6) DEFAULT '0.000000',
 `remittion` ENUM('NONE','PENDING','NOTICE','COLLECT','FRAUD','SETTLED') NOT NULL DEFAULT 'NONE',
 `remittion_settled` DECIMAL(15,2) DEFAULT '0.00',
 `donation` TINYINT(2) DEFAULT '0',
 `comment` VARCHAR(5000) DEFAULT NULL,
 `user_ip` VARCHAR(128) DEFAULT NULL,
 `user_netaddy` VARCHAR(255) DEFAULT NULL,
 `user_uid` INT(13) DEFAULT '0',
 `user_uids` VARCHAR(1000) DEFAULT NULL,
 `broker_uids` VARCHAR(1000) DEFAULT NULL,
 `accounts_uids` VARCHAR(1000) DEFAULT NULL,
 `officer_uids` VARCHAR(1000) DEFAULT NULL,
 `remitted` INT(13) DEFAULT '0',
 `due` INT(13) DEFAULT '0',
 `collect` INT(13) DEFAULT '0',
 `wait` INT(13) DEFAULT '0',
 `offline` INT(13) DEFAULT '0',
 PRIMARY KEY (`iid`),
 KEY `SEARCH` (`iid`,`mode`,`currency`,`items`,`remittion`)
) ENGINE=INNODB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8
function PaidXpaymentHook($invoice) 
Called when Enumerator on an invoice is set Paid, this is the ROOT mail function (Bold in Email Permissions)
Template: xpayment_invoice_paid.tpl
Subject: _XPY_EMAIL_PAID_SUBJECT
function UnpaidXpaymentHook($invoice)
Called when Enumerator on an invoice is set to Unpaid, this is the ROOT mail function. (Bold in Email Permissions)
Template: xpayment_invoice_unpaid.tpl
Subject: _XPY_EMAIL_UNPAID_SUBJECT
function CancelXpaymentHook($invoice)
Called when Enumerator on an invoice is set to Cancelled, this is the ROOT mail function. (Bold in Email Permissions) 
Template: xpayment_invoice_cancelled.tpl
Subject: _XPY_EMAIL_CANCELLED_SUBJECT
Remittance Enumerator Invoice Plugin Functions
Remittion mail functions are called from the xpayment_invoice table, the function consist of the remittion then mode field, filename and enscapulation. For RemittionModeFilenameHook($invoice).
CREATE TABLE `xpayment_invoice` (
 `iid` INT(15) UNSIGNED NOT NULL AUTO_INCREMENT,
 `mode` ENUM('PAID','UNPAID','CANCEL') NOT NULL DEFAULT 'UNPAID',
 `plugin` VARCHAR(128) NOT NULL,
 `return` VARCHAR(1000) NOT NULL,
 `cancel` VARCHAR(1000) NOT NULL,
 `ipn` VARCHAR(1000) NOT NULL,
 `invoicenumber` VARCHAR(64) DEFAULT NULL,
 `drawfor` VARCHAR(255) DEFAULT NULL,
 `drawto` VARCHAR(255) NOT NULL,
 `drawto_email` VARCHAR(255) NOT NULL,
 `paid` DECIMAL(15,2) DEFAULT '0.00',
 `amount` DECIMAL(15,2) DEFAULT '0.00',
 `grand` DECIMAL(15,2) DEFAULT '0.00',
 `shipping` DECIMAL(15,2) DEFAULT '0.00',
 `handling` DECIMAL(15,2) DEFAULT '0.00',
 `weight` DECIMAL(15,2) DEFAULT '0.00',
 `weight_unit` ENUM('lbs','kgs') DEFAULT 'kgs',
 `tax` DECIMAL(15,2) DEFAULT '0.00',
 `currency` VARCHAR(3) DEFAULT 'AUD',
 `items` INT(12) DEFAULT '0',
 `key` VARCHAR(255) DEFAULT NULL,
 `transactionid` VARCHAR(255) DEFAULT NULL,
 `gateway` VARCHAR(128) DEFAULT NULL,
 `created` INT(13) DEFAULT '0',
 `updated` INT(13) DEFAULT '0',
 `actioned` INT(13) DEFAULT '0',
 `reoccurrence` INT(8) DEFAULT '0',
 `reoccurrence_period_days` INT(8) DEFAULT '0',
 `reoccurrences` INT(8) DEFAULT '0',
 `occurrence` INT(13) DEFAULT '0',
 `previous` INT(13) DEFAULT '0',
 `occurrence_amount` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_grand` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_shipping` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_handling` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_tax` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_weight` DECIMAL(15,6) DEFAULT '0.000000',
 `remittion` ENUM('NONE','PENDING','NOTICE','COLLECT','FRAUD','SETTLED') NOT NULL DEFAULT 'NONE',
 `remittion_settled` DECIMAL(15,2) DEFAULT '0.00',
 `donation` TINYINT(2) DEFAULT '0',
 `comment` VARCHAR(5000) DEFAULT NULL,
 `user_ip` VARCHAR(128) DEFAULT NULL,
 `user_netaddy` VARCHAR(255) DEFAULT NULL,
 `user_uid` INT(13) DEFAULT '0',
 `user_uids` VARCHAR(1000) DEFAULT NULL,
 `broker_uids` VARCHAR(1000) DEFAULT NULL,
 `accounts_uids` VARCHAR(1000) DEFAULT NULL,
 `officer_uids` VARCHAR(1000) DEFAULT NULL,
 `remitted` INT(13) DEFAULT '0',
 `due` INT(13) DEFAULT '0',
 `collect` INT(13) DEFAULT '0',
 `wait` INT(13) DEFAULT '0',
 `offline` INT(13) DEFAULT '0',
 PRIMARY KEY (`iid`),
 KEY `SEARCH` (`iid`,`mode`,`currency`,`items`,`remittion`)
) ENGINE=INNODB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8
function NonePaidXpaymentHook($invoice)
Called when Remittence enumerator is set to None on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_none.tpl
Subject: _XPY_EMAIL_PAID_NONE_SUBJECT
function NoneUnpaidXpaymentHook($invoice)
Called when Remittence enumerator is set to None on an invoice and the Invoice is marked Unpaid – see cron.
Template: xpayment_invoice_unpaid_none.tpl
Subject: _XPY_EMAIL_UNPAID_NONE_SUBJECT
function NoneCancelXpaymentHook($invoice)
Called when Remittence enumerator is set to None on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_none.tpl
Subject: _XPY_EMAIL_CANCELLED_NONE_SUBJECT
function PendingPaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Pending on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_pending.tpl
Subject: _XPY_EMAIL_PAID_PENDING_SUBJECT
function PendingUnpaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Pending on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_pending.tpl
Subject: _XPY_EMAIL_UNPAID_PENDING_SUBJECT
function PendingCancelXpaymentHook($invoice)
Called when Remittence enumerator is set to Pending on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_pending.tpl
Subject: _XPY_EMAIL_CANCELLED_PENDING_SUBJECT
function NoticePaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Notice normally when it is over due on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_notice.tpl
Subject: _XPY_EMAIL_PAID_NOTICE_SUBJECT
function NoticeUnpaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Notice normally when it is over due on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_notice.tpl
Subject: _XPY_EMAIL_UNPAID_NOTICE_SUBJECT
function NoticeCancelXpaymentHook($invoice)
Called when Remittence enumerator is set to Notice normally when it is over due on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_notice.tpl
Subject: _XPY_EMAIL_CANCELLED_NOTICE_SUBJECT
function CollectPaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Collect normally when it is overdue and past collection date by cron on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_collect.tpl
Subject: _XPY_EMAIL_PAID_COLLECT_SUBJECT
function CollectUnpaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Collect normally when it is overdue and past collection date by cron on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_collect.tpl
Subject: _XPY_EMAIL_UNPAID_COLLECT_SUBJECT
function CollectCancelXpaymentHook($invoice)
Called when Remittence enumerator is set to Collect normally when it is overdue and past collection on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_collect.tpl
Subject: _XPY_EMAIL_CANCELLED_COLLECT_SUBJECT
function FraudPaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Fraud by payment gateway normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_fraud.tpl
Subject: _XPY_EMAIL_PAID_FRAUD_SUBJECT
function FraudUnpaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Fraud by payment gateway normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_fraud.tpl
Subject: _XPY_EMAIL_UNPAID_FRAUD_SUBJECT
function FraudCancelXpaymentHook($invoice)
Called when Remittence enumerator is set to Fraud by payment gateway normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_fraud.tpl
Subject: _XPY_EMAIL_CANCELLED_FRAUD_SUBJECT
function SettledPaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Settled by payment gateway normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_settled.tpl
Subject: _XPY_EMAIL_PAID_SETTLED_SUBJECT
function SettledUnpaidXpaymentHook($invoice)
Called when Remittence enumerator is set to Settled by payment gateway normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_settled.tpl
Subject: _XPY_EMAIL_UNPAID_SETTLED_SUBJECT
function SettledCancelXpaymentHook($invoice)
Called when Remittence enumerator is set to Settled by payment gateway normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_settled.tpl
Subject: _XPY_EMAIL_CANCELLED_SETTLED_SUBJECT
Warehouse/PLC Logic/Pick & Pack Scripts - Item by Item - Invoice Plugin Functions
Warehouse functions are called from the xpayment_invoice as well as the xpayment_invoice_item table, the function consist of the xpayment_invoice_items .mode enumerator then the xpayment_invoice .mode field, filename and enscapulation. For ModeModeFilenameItemHook($item, $invoice).
CREATE TABLE `xpayment_invoice_items` (
 `iiid` INT(26) UNSIGNED NOT NULL AUTO_INCREMENT,
 `iid` INT(15) UNSIGNED NOT NULL,
 `cat` VARCHAR(255) DEFAULT NULL,
2 `name` VARCHAR(255) DEFAULT NULL,
 `amount` DECIMAL(19,4) DEFAULT '0.0000',
 `quantity` INT(6) DEFAULT '0',
 `shipping` DECIMAL(15,2) DEFAULT '0.00',
 `handling` DECIMAL(15,2) DEFAULT '0.00',
 `weight` DECIMAL(15,6) DEFAULT '0.000000',
 `tax` DECIMAL(15,2) DEFAULT '0.00',
 `description` VARCHAR(5000) DEFAULT NULL,
 `mode` ENUM('PURCHASED','REFUNDED','UNDELIEVED','DAMAGED','EXPRESS') NOT NULL DEFAULT 'PURCHASED',
 `created` INT(13) DEFAULT '0',
 `updated` INT(13) DEFAULT '0',
 `actioned` INT(13) DEFAULT '0',
 PRIMARY KEY (`iiid`),
 KEY `SEARCH` (`iid`,`cat`(12),`name`(12))
) ENGINE=INNODB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8
CREATE TABLE `xpayment_invoice` (
 `iid` INT(15) UNSIGNED NOT NULL AUTO_INCREMENT,
 `mode` ENUM('PAID','UNPAID','CANCEL') NOT NULL DEFAULT 'UNPAID',
 `plugin` VARCHAR(128) NOT NULL,
 `return` VARCHAR(1000) NOT NULL,
 `cancel` VARCHAR(1000) NOT NULL,
 `ipn` VARCHAR(1000) NOT NULL,
 `invoicenumber` VARCHAR(64) DEFAULT NULL,
 `drawfor` VARCHAR(255) DEFAULT NULL,
 `drawto` VARCHAR(255) NOT NULL,
 `drawto_email` VARCHAR(255) NOT NULL,
 `paid` DECIMAL(15,2) DEFAULT '0.00',
 `amount` DECIMAL(15,2) DEFAULT '0.00',
 `grand` DECIMAL(15,2) DEFAULT '0.00',
 `shipping` DECIMAL(15,2) DEFAULT '0.00',
 `handling` DECIMAL(15,2) DEFAULT '0.00',
 `weight` DECIMAL(15,2) DEFAULT '0.00',
 `weight_unit` ENUM('lbs','kgs') DEFAULT 'kgs',
 `tax` DECIMAL(15,2) DEFAULT '0.00',
 `currency` VARCHAR(3) DEFAULT 'AUD',
 `items` INT(12) DEFAULT '0',
 `key` VARCHAR(255) DEFAULT NULL,
 `transactionid` VARCHAR(255) DEFAULT NULL,
 `gateway` VARCHAR(128) DEFAULT NULL,
 `created` INT(13) DEFAULT '0',
 `updated` INT(13) DEFAULT '0',
 `actioned` INT(13) DEFAULT '0',
 `reoccurrence` INT(8) DEFAULT '0',
 `reoccurrence_period_days` INT(8) DEFAULT '0',
 `reoccurrences` INT(8) DEFAULT '0',
 `occurrence` INT(13) DEFAULT '0',
 `previous` INT(13) DEFAULT '0',
 `occurrence_amount` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_grand` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_shipping` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_handling` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_tax` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_weight` DECIMAL(15,6) DEFAULT '0.000000',
 `remittion` ENUM('NONE','PENDING','NOTICE','COLLECT','FRAUD','SETTLED') NOT NULL DEFAULT 'NONE',
 `remittion_settled` DECIMAL(15,2) DEFAULT '0.00',
 `donation` TINYINT(2) DEFAULT '0',
 `comment` VARCHAR(5000) DEFAULT NULL,
 `user_ip` VARCHAR(128) DEFAULT NULL,
 `user_netaddy` VARCHAR(255) DEFAULT NULL,
 `user_uid` INT(13) DEFAULT '0',
 `user_uids` VARCHAR(1000) DEFAULT NULL,
 `broker_uids` VARCHAR(1000) DEFAULT NULL,
 `accounts_uids` VARCHAR(1000) DEFAULT NULL,
 `officer_uids` VARCHAR(1000) DEFAULT NULL,
 `remitted` INT(13) DEFAULT '0',
 `due` INT(13) DEFAULT '0',
 `collect` INT(13) DEFAULT '0',
 `wait` INT(13) DEFAULT '0',
 `offline` INT(13) DEFAULT '0',
 PRIMARY KEY (`iid`),
 KEY `SEARCH` (`iid`,`mode`,`currency`,`items`,`remittion`)
) ENGINE=INNODB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8
function PurchasedPaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Purchased by payment gateway or invoice handler normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_purchased.tpl
Subject: _XPY_EMAIL_PAID_PURCHASED_SUBJECT
function PurchasedUnpaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Purchased by payment gateway or invoice handler normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_purchased.tpl
Subject: _XPY_EMAIL_UNPAID_PURCHASED_SUBJECT
function PurchasedCancelXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Purchased by payment gateway or invoice handler normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_purchased.tp
Subject: _XPY_EMAIL_CANCELLED_PURCHASED_SUBJECT
function RefundedPaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Refunded by payment gateway or invoice handler normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_refunded.tpl
Subject: _XPY_EMAIL_PAID_REFUNDED_SUBJECT
function RefundedUnpaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Refunded by payment gateway or invoice handler normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_refunded.tpl
Subject: _XPY_EMAIL_UNPAID_REFUNDED_SUBJECT
function RefundedCancelXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Refunded by payment gateway or invoice handler normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_refunded.tpl
Subject: _XPY_EMAIL_CANCELLED_REFUNDED_SUBJECT
function UndelievedPaidXpaymentItemHook($items, $invoice)
Called when Item enumerator is set to Undelievered by payment gateway or invoice handler normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_undelieved.tpl
Subject: _XPY_EMAIL_PAID_UNDELIEVED_SUBJECT
function UndelievedUnpaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Undelievered by payment gateway or invoice handler normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_undelieved.tpl
Subject: _XPY_EMAIL_UNPAID_UNDELIEVED_SUBJECT
function UndelievedCancelXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Undelievered by payment gateway or invoice handler normally on an invoice and the Invoice is marked Cancel.
Template: xpayment_invoice_cancelled_undelieved.tpl
Subject: _XPY_EMAIL_CANCELLED_UNDELIEVED_SUBJECT
function DamagedPaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Damaged by payment gateway or invoice handler normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_damaged.tpl
Subject: _XPY_EMAIL_PAID_DAMAGED_SUBJECT
function DamagedUnpaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Damaged by payment gateway or invoice handler normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_damaged.tpl
Subject: _XPY_EMAIL_UNPAID_DAMAGED_SUBJECT
function DamagedCancelXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Damaged by payment gateway or invoice handler normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_damaged.tpl
Subject: _XPY_EMAIL_CANCELLED_DAMAGED_SUBJECT
function ExpressPaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Express by payment gateway or invoice handler normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_paid_express.tpl
Subject: _XPY_EMAIL_PAID_EXPRESS_SUBJECT
function ExpressUnpaidXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Express by payment gateway or invoice handler normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_unpaid_express.tpl
Subject: _XPY_EMAIL_UNPAID_EXPRESS_SUBJECT
function ExpressCancelXpaymentItemHook($item, $invoice)
Called when Item enumerator is set to Express by payment gateway or invoice handler normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_cancelled_express.tpl
Subject: _XPY_EMAIL_CANCELLED_EXPRESS_SUBJECT
 
Transaction Plugin Functions
Transaction functions are called from the xpayment_invoice as well as the xpayment_invoice_transactions table, the function consist of the xpayment_invoice_transactions.mode enumerator then the xpayment_invoice .mode field, filename and enscapulation. For ModeModeFilenameTransactionHook($transaction, $invoice).
CREATE TABLE `xpayment_invoice_transactions` (
 `tiid` INT(28) UNSIGNED NOT NULL AUTO_INCREMENT,
 `iid` INT(23) UNSIGNED NOT NULL,
 `transactionid` VARCHAR(255) DEFAULT NULL,
 `email` VARCHAR(255) DEFAULT NULL,
 `invoice` VARCHAR(255) DEFAULT NULL,
 `custom` VARCHAR(255) DEFAULT NULL,
 `status` VARCHAR(255) DEFAULT NULL,
 `date` INT(13) DEFAULT '0',
 `gross` DECIMAL(15,2) DEFAULT '0.00',
 `fee` DECIMAL(15,2) DEFAULT '0.00',
 `settle` DECIMAL(15,2) DEFAULT '0.00',
 `exchangerate` VARCHAR(128) DEFAULT NULL,
 `firstname` VARCHAR(255) DEFAULT NULL,
 `lastname` VARCHAR(255) DEFAULT NULL,
 `street` VARCHAR(255) DEFAULT NULL,
 `city` VARCHAR(255) DEFAULT NULL,
 `state` VARCHAR(255) DEFAULT NULL,
 `postcode` VARCHAR(255) DEFAULT NULL,
 `country` VARCHAR(255) DEFAULT NULL,
 `address_status` VARCHAR(255) DEFAULT NULL,
 `payer_email` VARCHAR(255) DEFAULT NULL,
 `payer_status` VARCHAR(255) DEFAULT NULL,
 `gateway` VARCHAR(128) DEFAULT NULL,
 `plugin` VARCHAR(128) DEFAULT NULL,
 `mode` ENUM('PAYMENT','REFUND','PENDING','NOTICE','OTHER') NOT NULL DEFAULT 'PAYMENT',
 PRIMARY KEY (`tiid`)
) ENGINE=INNODB DEFAULT CHARSET=utf8
CREATE TABLE `xpayment_invoice` (
 `iid` INT(15) UNSIGNED NOT NULL AUTO_INCREMENT,
 `mode` ENUM('PAID','UNPAID','CANCEL') NOT NULL DEFAULT 'UNPAID',
 `plugin` VARCHAR(128) NOT NULL,
 `return` VARCHAR(1000) NOT NULL,
 `cancel` VARCHAR(1000) NOT NULL,
 `ipn` VARCHAR(1000) NOT NULL,
 `invoicenumber` VARCHAR(64) DEFAULT NULL,
 `drawfor` VARCHAR(255) DEFAULT NULL,
 `drawto` VARCHAR(255) NOT NULL,
 `drawto_email` VARCHAR(255) NOT NULL,
 `paid` DECIMAL(15,2) DEFAULT '0.00',
 `amount` DECIMAL(15,2) DEFAULT '0.00',
 `grand` DECIMAL(15,2) DEFAULT '0.00',
 `shipping` DECIMAL(15,2) DEFAULT '0.00',
 `handling` DECIMAL(15,2) DEFAULT '0.00',
 `weight` DECIMAL(15,2) DEFAULT '0.00',
 `weight_unit` ENUM('lbs','kgs') DEFAULT 'kgs',
 `tax` DECIMAL(15,2) DEFAULT '0.00',
 `currency` VARCHAR(3) DEFAULT 'AUD',
 `items` INT(12) DEFAULT '0',
 `key` VARCHAR(255) DEFAULT NULL,
 `transactionid` VARCHAR(255) DEFAULT NULL,
 `gateway` VARCHAR(128) DEFAULT NULL,
 `created` INT(13) DEFAULT '0',
 `updated` INT(13) DEFAULT '0',
 `actioned` INT(13) DEFAULT '0',
 `reoccurrence` INT(8) DEFAULT '0',
 `reoccurrence_period_days` INT(8) DEFAULT '0',
 `reoccurrences` INT(8) DEFAULT '0',
 `occurrence` INT(13) DEFAULT '0',
 `previous` INT(13) DEFAULT '0',
 `occurrence_amount` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_grand` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_shipping` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_handling` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_tax` DECIMAL(15,2) DEFAULT '0.00',
 `occurrence_weight` DECIMAL(15,6) DEFAULT '0.000000',
 `remittion` ENUM('NONE','PENDING','NOTICE','COLLECT','FRAUD','SETTLED') NOT NULL DEFAULT 'NONE',
 `remittion_settled` DECIMAL(15,2) DEFAULT '0.00',
 `donation` TINYINT(2) DEFAULT '0',
 `comment` VARCHAR(5000) DEFAULT NULL,
 `user_ip` VARCHAR(128) DEFAULT NULL,
 `user_netaddy` VARCHAR(255) DEFAULT NULL,
 `user_uid` INT(13) DEFAULT '0',
 `user_uids` VARCHAR(1000) DEFAULT NULL,
 `broker_uids` VARCHAR(1000) DEFAULT NULL,
 `accounts_uids` VARCHAR(1000) DEFAULT NULL,
 `officer_uids` VARCHAR(1000) DEFAULT NULL,
 `remitted` INT(13) DEFAULT '0',
 `due` INT(13) DEFAULT '0',
 `collect` INT(13) DEFAULT '0',
 `wait` INT(13) DEFAULT '0',
 `offline` INT(13) DEFAULT '0',
 PRIMARY KEY (`iid`),
 KEY `SEARCH` (`iid`,`mode`,`currency`,`items`,`remittion`)
) ENGINE=INNODB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8
function PaymentPaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Payment by payment gateway normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_transaction_paid_payment.tpl
Subject: _XPY_EMAIL_PAID_TRANSACTION_PAYMENT_SUBJECT
function PaymentUnpaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Payment by payment gateway normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_transaction_unpaid_payment.tpl
Subject: _XPY_EMAIL_UNPAID_TRANSACTION_PAYMENT_SUBJECT
function PaymentCancelXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Payment by payment gateway normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_transaction_cancelled_payment.tpl
Subject: _XPY_EMAIL_CANCELLED_TRANSACTION_PAYMENT_SUBJECT
function RefundPaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Refund by payment gateway normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_transaction_paid_refund.tpl
Subject: _XPY_EMAIL_PAID_TRANSACTION_REFUND_SUBJECT
function RefundUnpaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Refund by payment gateway normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_transaction_unpaid_refund.tpl
Subject: _XPY_EMAIL_UNPAID_TRANSACTION_REFUND_SUBJECT
function RefundCancelXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Refund by payment gateway normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_transaction_cancelled_refund.tpl
Subject: _XPY_EMAIL_CANCELLED_TRANSACTION_REFUND_SUBJECT
function PendingPaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Pending by payment gateway normally on an invoice and the Invoice is marked Paid.
Template: xpayment_invoice_transaction_paid_pending.tpl
Subject: _XPY_EMAIL_PAID_TRANSACTION_PENDING_SUBJECT
function PendingUnpaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Pending by payment gateway normally on an invoice and the Invoice is marked Unpaid.
Template: xpayment_invoice_transaction_unpaid_pending.tpl
Subject: _XPY_EMAIL_UNPAID_TRANSACTION_PENDING_SUBJECT
function PendingCancelXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Pending by payment gateway normally on an invoice and the Invoice is marked Cancelled.
Template: xpayment_invoice_transaction_cancelled_pending.tpl
Subject: _XPY_EMAIL_CANCELLED_TRANSACTION_PENDING_SUBJECT
function NoticePaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Notice by payment gateway normally on an invoice and the Invoice is marked Paid. (For System Messages)
Template: xpayment_invoice_transaction_paid_notice.tpl
Subject: _XPY_EMAIL_PAID_TRANSACTION_NOTICE_SUBJECT
function NoticeUnpaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Notice by payment gateway normally on an invoice and the Invoice is marked Unpaid. (For System Messages)
Template: xpayment_invoice_transaction_unpaid_notice.tpl
Subject: _XPY_EMAIL_UNPAID_TRANSACTION_NOTICE_SUBJECT
function NoticeCancelXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Notice by payment gateway normally on an invoice and the Invoice is marked Cancelled. (For System Messages)
Template: xpayment_invoice_transaction_cancelled_notice.tpl
Subject: _XPY_EMAIL_CANCELLED_TRANSACTION_NOTICE_SUBJECT
function OtherPaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Other by payment gateway normally on an invoice and the Invoice is marked Paid. (For Other Purposes, generic message)
Template: xpayment_invoice_transaction_paid_other.tpl
Subject: _XPY_EMAIL_PAID_TRANSACTION_OTHER_SUBJECT
function OtherUnpaidXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Other by payment gateway normally on an invoice and the Invoice is marked Unpaid. (For Other Purposes, generic message)
Template: xpayment_invoice_transaction_unpaid_other.tpl
Subject: _XPY_EMAIL_UNPAID_TRANSACTION_OTHER_SUBJECT
function OtherCancelXpaymentTransactionHook($transaction, $invoice)
Called when transaction enumerator is set to Other by payment gateway normally on an invoice and the Invoice is marked Cancel. (For Other Purposes, generic message)
Template: xpayment_invoice_transaction_cancelled_other.tpl
Subject: _XPY_EMAIL_CANCELLED_TRANSACTION_OTHER_SUBJECT