From eb33a5938c7af81c844669cb0098222c262b6333 Mon Sep 17 00:00:00 2001
From: Thomas Hernandez
Date: Fri, 10 Jun 2016 18:33:28 -0400
Subject: [PATCH 1/4] Added Finance API classes
---
environment.php | 4 +
includes/classes/AmazonFinanceCore.php | 57 +
includes/classes/AmazonFinancialEventList.php | 984 ++++++++++++++++++
includes/classes/AmazonFinancialGroupList.php | 274 +++++
4 files changed, 1319 insertions(+)
create mode 100644 includes/classes/AmazonFinanceCore.php
create mode 100644 includes/classes/AmazonFinancialEventList.php
create mode 100644 includes/classes/AmazonFinancialGroupList.php
diff --git a/environment.php b/environment.php
index 70343206..800ef873 100644
--- a/environment.php
+++ b/environment.php
@@ -28,6 +28,7 @@
//Version numbers for cores
$AMAZON_VERSION_FEEDS = '2009-01-01';
+$AMAZON_VERSION_FINANCE = '2015-05-01';
$AMAZON_VERSION_INBOUND = '2010-10-01';
$AMAZON_VERSION_INVENTORY = '2010-10-01';
$AMAZON_VERSION_MERCHANT = '2015-06-01';
@@ -100,5 +101,8 @@
//Recommendations
$THROTTLE_LIMIT_RECOMMEND = 8;
$THROTTLE_TIME_RECOMMEND = 2;
+//Recommendations
+$THROTTLE_LIMIT_FINANCE = 30;
+$THROTTLE_TIME_FINANCE = 2;
?>
diff --git a/includes/classes/AmazonFinanceCore.php b/includes/classes/AmazonFinanceCore.php
new file mode 100644
index 00000000..cd582ba9
--- /dev/null
+++ b/includes/classes/AmazonFinanceCore.php
@@ -0,0 +1,57 @@
+Name for the store you want to use.
+ * This parameter is optional if only one store is defined in the config file.
+ * @param boolean $mock [optional] This is a flag for enabling Mock Mode.
+ * This defaults to FALSE.
+ * @param array|string $m [optional] The files (or file) to use in Mock Mode.
+ * @param string $config [optional] An alternate config file to set. Used for testing.
+ */
+ public function __construct($s = null, $mock = false, $m = null, $config = null){
+ parent::__construct($s, $mock, $m, $config);
+ include($this->env);
+
+ if(isset($AMAZON_VERSION_FINANCE)){
+ $this->urlbranch = 'Finances/'.$AMAZON_VERSION_FINANCE;
+ $this->options['Version'] = $AMAZON_VERSION_FINANCE;
+ }
+
+ if(isset($THROTTLE_LIMIT_FINANCE)) {
+ $this->throttleLimit = $THROTTLE_LIMIT_FINANCE;
+ }
+ if(isset($THROTTLE_TIME_FINANCE)) {
+ $this->throttleTime = $THROTTLE_TIME_FINANCE;
+ }
+ $this->throttleGroup = 'Finance';
+ }
+}
diff --git a/includes/classes/AmazonFinancialEventList.php b/includes/classes/AmazonFinancialEventList.php
new file mode 100644
index 00000000..e07dd345
--- /dev/null
+++ b/includes/classes/AmazonFinancialEventList.php
@@ -0,0 +1,984 @@
+tokenFlag;
+ }
+
+ /**
+ * Sets whether or not the object should automatically use tokens if it receives one.
+ *
+ * If this option is set to TRUE, the object will automatically perform
+ * the necessary operations to retrieve the rest of the list using tokens. If
+ * this option is off, the object will only ever retrieve the first section of
+ * the list.
+ * @param boolean $b [optional] Defaults to TRUE
+ * @return boolean FALSE if improper input
+ */
+ public function setUseToken($b = true) {
+ if (is_bool($b)) {
+ $this->tokenUseFlag = $b;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Sets the maximum number of responses per page. (Optional)
+ *
+ * This method sets the maximum number of Financial Events for Amazon to return per page.
+ * If this parameter is not set, Amazon will send 100 at a time.
+ * @param int $num Positive integer from 1 to 100.
+ * @return boolean FALSE if improper input
+ */
+ public function setMaxResultsPerPage($num){
+ if (is_numeric($num) && $num <= 100 && $num >= 1){
+ $this->options['MaxResultsPerPage'] = $num;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Sets the order ID filter. (Optional)
+ *
+ * If this parameter is set, Amazon will only return Financial Events that
+ * relate to the given order. If this parameter is not set, Amazon will
+ * return all Financial Events that meet the other filters.
+ * If this parameter is set, the group ID and time range options will be removed.
+ * @param string $s Amazon Order ID in 3-7-7 format
+ * @return boolean FALSE if improper input
+ */
+ public function setOrderFilter($s){
+ if ($s && is_string($s)) {
+ $this->resetFilters();
+ $this->options['AmazonOrderId'] = $s;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Sets the financial event group ID filter. (Optional)
+ *
+ * If this parameter is set, Amazon will only return Financial Events that
+ * belong to the given financial event group. If this parameter is not set,
+ * Amazon will return all Financial Events that meet the other filters.
+ * If this parameter is set, the order ID and time range options will be removed.
+ * @param string $s Financial Event Group ID
+ * @return boolean FALSE if improper input
+ */
+ public function setGroupFilter($s){
+ if ($s && is_string($s)) {
+ $this->resetFilters();
+ $this->options['FinancialEventGroupId'] = $s;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Sets the time frame options. (Optional)
+ *
+ * This method sets the start and end times for the next request. If this
+ * parameter is set, Amazon will only return Financial Events posted
+ * between the two times given. If these parameters are not set, Amazon will
+ * return all Financial Events that meet the other filters.
+ * The parameters are passed through strtotime, so values such as "-1 hour" are fine.
+ * If this parameter is set, the order ID and group ID options will be removed.
+ * @param string $s A time string for the earliest time.
+ * @param string $e [optional] A time string for the latest time.
+ * @return boolean FALSE if improper input
+ */
+ public function setTimeLimits($s, $e = null) {
+ if (empty($s)) {
+ return FALSE;
+ }
+ $this->resetFilters();
+
+ $times = $this->genTime($s);
+ $this->options['PostedAfter'] = $times;
+ if (!empty($e)) {
+ $timee = $this->genTime($e);
+ $this->options['PostedBefore'] = $timee;
+ }
+ }
+
+ /**
+ * Removes time limit options.
+ *
+ * Use this in case you change your mind and want to remove the time limit
+ * parameters you previously set.
+ */
+ public function resetTimeLimits(){
+ unset($this->options['PostedAfter']);
+ unset($this->options['PostedBefore']);
+ }
+
+ /**
+ * Removes all filter options.
+ *
+ * Use this in case you change your mind and want to remove all filter
+ * parameters you previously set.
+ */
+ public function resetFilters(){
+ unset($this->options['AmazonOrderId']);
+ unset($this->options['FinancialEventGroupId']);
+ $this->resetTimeLimits();
+ }
+
+ /**
+ * Fetches the inventory supply list from Amazon.
+ *
+ * Submits a ListFinancialEvents request to Amazon. Amazon will send
+ * the list back as a response, which can be retrieved using getEvents.
+ * Other methods are available for fetching specific values from the list.
+ * This operation can potentially involve tokens.
+ * @param boolean $r [optional] When set to FALSE, the function will not recurse, defaults to TRUE
+ * @return boolean FALSE if something goes wrong
+ */
+ public function fetchEventList($r = true) {
+ $this->prepareToken();
+
+ $url = $this->urlbase.$this->urlbranch;
+
+ $query = $this->genQuery();
+
+ $path = $this->options['Action'].'Result';
+
+ if ($this->mockMode) {
+ $xml = $this->fetchMockFile()->$path;
+ } else {
+ $response = $this->sendRequest($url, array('Post' => $query));
+
+ if (!$this->checkResponse($response)) {
+ return false;
+ }
+
+ $xml = simplexml_load_string($response['body'])->$path;
+ }
+
+ $this->parseXml($xml->FinancialEvents);
+
+ $this->checkToken($xml);
+
+ if ($this->tokenFlag && $this->tokenUseFlag && $r === true) {
+ while ($this->tokenFlag) {
+ $this->log("Recursively fetching more Financial Events");
+ $this->fetchEventList(false);
+ }
+ }
+ }
+
+ /**
+ * Sets up options for using tokens.
+ *
+ * This changes key options for switching between simply fetching a list and
+ * fetching the rest of a list using a token. Please note: because the
+ * operation for using tokens does not use any other parameters, all other
+ * parameters will be removed.
+ */
+ protected function prepareToken() {
+ if ($this->tokenFlag && $this->tokenUseFlag) {
+ $this->options['Action'] = 'ListFinancialEventsByNextToken';
+ unset($this->options['MaxResultsPerPage']);
+ $this->resetFilters();
+ } else {
+ $this->options['Action'] = 'ListFinancialEvents';
+ unset($this->options['NextToken']);
+ $this->list = array();
+ }
+ }
+
+ /**
+ * Parses XML response into array.
+ *
+ * This is what reads the response XML and converts it into an array.
+ * @param SimpleXMLElement $xml The XML response from Amazon.
+ * @return boolean FALSE if no XML data is found
+ */
+ protected function parseXml($xml) {
+ if (!$xml) {
+ return false;
+ }
+ if (isset($xml->ShipmentEvents)) {
+ foreach($xml->ShipmentEvents->children() as $x) {
+ $this->list['Shipment'][] = $this->parseShipmentEvent($x);
+ }
+ }
+ if (isset($xml->RefundEvents)) {
+ foreach($xml->RefundEvents->children() as $x) {
+ $this->list['Refund'][] = $this->parseShipmentEvent($x);
+ }
+ }
+ if (isset($xml->GuaranteeClaimEvents)) {
+ foreach($xml->GuaranteeClaimEvents->children() as $x) {
+ $this->list['GuaranteeClaim'][] = $this->parseShipmentEvent($x);
+ }
+ }
+ if (isset($xml->ChargebackEvents)) {
+ foreach($xml->ChargebackEvents->children() as $x) {
+ $this->list['Chargeback'][] = $this->parseShipmentEvent($x);
+ }
+ }
+ if (isset($xml->PayWithAmazonEvents)) {
+ foreach($xml->PayWithAmazonEvents->children() as $x) {
+ $temp = array();
+ $temp['SellerOrderId'] = (string)$x->SellerOrderId;
+ $temp['TransactionPostedDate'] = (string)$x->TransactionPostedDate;
+ $temp['BusinessObjectType'] = (string)$x->BusinessObjectType;
+ $temp['SalesChannel'] = (string)$x->SalesChannel;
+ $temp['Charge'] = $this->parseCharge($x->Charge);
+ if (isset($x->FeeList)) {
+ foreach($xml->FeeList->children() as $z) {
+ $temp['FeeList'][] = $this->parseFee($z);
+ }
+ }
+ $temp['PaymentAmountType'] = (string)$x->PaymentAmountType;
+ $temp['AmountDescription'] = (string)$x->AmountDescription;
+ $temp['FulfillmentChannel'] = (string)$x->FulfillmentChannel;
+ $temp['StoreName'] = (string)$x->StoreName;
+ $this->list['PayWithAmazon'][] = $temp;
+ }
+ }
+ if (isset($xml->ServiceProviderCreditEvents)) {
+ foreach($xml->ServiceProviderCreditEvents->children() as $x) {
+ $temp = array();
+ $temp['ProviderTransactionType'] = (string)$x->ProviderTransactionType;
+ $temp['SellerOrderId'] = (string)$x->SellerOrderId;
+ $temp['MarketplaceId'] = (string)$x->MarketplaceId;
+ $temp['MarketplaceCountryCode'] = (string)$x->MarketplaceCountryCode;
+ $temp['SellerId'] = (string)$x->SellerId;
+ $temp['SellerStoreName'] = (string)$x->SellerStoreName;
+ $temp['ProviderId'] = (string)$x->ProviderId;
+ $temp['ProviderStoreName'] = (string)$x->ProviderStoreName;
+ $this->list['ServiceProviderCredit'][] = $temp;
+ }
+ }
+ if (isset($xml->RetrochargeEvents)) {
+ foreach($xml->RetrochargeEvents->children() as $x) {
+ $temp = array();
+ $temp['RetrochargeEventType'] = (string)$x->RetrochargeEventType;
+ $temp['AmazonOrderId'] = (string)$x->AmazonOrderId;
+ $temp['PostedDate'] = (string)$x->PostedDate;
+ $temp['BaseTax']['Amount'] = (string)$x->BaseTax->CurrencyAmount;
+ $temp['BaseTax']['CurrencyCode'] = (string)$x->BaseTax->CurrencyCode;
+ $temp['ShippingTax']['Amount'] = (string)$x->ShippingTax->CurrencyAmount;
+ $temp['ShippingTax']['CurrencyCode'] = (string)$x->ShippingTax->CurrencyCode;
+ $temp['MarketplaceName'] = (string)$x->MarketplaceName;
+ $this->list['Retrocharge'][] = $temp;
+ }
+ }
+ if (isset($xml->RentalTransactionEvents)) {
+ foreach($xml->RentalTransactionEvents->children() as $x) {
+ $temp = array();
+ $temp['AmazonOrderId'] = (string)$x->AmazonOrderId;
+ $temp['RentalEventType'] = (string)$x->RentalEventType;
+ $temp['ExtensionLength'] = (string)$x->ExtensionLength;
+ $temp['PostedDate'] = (string)$x->PostedDate;
+ if (isset($x->RentalChargeList)) {
+ foreach($xml->RentalChargeList->children() as $z) {
+ $temp['RentalChargeList'][] = $this->parseCharge($z);
+ }
+ }
+ if (isset($x->RentalFeeList)) {
+ foreach($xml->RentalFeeList->children() as $z) {
+ $temp['RentalFeeList'][] = $this->parseFee($z);
+ }
+ }
+ $temp['MarketplaceName'] = (string)$x->MarketplaceName;
+ if (isset($x->RentalInitialValue)) {
+ $temp['RentalInitialValue']['Amount'] = (string)$x->RentalInitialValue->CurrencyAmount;
+ $temp['RentalInitialValue']['CurrencyCode'] = (string)$x->RentalInitialValue->CurrencyCode;
+ }
+ if (isset($x->RentalReimbursement)) {
+ $temp['RentalReimbursement']['Amount'] = (string)$x->RentalReimbursement->CurrencyAmount;
+ $temp['RentalReimbursement']['CurrencyCode'] = (string)$x->RentalReimbursement->CurrencyCode;
+ }
+ $this->list['RentalTransaction'][] = $temp;
+ }
+ }
+ if (isset($xml->PerformanceBondRefundEvents)) {
+ foreach($xml->PerformanceBondRefundEvents->children() as $x) {
+ $temp = array();
+ $temp['MarketplaceCountryCode'] = (string)$x->MarketplaceCountryCode;
+ $temp['Amount'] = (string)$x->Amount->CurrencyAmount;
+ $temp['CurrencyCode'] = (string)$x->Amount->CurrencyCode;
+ foreach($xml->ProductGroupList->children() as $z) {
+ $temp['ProductGroupList'][] = (string)$z;
+ }
+ $this->list['PerformanceBondRefund'][] = $temp;
+ }
+ }
+ if (isset($xml->ServiceFeeEvents)) {
+ foreach($xml->ServiceFeeEvents->children() as $x) {
+ $temp = array();
+ $temp['AmazonOrderId'] = (string)$x->AmazonOrderId;
+ $temp['FeeReason'] = (string)$x->FeeReason;
+ foreach($xml->FeeList->children() as $z) {
+ $temp['FeeList'][] = $this->parseFee($z);
+ }
+ $temp['SellerSKU'] = (string)$x->SellerSKU;
+ $temp['FnSKU'] = (string)$x->FnSKU;
+ $temp['FeeDescription'] = (string)$x->FeeDescription;
+ $temp['ASIN'] = (string)$x->ASIN;
+ $this->list['ServiceFee'][] = $temp;
+ }
+ }
+ if (isset($xml->DebtRecoveryEvents)) {
+ foreach($xml->DebtRecoveryEvents->children() as $x) {
+ $temp = array();
+ $temp['DebtRecoveryType'] = (string)$x->DebtRecoveryType;
+ $temp['RecoveryAmount']['Amount'] = (string)$x->RecoveryAmount->CurrencyAmount;
+ $temp['RecoveryAmount']['CurrencyCode'] = (string)$x->RecoveryAmount->CurrencyCode;
+ $temp['OverPaymentCredit']['Amount'] = (string)$x->OverPaymentCredit->CurrencyAmount;
+ $temp['OverPaymentCredit']['CurrencyCode'] = (string)$x->OverPaymentCredit->CurrencyCode;
+ foreach($xml->DebtRecoveryItemList->children() as $z) {
+ $ztemp = array();
+ $ztemp['RecoveryAmount']['Amount'] = (string)$z->RecoveryAmount->CurrencyAmount;
+ $ztemp['RecoveryAmount']['CurrencyCode'] = (string)$z->RecoveryAmount->CurrencyCode;
+ $ztemp['OriginalAmount']['Amount'] = (string)$z->OriginalAmount->CurrencyAmount;
+ $ztemp['OriginalAmount']['CurrencyCode'] = (string)$z->OriginalAmount->CurrencyCode;
+ $ztemp['GroupBeginDate'] = (string)$z->GroupBeginDate;
+ $ztemp['GroupEndDate'] = (string)$z->GroupEndDate;
+ $temp['DebtRecoveryItemList'][] = $ztemp;
+ }
+ foreach($xml->ChargeInstrumentList->children() as $z) {
+ $ztemp = array();
+ $ztemp['Description'] = (string)$z->Description;
+ $ztemp['Tail'] = (string)$z->Tail;
+ $ztemp['Amount'] = (string)$z->Amount->CurrencyAmount;
+ $ztemp['CurrencyCode'] = (string)$z->Amount->CurrencyCode;
+ $temp['ChargeInstrumentList'][] = $ztemp;
+ }
+ $this->list['DebtRecovery'][] = $temp;
+ }
+ }
+ if (isset($xml->LoanServicingEvents)) {
+ foreach($xml->LoanServicingEvents->children() as $x) {
+ $temp = array();
+ $temp['Amount'] = (string)$x->LoanAmount->CurrencyAmount;
+ $temp['CurrencyCode'] = (string)$x->LoanAmount->CurrencyCode;
+ $temp['SourceBusinessEventType'] = (string)$x->SourceBusinessEventType;
+ $this->list['LoanServicing'][] = $temp;
+ }
+ }
+ if (isset($xml->AdjustmentEvents)) {
+ foreach($xml->AdjustmentEvents->children() as $x) {
+ $temp = array();
+ $temp['AdjustmentType'] = (string)$x->AdjustmentType;
+ $temp['Amount'] = (string)$x->AdjustmentAmount->CurrencyAmount;
+ $temp['CurrencyCode'] = (string)$x->AdjustmentAmount->CurrencyCode;
+ foreach($xml->AdjustmentItemList->children() as $z) {
+ $ztemp = array();
+ $ztemp['Quantity'] = (string)$z->Quantity;
+ $ztemp['PerUnitAmount']['Amount'] = (string)$z->PerUnitAmount->CurrencyAmount;
+ $ztemp['PerUnitAmount']['CurrencyCode'] = (string)$z->PerUnitAmount->CurrencyCode;
+ $ztemp['TotalAmount']['Amount'] = (string)$z->TotalAmount->CurrencyAmount;
+ $ztemp['TotalAmount']['CurrencyCode'] = (string)$z->TotalAmount->CurrencyCode;
+ $ztemp['SellerSKU'] = (string)$z->SellerSKU;
+ $ztemp['FnSKU'] = (string)$z->FnSKU;
+ $ztemp['ProductDescription'] = (string)$z->ProductDescription;
+ $ztemp['ASIN'] = (string)$z->ASIN;
+ $temp['AdjustmentItemList'][] = $ztemp;
+ }
+ $this->list['Adjustment'][] = $temp;
+ }
+ }
+ }
+
+ /**
+ * Parses XML for a single shipment event into an array.
+ * @param SimpleXMLElement $xml The XML response from Amazon.
+ * @return array parsed structure from XML
+ */
+ protected function parseShipmentEvent($xml) {
+ $r = array();
+ $r['AmazonOrderId'] = (string)$xml->AmazonOrderId;
+ $r['SellerOrderId'] = (string)$xml->SellerOrderId;
+ $r['MarketplaceName'] = (string)$xml->MarketplaceName;
+ $chargeLists = array(
+ 'OrderChargeList',
+ 'OrderChargeAdjustmentList',
+ );
+ foreach ($chargeLists as $key) {
+ if (isset($xml->$key)) {
+ foreach($xml->$key->children() as $x) {
+ $r[$key][] = $this->parseCharge($x);
+ }
+ }
+ }
+ $feelists = array(
+ 'ShipmentFeeList',
+ 'ShipmentFeeAdjustmentList',
+ 'OrderFeeList',
+ 'OrderFeeAdjustmentList',
+ );
+ foreach ($feelists as $key) {
+ if (isset($xml->$key)) {
+ foreach($xml->$key->children() as $x) {
+ $r[$key][] = $this->parseFee($x);
+ }
+ }
+ }
+ if (isset($xml->DirectPaymentList)) {
+ foreach($xml->DirectPaymentList->children() as $x){
+ $temp = array();
+ $temp['DirectPaymentType'] = (string)$x->DirectPaymentType;
+ $temp['Amount'] = (string)$x->DirectPaymentAmount->CurrencyAmount;
+ $temp['CurrencyCode'] = (string)$x->DirectPaymentAmount->CurrencyCode;
+ $r['DirectPaymentList'][] = $temp;
+ }
+ }
+ $r['PostedDate'] = (string)$xml->MarketplaceName;
+ $itemLists = array(
+ 'ShipmentItemList',
+ 'ShipmentItemAdjustmentList',
+ );
+ $itemChargeLists = array(
+ 'ItemChargeList',
+ 'ItemChargeAdjustmentList',
+ );
+ $itemFeeLists = array(
+ 'ItemFeeList',
+ 'ItemFeeAdjustmentList',
+ );
+ $itemPromoLists = array(
+ 'PromotionList',
+ 'PromotionAdjustmentList',
+ );
+ foreach ($itemLists as $key) {
+ if (isset($xml->$key)) {
+ foreach($xml->$key->children() as $x) {
+ $temp = array();
+ $temp['SellerSKU'] = (string)$x->SellerSKU;
+ $temp['OrderItemId'] = (string)$x->OrderItemId;
+ if (isset($x->OrderAdjustmentItemId)) {
+ $temp['OrderAdjustmentItemId'] = (string)$x->OrderAdjustmentItemId;
+ }
+ $temp['QuantityShipped'] = (string)$x->QuantityShipped;
+ foreach ($itemChargeLists as $zkey) {
+ if (isset($x->$zkey)) {
+ foreach($x->$zkey->children() as $z) {
+ $r[$zkey][] = $this->parseFee($z);
+ }
+ }
+ }
+ foreach ($itemFeeLists as $zkey) {
+ if (isset($x->$zkey)) {
+ foreach($x->$zkey->children() as $z) {
+ $r[$zkey][] = $this->parseCharge($z);
+ }
+ }
+ }
+ foreach ($itemPromoLists as $zkey) {
+ if (isset($x->$zkey)) {
+ foreach($x->$zkey->children() as $z) {
+ $ztemp = array();
+ $ztemp['PromotionType'] = (string)$z->PromotionType;
+ $ztemp['PromotionId'] = (string)$z->PromotionId;
+ $ztemp['Amount'] = (string)$z->PromotionAmount->CurrencyAmount;
+ $ztemp['CurrencyCode'] = (string)$z->PromotionAmount->CurrencyCode;
+ $r[$zkey][] = $ztemp;
+ }
+ }
+ }
+ if (isset($x->CostOfPointsGranted)) {
+ $temp['CostOfPointsGranted']['Amount'] = (string)$x->CostOfPointsGranted->CurrencyAmount;
+ $temp['CostOfPointsGranted']['CurrencyCode'] = (string)$x->CostOfPointsGranted->CurrencyCode;
+ }
+ if (isset($x->CostOfPointsReturned)) {
+ $temp['CostOfPointsReturned']['Amount'] = (string)$x->CostOfPointsReturned->CurrencyAmount;
+ $temp['CostOfPointsReturned']['CurrencyCode'] = (string)$x->CostOfPointsReturned->CurrencyCode;
+ }
+ $r[$key][] = $temp;
+ }
+ }
+ }
+ return $r;
+ }
+
+ /**
+ * Parses XML for a single charge into an array.
+ * This structure is used many times throughout shipment events.
+ * @param SimpleXMLElement $xml The XML response from Amazon.
+ * @return array parsed structure from XML
+ */
+ protected function parseCharge($xml) {
+ $r = array();
+ $r['ChargeType'] = (string)$xml->ChargeType;
+ $r['Amount'] = (string)$xml->ChargeType->CurrencyAmount;
+ $r['CurrencyCode'] = (string)$xml->ChargeType->CurrencyCode;
+ return $r;
+ }
+
+ /**
+ * Parses XML for a single charge into an array.
+ * This structure is used many times throughout shipment events.
+ * @param SimpleXMLElement $xml The XML response from Amazon.
+ * @return array parsed structure from XML
+ */
+ protected function parseFee($xml) {
+ $r = array();
+ $r['FeeType'] = (string)$xml->FeeType;
+ $r['Amount'] = (string)$xml->FeeAmount->CurrencyAmount;
+ $r['CurrencyCode'] = (string)$xml->FeeAmount->CurrencyCode;
+ return $r;
+ }
+
+ /**
+ * Returns all financial events.
+ *
+ * The array will have the following keys:
+ *
+ * - Shipment - see getShipmentEvents
+ * - Refund - see getRefundEvents
+ * - GuaranteeClaim - see getGuaranteeClaimEvents
+ * - Chargeback - see getChargebackEvents
+ * - PayWithAmazon - see getPayWithAmazonEvents
+ * - ServiceProviderCredit - see getServiceProviderCreditEvents
+ * - Retrocharge - see getRetrochargeEvents
+ * - RentalTransaction - see getRentalTransactionEvents
+ * - PerformanceBondRefund - see getPerformanceBondRefundEvents
+ * - ServiceFee - see getServiceFeeEvents
+ * - DebtRecovery - see getDebtRecoveryEvents
+ * - LoanServicing - see getLoanServicingEvents
+ * - Adjustment - see getAdjustmentEvents
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ * @see getShipmentEvents
+ * @see getRefundEvents
+ * @see getGuaranteeClaimEvents
+ * @see getChargebackEvents
+ * @see getPayWithAmazonEvents
+ * @see getServiceProviderCreditEvents
+ * @see getRetrochargeEvents
+ * @see getRentalTransactionEvents
+ * @see getPerformanceBondRefundEvents
+ * @see getServiceFeeEvents
+ * @see getDebtRecoveryEvents
+ * @see getLoanServicingEvents
+ * @see getAdjustmentEvents
+ */
+ public function getEvents(){
+ if (isset($this->list)){
+ return $this->list;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all shipment events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - AmazonOrderId
+ * - SellerOrderId
+ * - MarketplaceName
+ * - OrderChargeList (optional) - list of charges, only for MCF COD orders
+ * - ShipmentFeeList - list of fees
+ * - OrderFeeList (optional) - list of fees, only for MCF orders
+ * - DirectPaymentList (optional) - multi-dimensional array, only for COD orders.
+ * Each array in the list has the following keys:
+ *
+ * - DirectPaymentType
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - PostedDate - ISO 8601 date format
+ *
+ *
+ * Each "charge" array has the following keys:
+ *
+ * - ChargeType
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * Each "fee" array has the following keys:
+ *
+ * - FeeType
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * Each "item" array has the following keys:
+ *
+ * - SellerSKU
+ * - OrderItemId
+ * - QuantityShipped
+ * - ItemChargeList - list of charges
+ * - ItemFeeList - list of fees
+ * - CurrencyCode - ISO 4217 currency code
+ * - PromotionList - list of promotions
+ * - CostOfPointsGranted (optional) - array
+ *
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ *
+ * Each "promotion" array has the following keys:
+ *
+ * - PromotionType
+ * - PromotionId
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getShipmentEvents(){
+ if (isset($this->list['Shipment'])){
+ return $this->list['Shipment'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all refund events.
+ *
+ * The structure for each event array is the same as in getShipmentEvents,
+ * but with the following additional keys in each "item" array:
+ *
+ * - OrderChargeAdjustmentList (optional) - list of charges, only for MCF COD orders
+ * - ShipmentFeeAdjustmentList - list of fees
+ * - OrderFeeAdjustmentList (optional) - list of fees, only for MCF orders
+ *
+ * Each "item" array will have the following additional keys:
+ *
+ * - OrderAdjustmentItemId
+ * - ItemChargeAdjustmentList - list of charges
+ * - ItemFeeAdjustmentList - list of fees
+ * - PromotionAdjustmentList - list of promotions
+ * - CostOfPointsReturned (optional) - array
+ *
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ * @see getShipmentEvents
+ */
+ public function getRefundEvents(){
+ if (isset($this->list['Refund'])){
+ return $this->list['Refund'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all guarantee claim events.
+ *
+ * The structure for each event array is the same as in getRefundEvents.
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ * @see getRefundEvents
+ */
+ public function getGuaranteeClaimEvents(){
+ if (isset($this->list['GuaranteeClaim'])){
+ return $this->list['GuaranteeClaim'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all chargeback events.
+ *
+ * The structure for each event array is the same as in getRefundEvents.
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ * @see getRefundEvents
+ */
+ public function getChargebackEvents(){
+ if (isset($this->list['Chargeback'])){
+ return $this->list['Chargeback'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all pay with Amazon events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - SellerOrderId
+ * - TransactionPostedDate - ISO 8601 date format
+ * - BusinessObjectType - "PaymentContract"
+ * - SalesChannel
+ * - Charge - array
+ *
+ * - ChargeType
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - FeeList - multi-dimensional array, each array has the following keys:
+ *
+ * - FeeType
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - PaymentAmountType - "Sales"
+ * - AmountDescription
+ * - FulfillmentChannel - "MFN" or "AFN"
+ * - StoreName
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getPayWithAmazonEvents(){
+ if (isset($this->list['PayWithAmazon'])){
+ return $this->list['PayWithAmazon'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all service provider credit events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - ProviderTransactionType - "ProviderCredit" or "ProviderCreditReversal"
+ * - SellerOrderId
+ * - MarketplaceId
+ * - MarketplaceCountryCode - two-letter country code in ISO 3166-1 alpha-2 format
+ * - SellerId
+ * - SellerStoreName
+ * - ProviderId
+ * - ProviderStoreName
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getServiceProviderCreditEvents(){
+ if (isset($this->list['ServiceProviderCredit'])){
+ return $this->list['ServiceProviderCredit'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all retrocharge events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - RetrochargeEventType -"Retrocharge" or "RetrochargeReversal"
+ * - AmazonOrderId
+ * - PostedDate - ISO 8601 date format
+ * - BaseTax - array
+ *
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - ShippingTax - array with Amount and CurrencyCode
+ * - MarketplaceName
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getRetrochargeEvents(){
+ if (isset($this->list['Retrocharge'])){
+ return $this->list['Retrocharge'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all rental transaction events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - AmazonOrderId
+ * - RentalEventType
+ * - ExtensionLength (optional)
+ * - PostedDate - ISO 8601 date format
+ * - RentalChargeList - multi-dimensional array, each with the following keys:
+ *
+ * - ChargeType
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - RentalFeeList - multi-dimensional array, each array has the following keys:
+ *
+ * - FeeType
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - MarketplaceName
+ * - RentalInitialValue (optional) - array with Amount and CurrencyCode
+ * - RentalReimbursement (optional) - array with Amount and CurrencyCode
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getRentalTransactionEvents(){
+ if (isset($this->list['RentalTransaction'])){
+ return $this->list['RentalTransaction'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all performance bond refund events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - MarketplaceCountryCode - two-letter country code in ISO 3166-1 alpha-2 format
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ * - ProductGroupList - simple array of category names
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getPerformanceBondRefundEvents(){
+ if (isset($this->list['PerformanceBondRefund'])){
+ return $this->list['PerformanceBondRefund'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all service fee events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - AmazonOrderId
+ * - FeeReason
+ * - FeeList - multi-dimensional array, each array has the following keys:
+ *
+ * - FeeType
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - SellerSKU
+ * - FnSKU
+ * - FeeDescription
+ * - ASIN
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getServiceFeeEvents(){
+ if (isset($this->list['ServiceFee'])){
+ return $this->list['ServiceFee'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all debt recovery events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - DebtRecoveryType - "DebtPayment", "DebtPaymentFailure", or "DebtAdjustment"
+ * - RecoveryAmount - array
+ *
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - OverPaymentCredit (optional) - array with Amount and CurrencyCode
+ * - DebtRecoveryItemList - multi-dimensional array, each array has the following keys:
+ *
+ * - RecoveryAmount - array with Amount and CurrencyCode
+ * - OriginalAmount - array with Amount and CurrencyCode
+ * - GroupBeginDate - ISO 8601 date format
+ * - GroupEndDate - ISO 8601 date format
+ *
+ * - ChargeInstrumentList - multi-dimensional array, each array has the following keys:
+ *
+ * - Description
+ * - Tail
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getDebtRecoveryEvents(){
+ if (isset($this->list['DebtRecovery'])){
+ return $this->list['DebtRecovery'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all loan servicing events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ * - SourceBusinessEventType - "LoanAdvance", "LoanPayment", or "LoanRefund"
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getLoanServicingEvents(){
+ if (isset($this->list['LoanServicing'])){
+ return $this->list['LoanServicing'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns all adjustment events.
+ *
+ * Each event array will have the following keys:
+ *
+ * - AdjustmentType "FBAInventoryReimbursement", "ReserveEvent", "PostageBilling", or "PostageRefund"
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ * - AdjustmentItemList - multi-dimensional array, each array has the following keys:
+ *
+ * - Quantity
+ * - PerUnitAmount - array with Amount and CurrencyCode
+ * - TotalAmount - array with Amount and CurrencyCode
+ * - SellerSKU
+ * - FnSKU
+ * - ProductDescription
+ * - ASIN
+ *
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getAdjustmentEvents(){
+ if (isset($this->list['Adjustment'])){
+ return $this->list['Adjustment'];
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/includes/classes/AmazonFinancialGroupList.php b/includes/classes/AmazonFinancialGroupList.php
new file mode 100644
index 00000000..207d3503
--- /dev/null
+++ b/includes/classes/AmazonFinancialGroupList.php
@@ -0,0 +1,274 @@
+tokenFlag;
+ }
+
+ /**
+ * Sets whether or not the object should automatically use tokens if it receives one.
+ *
+ * If this option is set to TRUE, the object will automatically perform
+ * the necessary operations to retrieve the rest of the list using tokens. If
+ * this option is off, the object will only ever retrieve the first section of
+ * the list.
+ * @param boolean $b [optional] Defaults to TRUE
+ * @return boolean FALSE if improper input
+ */
+ public function setUseToken($b = true) {
+ if (is_bool($b)) {
+ $this->tokenUseFlag = $b;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Sets the maximum number of responses per page. (Optional)
+ *
+ * This method sets the maximum number of Financial Event Groups for Amazon to return per page.
+ * If this parameter is not set, Amazon will send 100 at a time.
+ * @param int $num Positive integer from 1 to 100.
+ * @return boolean FALSE if improper input
+ */
+ public function setMaxResultsPerPage($num){
+ if (is_numeric($num) && $num <= 100 && $num >= 1){
+ $this->options['MaxResultsPerPage'] = $num;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Sets the time frame options. (Required*)
+ *
+ * This method sets the start and end times for the next request. If this
+ * parameter is set, Amazon will only return Financial Event Groups that occurred
+ * between the two times given. Only the starting time is required to fetch financial event groups.
+ * The parameters are passed through strtotime, so values such as "-1 hour" are fine.
+ * @param string $s A time string for the earliest time.
+ * @param string $e [optional] A time string for the latest time.
+ * @return boolean FALSE if improper input
+ */
+ public function setTimeLimits($s, $e = null) {
+ if (empty($s)) {
+ return FALSE;
+ }
+ $times = $this->genTime($s);
+ $this->options['FinancialEventGroupStartedAfter'] = $times;
+ if (!empty($e)) {
+ $timee = $this->genTime($e);
+ $this->options['FinancialEventGroupStartedBefore'] = $timee;
+ } else {
+ unset($this->options['FinancialEventGroupStartedBefore']);
+ }
+ }
+
+ /**
+ * Fetches a list of financial event groups from Amazon.
+ *
+ * Submits a ListFinancialEventGroups request to Amazon. In order to do this,
+ * a start date must be set. Amazon will send the list back as a response,
+ * which can be retrieved using getGroups.
+ * Other methods are available for fetching specific values from the list.
+ * This operation can potentially involve tokens.
+ * @param boolean $r [optional] When set to FALSE, the function will not recurse, defaults to TRUE
+ * @return boolean FALSE if something goes wrong
+ */
+ public function fetchGroupList($r = true) {
+ if (!array_key_exists('FinancialEventGroupStartedAfter', $this->options)) {
+ $this->log("Start date must be set in order to fetch financial event groups", 'Warning');
+ return false;
+ }
+
+ $this->prepareToken();
+
+ $url = $this->urlbase.$this->urlbranch;
+
+ $query = $this->genQuery();
+
+ $path = $this->options['Action'].'Result';
+
+ if ($this->mockMode) {
+ $xml = $this->fetchMockFile()->$path;
+ } else {
+ $response = $this->sendRequest($url, array('Post' => $query));
+
+ if (!$this->checkResponse($response)) {
+ return false;
+ }
+
+ $xml = simplexml_load_string($response['body'])->$path;
+ }
+
+ $this->parseXml($xml);
+
+ $this->checkToken($xml);
+
+ if ($this->tokenFlag && $this->tokenUseFlag && $r === true) {
+ while ($this->tokenFlag) {
+ $this->log("Recursively fetching more Financial Event Groups");
+ $this->fetchGroupList(false);
+ }
+ }
+ }
+
+ /**
+ * Sets up options for using tokens.
+ *
+ * This changes key options for switching between simply fetching a list and
+ * fetching the rest of a list using a token. Please note: because the
+ * operation for using tokens does not use any other parameters, all other
+ * parameters will be removed.
+ */
+ protected function prepareToken() {
+ if ($this->tokenFlag && $this->tokenUseFlag) {
+ $this->options['Action'] = 'ListFinancialEventGroupsByNextToken';
+ unset($this->options['MaxResultsPerPage']);
+ unset($this->options['FinancialEventGroupStartedAfter']);
+ unset($this->options['FinancialEventGroupStartedBefore']);
+ } else {
+ $this->options['Action'] = 'ListFinancialEventGroups';
+ unset($this->options['NextToken']);
+ $this->index = 0;
+ $this->list = array();
+ }
+ }
+
+ /**
+ * Parses XML response into array.
+ *
+ * This is what reads the response XML and converts it into an array.
+ * @param SimpleXMLElement $xml The XML response from Amazon.
+ * @return boolean FALSE if no XML data is found
+ */
+ protected function parseXml($xml) {
+ if (!$xml || !$xml->FinancialEventGroupList) {
+ return false;
+ }
+ foreach($xml->FinancialEventGroupList->children() as $x) {
+ $temp = array();
+ $temp['FinancialEventGroupId'] = (string)$x->FinancialEventGroupId;
+ $temp['ProcessingStatus'] = (string)$x->ProcessingStatus;
+ $temp['FundTransferStatus'] = (string)$x->FundTransferStatus;
+ $temp['OriginalTotal']['Amount'] = (string)$x->OriginalTotal->CurrencyAmount;
+ $temp['OriginalTotal']['CurrencyCode'] = (string)$x->OriginalTotal->CurrencyCode;
+ $temp['ConvertedTotal']['Amount'] = (string)$x->ConvertedTotal->CurrencyAmount;
+ $temp['ConvertedTotal']['CurrencyCode'] = (string)$x->ConvertedTotal->CurrencyCode;
+ if (isset($x->FundTransferDate)) {
+ $temp['FundTransferDate'] = (string)$x->FundTransferDate;
+ }
+ $temp['TraceId'] = (string)$x->TraceId;
+ $temp['AccountTail'] = (string)$x->AccountTail;
+ $temp['BeginningBalance']['Amount'] = (string)$x->BeginningBalance->CurrencyAmount;
+ $temp['BeginningBalance']['CurrencyCode'] = (string)$x->BeginningBalance->CurrencyCode;
+ $temp['FinancialEventGroupStart'] = (string)$x->FinancialEventGroupStart;
+ $temp['FinancialEventGroupEnd'] = (string)$x->FinancialEventGroupEnd;
+ $this->list[$this->index] = $temp;
+ $this->index++;
+ }
+ }
+
+ /**
+ * Returns all financial event groups.
+ *
+ * Each financial event group array will have the following keys:
+ *
+ * - FinancialEventGroupId
+ * - ProcessingStatus - "Open" or "Closed"
+ * - FundTransferStatus
+ * - OriginalTotal - array
+ *
+ * - Amount - number
+ * - CurrencyCode - ISO 4217 currency code
+ *
+ * - ConvertedTotal - array with the fields Amount and CurrencyCode
+ * - FundTransferDate - ISO 8601 date format
+ * - TraceId
+ * - AccountTail
+ * - BeginningBalance - array with the fields Amount and CurrencyCode
+ * - FinancialEventGroupStart - ISO 8601 date format
+ * - FinancialEventGroupEnd - ISO 8601 date format
+ *
+ * @return array|boolean multi-dimensional array, or FALSE if list not filled yet
+ */
+ public function getGroups(){
+ if (isset($this->list)){
+ return $this->list;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Iterator function
+ * @return type
+ */
+ public function current() {
+ return $this->list[$this->i];
+ }
+
+ /**
+ * Iterator function
+ */
+ public function rewind() {
+ $this->i = 0;
+ }
+
+ /**
+ * Iterator function
+ * @return type
+ */
+ public function key() {
+ return $this->i;
+ }
+
+ /**
+ * Iterator function
+ */
+ public function next() {
+ $this->i++;
+ }
+
+ /**
+ * Iterator function
+ * @return type
+ */
+ public function valid() {
+ return isset($this->list[$this->i]);
+ }
+
+}
From 31f71b4930dd930ae51cab1375daa70638b0e454 Mon Sep 17 00:00:00 2001
From: Thomas Hernandez
Date: Mon, 13 Jun 2016 10:39:22 -0400
Subject: [PATCH 2/4] Added get methods to financial group class
---
includes/classes/AmazonFinancialGroupList.php | 205 +++++++++++++++++-
1 file changed, 199 insertions(+), 6 deletions(-)
diff --git a/includes/classes/AmazonFinancialGroupList.php b/includes/classes/AmazonFinancialGroupList.php
index 207d3503..d2518932 100644
--- a/includes/classes/AmazonFinancialGroupList.php
+++ b/includes/classes/AmazonFinancialGroupList.php
@@ -183,20 +183,30 @@ protected function parseXml($xml) {
$temp = array();
$temp['FinancialEventGroupId'] = (string)$x->FinancialEventGroupId;
$temp['ProcessingStatus'] = (string)$x->ProcessingStatus;
- $temp['FundTransferStatus'] = (string)$x->FundTransferStatus;
+ if (isset($x->FundTransferStatus)) {
+ $temp['FundTransferStatus'] = (string)$x->FundTransferStatus;
+ }
$temp['OriginalTotal']['Amount'] = (string)$x->OriginalTotal->CurrencyAmount;
$temp['OriginalTotal']['CurrencyCode'] = (string)$x->OriginalTotal->CurrencyCode;
- $temp['ConvertedTotal']['Amount'] = (string)$x->ConvertedTotal->CurrencyAmount;
- $temp['ConvertedTotal']['CurrencyCode'] = (string)$x->ConvertedTotal->CurrencyCode;
+ if (isset($x->ConvertedTotal)) {
+ $temp['ConvertedTotal']['Amount'] = (string)$x->ConvertedTotal->CurrencyAmount;
+ $temp['ConvertedTotal']['CurrencyCode'] = (string)$x->ConvertedTotal->CurrencyCode;
+ }
if (isset($x->FundTransferDate)) {
$temp['FundTransferDate'] = (string)$x->FundTransferDate;
}
- $temp['TraceId'] = (string)$x->TraceId;
- $temp['AccountTail'] = (string)$x->AccountTail;
+ if (isset($x->TraceId)) {
+ $temp['TraceId'] = (string)$x->TraceId;
+ }
+ if (isset($x->AccountTail)) {
+ $temp['AccountTail'] = (string)$x->AccountTail;
+ }
$temp['BeginningBalance']['Amount'] = (string)$x->BeginningBalance->CurrencyAmount;
$temp['BeginningBalance']['CurrencyCode'] = (string)$x->BeginningBalance->CurrencyCode;
$temp['FinancialEventGroupStart'] = (string)$x->FinancialEventGroupStart;
- $temp['FinancialEventGroupEnd'] = (string)$x->FinancialEventGroupEnd;
+ if (isset($x->FinancialEventGroupEnd)) {
+ $temp['FinancialEventGroupEnd'] = (string)$x->FinancialEventGroupEnd;
+ }
$this->list[$this->index] = $temp;
$this->index++;
}
@@ -233,6 +243,189 @@ public function getGroups(){
}
}
+ /**
+ * Returns the ID for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @return string|boolean single value, or FALSE if Non-numeric index
+ */
+ public function getGroupId($i = 0) {
+ if (isset($this->list[$i]['FinancialEventGroupId'])) {
+ return $this->list[$i]['FinancialEventGroupId'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the processing status for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @return string|boolean "Open" or "Closed", or FALSE if Non-numeric index
+ */
+ public function getProcessingStatus($i = 0) {
+ if (isset($this->list[$i]['ProcessingStatus'])) {
+ return $this->list[$i]['ProcessingStatus'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the transfer status for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @return string|boolean single value, or FALSE if Non-numeric index
+ */
+ public function getTransferStatus($i = 0) {
+ if (isset($this->list[$i]['FundTransferStatus'])) {
+ return $this->list[$i]['FundTransferStatus'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the original total for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * If an array is returned, it will have the fields Amount and CurrencyCode.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @param boolean $only [optional] set to TRUE to get only the amount
+ * @return array|string|boolean array, single value, or FALSE if Non-numeric index
+ */
+ public function getOriginalTotal($i = 0, $only = false) {
+ if (isset($this->list[$i]['OriginalTotal'])) {
+ if ($only) {
+ return $this->list[$i]['OriginalTotal']['Amount'];
+ } else {
+ return $this->list[$i]['OriginalTotal'];
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the converted total for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * If an array is returned, it will have the fields Amount and CurrencyCode.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @param boolean $only [optional] set to TRUE to get only the amount
+ * @return array|string|boolean array, single value, or FALSE if Non-numeric index
+ */
+ public function getConvertedTotal($i = 0, $only = false) {
+ if (isset($this->list[$i]['ConvertedTotal'])) {
+ if ($only) {
+ return $this->list[$i]['ConvertedTotal']['Amount'];
+ } else {
+ return $this->list[$i]['ConvertedTotal'];
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the transfer date for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @return string|boolean date in ISO 8601 format, or FALSE if Non-numeric index
+ */
+ public function getTransferDate($i = 0) {
+ if (isset($this->list[$i]['FundTransferDate'])) {
+ return $this->list[$i]['FundTransferDate'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the trace ID for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @return string|boolean single value, or FALSE if Non-numeric index
+ */
+ public function getTraceId($i = 0) {
+ if (isset($this->list[$i]['TraceId'])) {
+ return $this->list[$i]['TraceId'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the account tail for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @return string|boolean single value, or FALSE if Non-numeric index
+ */
+ public function getAccountTail($i = 0) {
+ if (isset($this->list[$i]['AccountTail'])) {
+ return $this->list[$i]['AccountTail'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the balance at the beginning of the settlement period for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * If an array is returned, it will have the fields Amount and CurrencyCode.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @param boolean $only [optional] set to TRUE to get only the amount
+ * @return array|string|boolean array, single value, or FALSE if Non-numeric index
+ */
+ public function getBeginningBalance($i = 0, $only = false) {
+ if (isset($this->list[$i]['BeginningBalance'])) {
+ if ($only) {
+ return $this->list[$i]['BeginningBalance']['Amount'];
+ } else {
+ return $this->list[$i]['BeginningBalance'];
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the start date for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @return string|boolean date in ISO 8601 format, or FALSE if Non-numeric index
+ */
+ public function getStartDate($i = 0) {
+ if (isset($this->list[$i]['FinancialEventGroupStart'])) {
+ return $this->list[$i]['FinancialEventGroupStart'];
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the end date for the specified entry.
+ *
+ * This method will return FALSE if the list has not yet been filled.
+ * @param int $i [optional] List index to retrieve the value from. Defaults to 0.
+ * @return string|boolean date in ISO 8601 format, or FALSE if Non-numeric index
+ */
+ public function getEndDate($i = 0) {
+ if (isset($this->list[$i]['FinancialEventGroupEnd'])) {
+ return $this->list[$i]['FinancialEventGroupEnd'];
+ } else {
+ return false;
+ }
+ }
+
/**
* Iterator function
* @return type
From ab5745b25e33154da6192e94817cac2248b22b3a Mon Sep 17 00:00:00 2001
From: Thomas Hernandez
Date: Mon, 13 Jun 2016 15:52:50 -0400
Subject: [PATCH 3/4] Fixed financial event class with actual element names
---
includes/classes/AmazonFinancialEventList.php | 162 ++++++++++--------
1 file changed, 86 insertions(+), 76 deletions(-)
diff --git a/includes/classes/AmazonFinancialEventList.php b/includes/classes/AmazonFinancialEventList.php
index e07dd345..fa263d13 100644
--- a/includes/classes/AmazonFinancialEventList.php
+++ b/includes/classes/AmazonFinancialEventList.php
@@ -71,11 +71,11 @@ public function setMaxResultsPerPage($num){
}
/**
- * Sets the order ID filter. (Optional)
+ * Sets the order ID filter. (Required*)
*
* If this parameter is set, Amazon will only return Financial Events that
- * relate to the given order. If this parameter is not set, Amazon will
- * return all Financial Events that meet the other filters.
+ * relate to the given order. This parameter is required if none of the
+ * other filter options are set.
* If this parameter is set, the group ID and time range options will be removed.
* @param string $s Amazon Order ID in 3-7-7 format
* @return boolean FALSE if improper input
@@ -90,11 +90,11 @@ public function setOrderFilter($s){
}
/**
- * Sets the financial event group ID filter. (Optional)
+ * Sets the financial event group ID filter. (Required*)
*
* If this parameter is set, Amazon will only return Financial Events that
- * belong to the given financial event group. If this parameter is not set,
- * Amazon will return all Financial Events that meet the other filters.
+ * belong to the given financial event group. This parameter is required if
+ * none of the other filter options are set.
* If this parameter is set, the order ID and time range options will be removed.
* @param string $s Financial Event Group ID
* @return boolean FALSE if improper input
@@ -109,12 +109,12 @@ public function setGroupFilter($s){
}
/**
- * Sets the time frame options. (Optional)
+ * Sets the time frame options. (Required*)
*
* This method sets the start and end times for the next request. If this
* parameter is set, Amazon will only return Financial Events posted
- * between the two times given. If these parameters are not set, Amazon will
- * return all Financial Events that meet the other filters.
+ * between the two times given. This parameter is required if none of the
+ * other filter options are set.
* The parameters are passed through strtotime, so values such as "-1 hour" are fine.
* If this parameter is set, the order ID and group ID options will be removed.
* @param string $s A time string for the earliest time.
@@ -232,28 +232,28 @@ protected function parseXml($xml) {
if (!$xml) {
return false;
}
- if (isset($xml->ShipmentEvents)) {
- foreach($xml->ShipmentEvents->children() as $x) {
+ if (isset($xml->ShipmentEventList)) {
+ foreach($xml->ShipmentEventList->children() as $x) {
$this->list['Shipment'][] = $this->parseShipmentEvent($x);
}
}
- if (isset($xml->RefundEvents)) {
- foreach($xml->RefundEvents->children() as $x) {
+ if (isset($xml->RefundEventList)) {
+ foreach($xml->RefundEventList->children() as $x) {
$this->list['Refund'][] = $this->parseShipmentEvent($x);
}
}
- if (isset($xml->GuaranteeClaimEvents)) {
- foreach($xml->GuaranteeClaimEvents->children() as $x) {
+ if (isset($xml->GuaranteeClaimEventList)) {
+ foreach($xml->GuaranteeClaimEventList->children() as $x) {
$this->list['GuaranteeClaim'][] = $this->parseShipmentEvent($x);
}
}
- if (isset($xml->ChargebackEvents)) {
- foreach($xml->ChargebackEvents->children() as $x) {
+ if (isset($xml->ChargebackEventList)) {
+ foreach($xml->ChargebackEventList->children() as $x) {
$this->list['Chargeback'][] = $this->parseShipmentEvent($x);
}
}
- if (isset($xml->PayWithAmazonEvents)) {
- foreach($xml->PayWithAmazonEvents->children() as $x) {
+ if (isset($xml->PayWithAmazonEventList)) {
+ foreach($xml->PayWithAmazonEventList->children() as $x) {
$temp = array();
$temp['SellerOrderId'] = (string)$x->SellerOrderId;
$temp['TransactionPostedDate'] = (string)$x->TransactionPostedDate;
@@ -261,7 +261,7 @@ protected function parseXml($xml) {
$temp['SalesChannel'] = (string)$x->SalesChannel;
$temp['Charge'] = $this->parseCharge($x->Charge);
if (isset($x->FeeList)) {
- foreach($xml->FeeList->children() as $z) {
+ foreach($x->FeeList->children() as $z) {
$temp['FeeList'][] = $this->parseFee($z);
}
}
@@ -272,8 +272,8 @@ protected function parseXml($xml) {
$this->list['PayWithAmazon'][] = $temp;
}
}
- if (isset($xml->ServiceProviderCreditEvents)) {
- foreach($xml->ServiceProviderCreditEvents->children() as $x) {
+ if (isset($xml->ServiceProviderCreditEventList)) {
+ foreach($xml->ServiceProviderCreditEventList->children() as $x) {
$temp = array();
$temp['ProviderTransactionType'] = (string)$x->ProviderTransactionType;
$temp['SellerOrderId'] = (string)$x->SellerOrderId;
@@ -286,8 +286,8 @@ protected function parseXml($xml) {
$this->list['ServiceProviderCredit'][] = $temp;
}
}
- if (isset($xml->RetrochargeEvents)) {
- foreach($xml->RetrochargeEvents->children() as $x) {
+ if (isset($xml->RetrochargeEventList)) {
+ foreach($xml->RetrochargeEventList->children() as $x) {
$temp = array();
$temp['RetrochargeEventType'] = (string)$x->RetrochargeEventType;
$temp['AmazonOrderId'] = (string)$x->AmazonOrderId;
@@ -300,20 +300,20 @@ protected function parseXml($xml) {
$this->list['Retrocharge'][] = $temp;
}
}
- if (isset($xml->RentalTransactionEvents)) {
- foreach($xml->RentalTransactionEvents->children() as $x) {
+ if (isset($xml->RentalTransactionEventList)) {
+ foreach($xml->RentalTransactionEventList->children() as $x) {
$temp = array();
$temp['AmazonOrderId'] = (string)$x->AmazonOrderId;
$temp['RentalEventType'] = (string)$x->RentalEventType;
$temp['ExtensionLength'] = (string)$x->ExtensionLength;
$temp['PostedDate'] = (string)$x->PostedDate;
if (isset($x->RentalChargeList)) {
- foreach($xml->RentalChargeList->children() as $z) {
+ foreach($x->RentalChargeList->children() as $z) {
$temp['RentalChargeList'][] = $this->parseCharge($z);
}
}
if (isset($x->RentalFeeList)) {
- foreach($xml->RentalFeeList->children() as $z) {
+ foreach($x->RentalFeeList->children() as $z) {
$temp['RentalFeeList'][] = $this->parseFee($z);
}
}
@@ -329,25 +329,29 @@ protected function parseXml($xml) {
$this->list['RentalTransaction'][] = $temp;
}
}
- if (isset($xml->PerformanceBondRefundEvents)) {
- foreach($xml->PerformanceBondRefundEvents->children() as $x) {
+ if (isset($xml->PerformanceBondRefundEventList)) {
+ foreach($xml->PerformanceBondRefundEventList->children() as $x) {
$temp = array();
$temp['MarketplaceCountryCode'] = (string)$x->MarketplaceCountryCode;
$temp['Amount'] = (string)$x->Amount->CurrencyAmount;
$temp['CurrencyCode'] = (string)$x->Amount->CurrencyCode;
- foreach($xml->ProductGroupList->children() as $z) {
- $temp['ProductGroupList'][] = (string)$z;
+ if (isset($x->ProductGroupList)) {
+ foreach($x->ProductGroupList->children() as $z) {
+ $temp['ProductGroupList'][] = (string)$z;
+ }
}
$this->list['PerformanceBondRefund'][] = $temp;
}
}
- if (isset($xml->ServiceFeeEvents)) {
- foreach($xml->ServiceFeeEvents->children() as $x) {
+ if (isset($xml->ServiceFeeEventList)) {
+ foreach($xml->ServiceFeeEventList->children() as $x) {
$temp = array();
$temp['AmazonOrderId'] = (string)$x->AmazonOrderId;
$temp['FeeReason'] = (string)$x->FeeReason;
- foreach($xml->FeeList->children() as $z) {
- $temp['FeeList'][] = $this->parseFee($z);
+ if (isset($x->FeeList)) {
+ foreach($x->FeeList->children() as $z) {
+ $temp['FeeList'][] = $this->parseFee($z);
+ }
}
$temp['SellerSKU'] = (string)$x->SellerSKU;
$temp['FnSKU'] = (string)$x->FnSKU;
@@ -356,37 +360,41 @@ protected function parseXml($xml) {
$this->list['ServiceFee'][] = $temp;
}
}
- if (isset($xml->DebtRecoveryEvents)) {
- foreach($xml->DebtRecoveryEvents->children() as $x) {
+ if (isset($xml->DebtRecoveryEventList)) {
+ foreach($xml->DebtRecoveryEventList->children() as $x) {
$temp = array();
$temp['DebtRecoveryType'] = (string)$x->DebtRecoveryType;
$temp['RecoveryAmount']['Amount'] = (string)$x->RecoveryAmount->CurrencyAmount;
$temp['RecoveryAmount']['CurrencyCode'] = (string)$x->RecoveryAmount->CurrencyCode;
$temp['OverPaymentCredit']['Amount'] = (string)$x->OverPaymentCredit->CurrencyAmount;
$temp['OverPaymentCredit']['CurrencyCode'] = (string)$x->OverPaymentCredit->CurrencyCode;
- foreach($xml->DebtRecoveryItemList->children() as $z) {
- $ztemp = array();
- $ztemp['RecoveryAmount']['Amount'] = (string)$z->RecoveryAmount->CurrencyAmount;
- $ztemp['RecoveryAmount']['CurrencyCode'] = (string)$z->RecoveryAmount->CurrencyCode;
- $ztemp['OriginalAmount']['Amount'] = (string)$z->OriginalAmount->CurrencyAmount;
- $ztemp['OriginalAmount']['CurrencyCode'] = (string)$z->OriginalAmount->CurrencyCode;
- $ztemp['GroupBeginDate'] = (string)$z->GroupBeginDate;
- $ztemp['GroupEndDate'] = (string)$z->GroupEndDate;
- $temp['DebtRecoveryItemList'][] = $ztemp;
+ if (isset($x->DebtRecoveryItemList)) {
+ foreach($x->DebtRecoveryItemList->children() as $z) {
+ $ztemp = array();
+ $ztemp['RecoveryAmount']['Amount'] = (string)$z->RecoveryAmount->CurrencyAmount;
+ $ztemp['RecoveryAmount']['CurrencyCode'] = (string)$z->RecoveryAmount->CurrencyCode;
+ $ztemp['OriginalAmount']['Amount'] = (string)$z->OriginalAmount->CurrencyAmount;
+ $ztemp['OriginalAmount']['CurrencyCode'] = (string)$z->OriginalAmount->CurrencyCode;
+ $ztemp['GroupBeginDate'] = (string)$z->GroupBeginDate;
+ $ztemp['GroupEndDate'] = (string)$z->GroupEndDate;
+ $temp['DebtRecoveryItemList'][] = $ztemp;
+ }
}
- foreach($xml->ChargeInstrumentList->children() as $z) {
- $ztemp = array();
- $ztemp['Description'] = (string)$z->Description;
- $ztemp['Tail'] = (string)$z->Tail;
- $ztemp['Amount'] = (string)$z->Amount->CurrencyAmount;
- $ztemp['CurrencyCode'] = (string)$z->Amount->CurrencyCode;
- $temp['ChargeInstrumentList'][] = $ztemp;
+ if (isset($x->ChargeInstrumentList)) {
+ foreach($x->ChargeInstrumentList->children() as $z) {
+ $ztemp = array();
+ $ztemp['Description'] = (string)$z->Description;
+ $ztemp['Tail'] = (string)$z->Tail;
+ $ztemp['Amount'] = (string)$z->Amount->CurrencyAmount;
+ $ztemp['CurrencyCode'] = (string)$z->Amount->CurrencyCode;
+ $temp['ChargeInstrumentList'][] = $ztemp;
+ }
}
$this->list['DebtRecovery'][] = $temp;
}
}
- if (isset($xml->LoanServicingEvents)) {
- foreach($xml->LoanServicingEvents->children() as $x) {
+ if (isset($xml->LoanServicingEventList)) {
+ foreach($xml->LoanServicingEventList->children() as $x) {
$temp = array();
$temp['Amount'] = (string)$x->LoanAmount->CurrencyAmount;
$temp['CurrencyCode'] = (string)$x->LoanAmount->CurrencyCode;
@@ -394,24 +402,26 @@ protected function parseXml($xml) {
$this->list['LoanServicing'][] = $temp;
}
}
- if (isset($xml->AdjustmentEvents)) {
- foreach($xml->AdjustmentEvents->children() as $x) {
+ if (isset($xml->AdjustmentEventList)) {
+ foreach($xml->AdjustmentEventList->children() as $x) {
$temp = array();
$temp['AdjustmentType'] = (string)$x->AdjustmentType;
$temp['Amount'] = (string)$x->AdjustmentAmount->CurrencyAmount;
$temp['CurrencyCode'] = (string)$x->AdjustmentAmount->CurrencyCode;
- foreach($xml->AdjustmentItemList->children() as $z) {
- $ztemp = array();
- $ztemp['Quantity'] = (string)$z->Quantity;
- $ztemp['PerUnitAmount']['Amount'] = (string)$z->PerUnitAmount->CurrencyAmount;
- $ztemp['PerUnitAmount']['CurrencyCode'] = (string)$z->PerUnitAmount->CurrencyCode;
- $ztemp['TotalAmount']['Amount'] = (string)$z->TotalAmount->CurrencyAmount;
- $ztemp['TotalAmount']['CurrencyCode'] = (string)$z->TotalAmount->CurrencyCode;
- $ztemp['SellerSKU'] = (string)$z->SellerSKU;
- $ztemp['FnSKU'] = (string)$z->FnSKU;
- $ztemp['ProductDescription'] = (string)$z->ProductDescription;
- $ztemp['ASIN'] = (string)$z->ASIN;
- $temp['AdjustmentItemList'][] = $ztemp;
+ if (isset($x->AdjustmentItemList)) {
+ foreach($x->AdjustmentItemList->children() as $z) {
+ $ztemp = array();
+ $ztemp['Quantity'] = (string)$z->Quantity;
+ $ztemp['PerUnitAmount']['Amount'] = (string)$z->PerUnitAmount->CurrencyAmount;
+ $ztemp['PerUnitAmount']['CurrencyCode'] = (string)$z->PerUnitAmount->CurrencyCode;
+ $ztemp['TotalAmount']['Amount'] = (string)$z->TotalAmount->CurrencyAmount;
+ $ztemp['TotalAmount']['CurrencyCode'] = (string)$z->TotalAmount->CurrencyCode;
+ $ztemp['SellerSKU'] = (string)$z->SellerSKU;
+ $ztemp['FnSKU'] = (string)$z->FnSKU;
+ $ztemp['ProductDescription'] = (string)$z->ProductDescription;
+ $ztemp['ASIN'] = (string)$z->ASIN;
+ $temp['AdjustmentItemList'][] = $ztemp;
+ }
}
$this->list['Adjustment'][] = $temp;
}
@@ -461,7 +471,7 @@ protected function parseShipmentEvent($xml) {
$r['DirectPaymentList'][] = $temp;
}
}
- $r['PostedDate'] = (string)$xml->MarketplaceName;
+ $r['PostedDate'] = (string)$xml->PostedDate;
$itemLists = array(
'ShipmentItemList',
'ShipmentItemAdjustmentList',
@@ -491,14 +501,14 @@ protected function parseShipmentEvent($xml) {
foreach ($itemChargeLists as $zkey) {
if (isset($x->$zkey)) {
foreach($x->$zkey->children() as $z) {
- $r[$zkey][] = $this->parseFee($z);
+ $temp[$zkey][] = $this->parseCharge($z);
}
}
}
foreach ($itemFeeLists as $zkey) {
if (isset($x->$zkey)) {
foreach($x->$zkey->children() as $z) {
- $r[$zkey][] = $this->parseCharge($z);
+ $temp[$zkey][] = $this->parseFee($z);
}
}
}
@@ -510,7 +520,7 @@ protected function parseShipmentEvent($xml) {
$ztemp['PromotionId'] = (string)$z->PromotionId;
$ztemp['Amount'] = (string)$z->PromotionAmount->CurrencyAmount;
$ztemp['CurrencyCode'] = (string)$z->PromotionAmount->CurrencyCode;
- $r[$zkey][] = $ztemp;
+ $temp[$zkey][] = $ztemp;
}
}
}
@@ -538,8 +548,8 @@ protected function parseShipmentEvent($xml) {
protected function parseCharge($xml) {
$r = array();
$r['ChargeType'] = (string)$xml->ChargeType;
- $r['Amount'] = (string)$xml->ChargeType->CurrencyAmount;
- $r['CurrencyCode'] = (string)$xml->ChargeType->CurrencyCode;
+ $r['Amount'] = (string)$xml->ChargeAmount->CurrencyAmount;
+ $r['CurrencyCode'] = (string)$xml->ChargeAmount->CurrencyCode;
return $r;
}
From 803c73d58e9a77a4ec5e64ef4ab1ce741bacc4bc Mon Sep 17 00:00:00 2001
From: Thomas Hernandez
Date: Mon, 13 Jun 2016 18:54:14 -0400
Subject: [PATCH 4/4] Added tests for the new finance classes
---
.../classes/AmazonFinancialEventListTest.php | 795 ++++++++++++++
.../classes/AmazonFinancialGroupListTest.php | 335 ++++++
test-cases/mock/fetchFinancialEvents.xml | 985 ++++++++++++++++++
test-cases/mock/fetchFinancialEventsToken.xml | 669 ++++++++++++
.../mock/fetchFinancialEventsToken2.xml | 354 +++++++
test-cases/mock/fetchFinancialGroups.xml | 54 +
test-cases/mock/fetchFinancialGroupsToken.xml | 33 +
.../mock/fetchFinancialGroupsToken2.xml | 33 +
8 files changed, 3258 insertions(+)
create mode 100644 test-cases/includes/classes/AmazonFinancialEventListTest.php
create mode 100644 test-cases/includes/classes/AmazonFinancialGroupListTest.php
create mode 100644 test-cases/mock/fetchFinancialEvents.xml
create mode 100644 test-cases/mock/fetchFinancialEventsToken.xml
create mode 100644 test-cases/mock/fetchFinancialEventsToken2.xml
create mode 100644 test-cases/mock/fetchFinancialGroups.xml
create mode 100644 test-cases/mock/fetchFinancialGroupsToken.xml
create mode 100644 test-cases/mock/fetchFinancialGroupsToken2.xml
diff --git a/test-cases/includes/classes/AmazonFinancialEventListTest.php b/test-cases/includes/classes/AmazonFinancialEventListTest.php
new file mode 100644
index 00000000..3a297d94
--- /dev/null
+++ b/test-cases/includes/classes/AmazonFinancialEventListTest.php
@@ -0,0 +1,795 @@
+object = new AmazonFinancialEventList('testStore', true, null, __DIR__.'/../../test-config.php');
+ }
+
+ public function testSetUseToken(){
+ $this->assertNull($this->object->setUseToken());
+ $this->assertNull($this->object->setUseToken(true));
+ $this->assertNull($this->object->setUseToken(false));
+ $this->assertFalse($this->object->setUseToken('wrong'));
+ }
+
+ public function testSetMaxResultsPerPage(){
+ $this->assertFalse($this->object->setMaxResultsPerPage(null)); //can't be nothing
+ $this->assertFalse($this->object->setMaxResultsPerPage(-5)); //too low
+ $this->assertFalse($this->object->setMaxResultsPerPage(150)); //too high
+ $this->assertFalse($this->object->setMaxResultsPerPage(array(5, 7))); //not a valid value
+ $this->assertFalse($this->object->setMaxResultsPerPage('banana')); //what are you even doing
+ $this->assertNull($this->object->setMaxResultsPerPage(77));
+ $this->assertNull($this->object->setMaxResultsPerPage('75'));
+ $o = $this->object->getOptions();
+ $this->assertArrayHasKey('MaxResultsPerPage', $o);
+ $this->assertEquals('75', $o['MaxResultsPerPage']);
+ }
+
+ /**
+ * @return array
+ */
+ public function timeProvider() {
+ return array(
+ array(null, null, false, false), //nothing given, so no change
+ array(time(), time(), true, true), //timestamps
+ array('', '', false, false), //strings, but empty
+ array('-1 min', null, true, false), //one set
+ array(null, '-1 min', false, false), //other set
+ array('-1 min', '-1 min', true, true), //both set
+ );
+ }
+
+ /**
+ * @dataProvider timeProvider
+ */
+ public function testSetTimeLimits($a, $b, $c, $d){
+ $this->object->setOrderFilter('123-1234567-1234567');
+ $try = $this->object->setTimeLimits($a, $b);
+ $o = $this->object->getOptions();
+ if ($c) {
+ $this->assertNull($try);
+ $this->assertArrayHasKey('PostedAfter', $o);
+ $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['PostedAfter']);
+ $this->assertArrayNotHasKey('AmazonOrderId', $o);
+ } else {
+ $this->assertFalse($try);
+ $this->assertArrayNotHasKey('PostedAfter', $o);
+ $this->assertArrayHasKey('AmazonOrderId', $o);
+ }
+
+ if ($c && $d) {
+ $this->assertArrayHasKey('PostedBefore', $o);
+ $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['PostedBefore']);
+ //setting only first date resets second one
+ $this->assertNull($this->object->setTimeLimits($a));
+ $o2 = $this->object->getOptions();
+ $this->assertArrayNotHasKey('PostedBefore', $o2);
+ } else {
+ $this->assertArrayNotHasKey('PostedBefore', $o);
+ }
+ }
+
+ public function testFetchEventList() {
+ resetLog();
+ $this->object->setMock(true, 'fetchFinancialEvents.xml'); //no token
+ $this->assertNull($this->object->fetchEventList());
+
+ $check = parseLog();
+ $this->assertEquals('Single Mock File set: fetchFinancialEvents.xml', $check[1]);
+ $this->assertEquals('Fetched Mock File: mock/fetchFinancialEvents.xml', $check[2]);
+
+ $o = $this->object->getOptions();
+ $this->assertEquals('ListFinancialEvents', $o['Action']);
+
+ $this->assertFalse($this->object->hasToken());
+
+ return $this->object;
+ }
+
+ public function testFetchEventListToken1() {
+ resetLog();
+ $this->object->setMock(true, 'fetchFinancialEventsToken.xml');
+ //without using token
+ $this->assertNull($this->object->fetchEventList());
+ $check = parseLog();
+ $this->assertEquals('Single Mock File set: fetchFinancialEventsToken.xml', $check[1]);
+ $this->assertEquals('Fetched Mock File: mock/fetchFinancialEventsToken.xml', $check[2]);
+
+ $this->assertTrue($this->object->hasToken());
+ $o = $this->object->getOptions();
+ $this->assertEquals('ListFinancialEvents', $o['Action']);
+ $r = $this->object->getEvents();
+ $this->assertInternalType('array', $r);
+ foreach ($r as $x) {
+ $this->assertCount(1, $x);
+ }
+ }
+
+ public function testFetchEventListToken2() {
+ resetLog();
+ $this->object->setMock(true, array('fetchFinancialEventsToken.xml', 'fetchFinancialEventsToken2.xml'));
+
+ //with using token
+ $this->object->setUseToken();
+ $this->object->setMaxResultsPerPage(5);
+ $this->assertNull($this->object->fetchEventList());
+ $check = parseLog();
+ $this->assertEquals('Mock files array set.', $check[1]);
+ $this->assertEquals('Fetched Mock File: mock/fetchFinancialEventsToken.xml', $check[2]);
+ $this->assertEquals('Recursively fetching more Financial Events', $check[3]);
+ $this->assertEquals('Fetched Mock File: mock/fetchFinancialEventsToken2.xml', $check[4]);
+ $this->assertFalse($this->object->hasToken());
+ $o = $this->object->getOptions();
+ $this->assertEquals('ListFinancialEventsByNextToken', $o['Action']);
+ $this->assertArrayNotHasKey('FinancialEventGroupStartedAfter', $o);
+ $r = $this->object->getEvents();
+ $this->assertInternalType('array', $r);
+ foreach ($r as $x) {
+ $this->assertCount(2, $x);
+ }
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetEvents($o) {
+ $list = $o->getEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertArrayHasKey('Shipment', $list);
+ $this->assertEquals($o->getShipmentEvents(), $list['Shipment']);
+ $this->assertArrayHasKey('Refund', $list);
+ $this->assertEquals($o->getRefundEvents(), $list['Refund']);
+ $this->assertArrayHasKey('GuaranteeClaim', $list);
+ $this->assertEquals($o->getGuaranteeClaimEvents(), $list['GuaranteeClaim']);
+ $this->assertArrayHasKey('Chargeback', $list);
+ $this->assertEquals($o->getChargebackEvents(), $list['Chargeback']);
+ $this->assertArrayHasKey('PayWithAmazon', $list);
+ $this->assertEquals($o->getPayWithAmazonEvents(), $list['PayWithAmazon']);
+ $this->assertArrayHasKey('ServiceProviderCredit', $list);
+ $this->assertEquals($o->getServiceProviderCreditEvents(), $list['ServiceProviderCredit']);
+ $this->assertArrayHasKey('Retrocharge', $list);
+ $this->assertEquals($o->getRetrochargeEvents(), $list['Retrocharge']);
+ $this->assertArrayHasKey('RentalTransaction', $list);
+ $this->assertEquals($o->getRentalTransactionEvents(), $list['RentalTransaction']);
+ $this->assertArrayHasKey('PerformanceBondRefund', $list);
+ $this->assertEquals($o->getPerformanceBondRefundEvents(), $list['PerformanceBondRefund']);
+ $this->assertArrayHasKey('ServiceFee', $list);
+ $this->assertEquals($o->getServiceFeeEvents(), $list['ServiceFee']);
+ $this->assertArrayHasKey('DebtRecovery', $list);
+ $this->assertEquals($o->getDebtRecoveryEvents(), $list['DebtRecovery']);
+ $this->assertArrayHasKey('LoanServicing', $list);
+ $this->assertEquals($o->getLoanServicingEvents(), $list['LoanServicing']);
+ $this->assertArrayHasKey('Adjustment', $list);
+ $this->assertEquals($o->getAdjustmentEvents(), $list['Adjustment']);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetShipmentEvents($o) {
+ $x = array();
+ $x[0]['AmazonOrderId'] = '333-1234567-1234567';
+ $x[0]['SellerOrderId'] = '333-1234567-7654321';
+ $x[0]['MarketplaceName'] = 'amazon.com';
+ $x[0]['OrderChargeList'][0]['ChargeType'] = 'Principal';
+ $x[0]['OrderChargeList'][0]['Amount'] = '10.00';
+ $x[0]['OrderChargeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['OrderChargeList'][1]['ChargeType'] = 'Tax';
+ $x[0]['OrderChargeList'][1]['Amount'] = '1.00';
+ $x[0]['OrderChargeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentFeeList'][0]['FeeType'] = 'FBAStorageFee';
+ $x[0]['ShipmentFeeList'][0]['Amount'] = '-1.50';
+ $x[0]['ShipmentFeeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentFeeList'][1]['FeeType'] = 'FBAStorageTax';
+ $x[0]['ShipmentFeeList'][1]['Amount'] = '-5.00';
+ $x[0]['ShipmentFeeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['OrderFeeList'][0]['FeeType'] = 'LabellingFee';
+ $x[0]['OrderFeeList'][0]['Amount'] = '-1.00';
+ $x[0]['OrderFeeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['OrderFeeList'][1]['FeeType'] = 'LabellingTax';
+ $x[0]['OrderFeeList'][1]['Amount'] = '-3.00';
+ $x[0]['OrderFeeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['DirectPaymentList'][0]['DirectPaymentType'] = 'StoredValuedCardRevenue';
+ $x[0]['DirectPaymentList'][0]['Amount'] = '1.20';
+ $x[0]['DirectPaymentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['DirectPaymentList'][1]['DirectPaymentType'] = 'Money';
+ $x[0]['DirectPaymentList'][1]['Amount'] = '5.50';
+ $x[0]['DirectPaymentList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['PostedDate'] = '2012-07-18T00:00:00Z';
+ $x[0]['ShipmentItemList'][0]['SellerSKU'] = 'CBA_OTF_1';
+ $x[0]['ShipmentItemList'][0]['OrderItemId'] = '6882857EXAMPLE';
+ $x[0]['ShipmentItemList'][0]['QuantityShipped'] = '2';
+ $x[0]['ShipmentItemList'][0]['ItemChargeList'][0]['ChargeType'] = 'Discount';
+ $x[0]['ShipmentItemList'][0]['ItemChargeList'][0]['Amount'] = '1.99';
+ $x[0]['ShipmentItemList'][0]['ItemChargeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][0]['ItemChargeList'][1]['ChargeType'] = 'Tax';
+ $x[0]['ShipmentItemList'][0]['ItemChargeList'][1]['Amount'] = '0.50';
+ $x[0]['ShipmentItemList'][0]['ItemChargeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][0]['ItemFeeList'][0]['FeeType'] = 'FBAStorageFee';
+ $x[0]['ShipmentItemList'][0]['ItemFeeList'][0]['Amount'] = '-1.99';
+ $x[0]['ShipmentItemList'][0]['ItemFeeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][0]['ItemFeeList'][1]['FeeType'] = 'ItemFeeTax';
+ $x[0]['ShipmentItemList'][0]['ItemFeeList'][1]['Amount'] = '-0.99';
+ $x[0]['ShipmentItemList'][0]['ItemFeeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][0]['PromotionList'][0]['PromotionType'] = 'Shipping';
+ $x[0]['ShipmentItemList'][0]['PromotionList'][0]['PromotionId'] = 'SummerEXAMPLE';
+ $x[0]['ShipmentItemList'][0]['PromotionList'][0]['Amount'] = '-15.99';
+ $x[0]['ShipmentItemList'][0]['PromotionList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][0]['PromotionList'][1]['PromotionType'] = 'Shipping2';
+ $x[0]['ShipmentItemList'][0]['PromotionList'][1]['PromotionId'] = 'WinterEXAMPLE';
+ $x[0]['ShipmentItemList'][0]['PromotionList'][1]['Amount'] = '-3.99';
+ $x[0]['ShipmentItemList'][0]['PromotionList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][0]['CostOfPointsGranted']['Amount'] = '-5.99';
+ $x[0]['ShipmentItemList'][0]['CostOfPointsGranted']['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][1]['SellerSKU'] = 'CBA_OTF_2';
+ $x[0]['ShipmentItemList'][1]['OrderItemId'] = '9992857EXAMPLE';
+ $x[0]['ShipmentItemList'][1]['QuantityShipped'] = '1';
+ $x[0]['ShipmentItemList'][1]['ItemChargeList'][0]['ChargeType'] = 'Tax';
+ $x[0]['ShipmentItemList'][1]['ItemChargeList'][0]['Amount'] = '0.40';
+ $x[0]['ShipmentItemList'][1]['ItemChargeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][1]['ItemFeeList'][0]['FeeType'] = 'ItemFeeTax';
+ $x[0]['ShipmentItemList'][1]['ItemFeeList'][0]['Amount'] = '-0.30';
+ $x[0]['ShipmentItemList'][1]['ItemFeeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][1]['PromotionList'][0]['PromotionType'] = 'Shipping3';
+ $x[0]['ShipmentItemList'][1]['PromotionList'][0]['PromotionId'] = 'SpringEXAMPLE';
+ $x[0]['ShipmentItemList'][1]['PromotionList'][0]['Amount'] = '-5.99';
+ $x[0]['ShipmentItemList'][1]['PromotionList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemList'][1]['CostOfPointsGranted']['Amount'] = '-5.99';
+ $x[0]['ShipmentItemList'][1]['CostOfPointsGranted']['CurrencyCode'] = 'USD';
+ $x[1]['AmazonOrderId'] = '999-1234567-1234567';
+ $x[1]['SellerOrderId'] = '999-1234567-7654321';
+ $x[1]['MarketplaceName'] = 'amazon2.com';
+ $x[1]['OrderChargeList'][0]['ChargeType'] = 'Main';
+ $x[1]['OrderChargeList'][0]['Amount'] = '12.00';
+ $x[1]['OrderChargeList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['ShipmentFeeList'][0]['FeeType'] = 'BigFee';
+ $x[1]['ShipmentFeeList'][0]['Amount'] = '-10.50';
+ $x[1]['ShipmentFeeList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['OrderFeeList'][0]['FeeType'] = 'LabellingFee2';
+ $x[1]['OrderFeeList'][0]['Amount'] = '-2.00';
+ $x[1]['OrderFeeList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['DirectPaymentList'][0]['DirectPaymentType'] = 'Money';
+ $x[1]['DirectPaymentList'][0]['Amount'] = '2.50';
+ $x[1]['DirectPaymentList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['PostedDate'] = '2012-07-19T00:00:00Z';
+ $x[1]['ShipmentItemList'][0]['SellerSKU'] = 'CBA_OTF_3';
+ $x[1]['ShipmentItemList'][0]['OrderItemId'] = '3212857EXAMPLE';
+ $x[1]['ShipmentItemList'][0]['QuantityShipped'] = '3';
+ $x[1]['ShipmentItemList'][0]['CostOfPointsGranted']['Amount'] = '-1.99';
+ $x[1]['ShipmentItemList'][0]['CostOfPointsGranted']['CurrencyCode'] = 'USD';
+
+ $list = $o->getShipmentEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getShipmentEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetRefundEvents($o) {
+ $x = array();
+ $x[0]['AmazonOrderId'] = '333-7654321-7654321';
+ $x[0]['SellerOrderId'] = '333-7654321-1234567';
+ $x[0]['MarketplaceName'] = 'amazon.com';
+ $x[0]['OrderChargeAdjustmentList'][0]['ChargeType'] = 'ShippingCharge';
+ $x[0]['OrderChargeAdjustmentList'][0]['Amount'] = '-1.99';
+ $x[0]['OrderChargeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['OrderChargeAdjustmentList'][1]['ChargeType'] = 'Giftwrap';
+ $x[0]['OrderChargeAdjustmentList'][1]['Amount'] = '-0.99';
+ $x[0]['OrderChargeAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentFeeAdjustmentList'][0]['FeeType'] = 'FBADeliveryServicesFee';
+ $x[0]['ShipmentFeeAdjustmentList'][0]['Amount'] = '1.99';
+ $x[0]['ShipmentFeeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentFeeAdjustmentList'][1]['FeeType'] = 'FBAPlacementServiceFee';
+ $x[0]['ShipmentFeeAdjustmentList'][1]['Amount'] = '0.99';
+ $x[0]['ShipmentFeeAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['OrderFeeAdjustmentList'][0]['FeeType'] = 'FBAInventoryReturnFee';
+ $x[0]['OrderFeeAdjustmentList'][0]['Amount'] = '1.99';
+ $x[0]['OrderFeeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['OrderFeeAdjustmentList'][1]['FeeType'] = 'FBAInventoryReturnFee2';
+ $x[0]['OrderFeeAdjustmentList'][1]['Amount'] = '2.99';
+ $x[0]['OrderFeeAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['PostedDate'] = '2012-07-18T00:00:00Z';
+ $x[0]['ShipmentItemAdjustmentList'][0]['SellerSKU'] = 'CBA_OTF_1';
+ $x[0]['ShipmentItemAdjustmentList'][0]['OrderItemId'] = '999EXAMPLE123';
+ $x[0]['ShipmentItemAdjustmentList'][0]['OrderAdjustmentItemId'] = '6882857EXAMPLE';
+ $x[0]['ShipmentItemAdjustmentList'][0]['QuantityShipped'] = '4';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][0]['ChargeType'] = 'ReturnShipping';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][0]['Amount'] = '-1.99';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][1]['ChargeType'] = 'Tax';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][1]['Amount'] = '-0.99';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemFeeAdjustmentList'][0]['FeeType'] = 'ShippingChargeback';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemFeeAdjustmentList'][0]['Amount'] = '2.99';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemFeeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemFeeAdjustmentList'][1]['FeeType'] = 'ShippingTax';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemFeeAdjustmentList'][1]['Amount'] = '0.99';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemFeeAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][0]['PromotionAdjustmentList'][0]['PromotionType'] = 'Shipping';
+ $x[0]['ShipmentItemAdjustmentList'][0]['PromotionAdjustmentList'][0]['PromotionId'] = 'Summer099018';
+ $x[0]['ShipmentItemAdjustmentList'][0]['PromotionAdjustmentList'][0]['Amount'] = '22.99';
+ $x[0]['ShipmentItemAdjustmentList'][0]['PromotionAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][0]['PromotionAdjustmentList'][1]['PromotionType'] = 'Shipping2';
+ $x[0]['ShipmentItemAdjustmentList'][0]['PromotionAdjustmentList'][1]['PromotionId'] = 'Winter099018';
+ $x[0]['ShipmentItemAdjustmentList'][0]['PromotionAdjustmentList'][1]['Amount'] = '11.99';
+ $x[0]['ShipmentItemAdjustmentList'][0]['PromotionAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][0]['CostOfPointsReturned']['Amount'] = '5.99';
+ $x[0]['ShipmentItemAdjustmentList'][0]['CostOfPointsReturned']['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][1]['SellerSKU'] = 'CBA_OTF_2';
+ $x[0]['ShipmentItemAdjustmentList'][1]['OrderItemId'] = '999EXAMPLE456';
+ $x[0]['ShipmentItemAdjustmentList'][1]['OrderAdjustmentItemId'] = '9992857EXAMPLE';
+ $x[0]['ShipmentItemAdjustmentList'][1]['QuantityShipped'] = '3';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemChargeAdjustmentList'][0]['ChargeType'] = 'Tax';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemChargeAdjustmentList'][0]['Amount'] = '-3.99';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemChargeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemFeeAdjustmentList'][0]['FeeType'] = 'ShippingTax';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemFeeAdjustmentList'][0]['Amount'] = '2.99';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemFeeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][1]['PromotionAdjustmentList'][0]['PromotionType'] = 'Shipping3';
+ $x[0]['ShipmentItemAdjustmentList'][1]['PromotionAdjustmentList'][0]['PromotionId'] = 'Spring099018';
+ $x[0]['ShipmentItemAdjustmentList'][1]['PromotionAdjustmentList'][0]['Amount'] = '5.99';
+ $x[0]['ShipmentItemAdjustmentList'][1]['PromotionAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][1]['CostOfPointsReturned']['Amount'] = '2.99';
+ $x[0]['ShipmentItemAdjustmentList'][1]['CostOfPointsReturned']['CurrencyCode'] = 'USD';
+ $x[1]['AmazonOrderId'] = '999-7654321-7654321';
+ $x[1]['SellerOrderId'] = '999-7654321-1234567';
+ $x[1]['MarketplaceName'] = 'amazon2.com';
+ $x[1]['OrderChargeAdjustmentList'][0]['ChargeType'] = 'Giftwrap2';
+ $x[1]['OrderChargeAdjustmentList'][0]['Amount'] = '-0.99';
+ $x[1]['OrderChargeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['FeeType'] = 'FBAPlacementServiceFee2';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['Amount'] = '0.99';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['OrderFeeAdjustmentList'][0]['FeeType'] = 'FBAInventoryReturnFee3';
+ $x[1]['OrderFeeAdjustmentList'][0]['Amount'] = '2.99';
+ $x[1]['OrderFeeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['PostedDate'] = '2012-07-19T00:00:00Z';
+ $x[1]['ShipmentItemAdjustmentList'][0]['SellerSKU'] = 'CBA_OTF_3';
+ $x[1]['ShipmentItemAdjustmentList'][0]['OrderItemId'] = '999EXAMPLE789';
+ $x[1]['ShipmentItemAdjustmentList'][0]['OrderAdjustmentItemId'] = '9992857EXAMPLE2';
+ $x[1]['ShipmentItemAdjustmentList'][0]['QuantityShipped'] = '5';
+ $x[1]['ShipmentItemAdjustmentList'][0]['CostOfPointsReturned']['Amount'] = '1.99';
+ $x[1]['ShipmentItemAdjustmentList'][0]['CostOfPointsReturned']['CurrencyCode'] = 'USD';
+
+ $list = $o->getRefundEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getRefundEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetGuaranteeClaimEvents($o) {
+ $x = array();
+ $x[0]['AmazonOrderId'] = '333-5551234-7654321';
+ $x[0]['SellerOrderId'] = '333-5551234-1234567';
+ $x[0]['MarketplaceName'] = 'amazon.com';
+ $x[0]['OrderChargeAdjustmentList'][0]['ChargeType'] = 'ShippingCharge';
+ $x[0]['OrderChargeAdjustmentList'][0]['Amount'] = '-5.99';
+ $x[0]['OrderChargeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['PostedDate'] = '2012-07-20T00:00:00Z';
+ $x[0]['ShipmentItemAdjustmentList'][0]['SellerSKU'] = 'CBA_OTF_1';
+ $x[0]['ShipmentItemAdjustmentList'][0]['OrderItemId'] = '6992857EXAMPLE';
+ $x[0]['ShipmentItemAdjustmentList'][0]['OrderAdjustmentItemId'] = '6992859EXAMPLE';
+ $x[0]['ShipmentItemAdjustmentList'][0]['QuantityShipped'] = '3';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][0]['ChargeType'] = 'Tax';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][0]['Amount'] = '-0.99';
+ $x[0]['ShipmentItemAdjustmentList'][0]['ItemChargeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ShipmentItemAdjustmentList'][1]['SellerSKU'] = 'CBA_OTF_2';
+ $x[0]['ShipmentItemAdjustmentList'][1]['OrderItemId'] = '9992857EXAMPLE';
+ $x[0]['ShipmentItemAdjustmentList'][1]['OrderAdjustmentItemId'] = '9992897EXAMPLE';
+ $x[0]['ShipmentItemAdjustmentList'][1]['QuantityShipped'] = '3';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemChargeAdjustmentList'][0]['ChargeType'] = 'Tax';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemChargeAdjustmentList'][0]['Amount'] = '-3.50';
+ $x[0]['ShipmentItemAdjustmentList'][1]['ItemChargeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['AmazonOrderId'] = '999-5554321-7654321';
+ $x[1]['SellerOrderId'] = '999-5554321-1234567';
+ $x[1]['MarketplaceName'] = 'amazon2.com';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['FeeType'] = 'FBAPlacementServiceFee';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['Amount'] = '7.99';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['ShipmentFeeAdjustmentList'][1]['FeeType'] = 'FBAPlacementServiceFee2';
+ $x[1]['ShipmentFeeAdjustmentList'][1]['Amount'] = '5.99';
+ $x[1]['ShipmentFeeAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[1]['PostedDate'] = '2012-07-21T00:00:00Z';
+
+ $list = $o->getGuaranteeClaimEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getGuaranteeClaimEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetChargebackEvents($o) {
+ $x = array();
+ $x[0]['AmazonOrderId'] = '555-7654321-7654321';
+ $x[0]['SellerOrderId'] = '555-7654321-1234567';
+ $x[0]['MarketplaceName'] = 'amazon.com';
+ $x[0]['OrderChargeAdjustmentList'][0]['ChargeType'] = 'ShippingCharge';
+ $x[0]['OrderChargeAdjustmentList'][0]['Amount'] = '17.99';
+ $x[0]['OrderChargeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['OrderChargeAdjustmentList'][1]['ChargeType'] = 'Giftwrap';
+ $x[0]['OrderChargeAdjustmentList'][1]['Amount'] = '18.99';
+ $x[0]['OrderChargeAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['PostedDate'] = '2012-07-25T00:00:00Z';
+ $x[1]['AmazonOrderId'] = '999-5554321-7654321';
+ $x[1]['SellerOrderId'] = '999-5554321-1234567';
+ $x[1]['MarketplaceName'] = 'amazon2.com';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['FeeType'] = 'FeeTax';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['Amount'] = '2.75';
+ $x[1]['ShipmentFeeAdjustmentList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['ShipmentFeeAdjustmentList'][1]['FeeType'] = 'BigFee';
+ $x[1]['ShipmentFeeAdjustmentList'][1]['Amount'] = '5.75';
+ $x[1]['ShipmentFeeAdjustmentList'][1]['CurrencyCode'] = 'USD';
+ $x[1]['PostedDate'] = '2012-07-26T00:00:00Z';
+
+ $list = $o->getChargebackEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getChargebackEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetPayWithAmazonEvents($o) {
+ $x = array();
+ $x[0]['SellerOrderId'] = '333-7654321-7654321';
+ $x[0]['TransactionPostedDate'] = '2013-09-071T02:00:00.000-06:00';
+ $x[0]['BusinessObjectType'] = 'PaymentContract';
+ $x[0]['SalesChannel'] = 'www.merchantsite.com';
+ $x[0]['Charge']['ChargeType'] = 'Principal';
+ $x[0]['Charge']['Amount'] = '2.99';
+ $x[0]['Charge']['CurrencyCode'] = 'USD';
+ $x[0]['FeeList'][0]['FeeType'] = 'VariableClosingFee';
+ $x[0]['FeeList'][0]['Amount'] = '-0.99';
+ $x[0]['FeeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['FeeList'][1]['FeeType'] = 'GiftWrapFee';
+ $x[0]['FeeList'][1]['Amount'] = '-3.99';
+ $x[0]['FeeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['PaymentAmountType'] = 'Sales';
+ $x[0]['AmountDescription'] = 'Pay with amazon transaction';
+ $x[0]['FulfillmentChannel'] = 'MFN';
+ $x[0]['StoreName'] = 'TestStoreName';
+ $x[1]['SellerOrderId'] = '555-7654321-7654321';
+ $x[1]['TransactionPostedDate'] = '2013-09-091T02:00:00.000-06:00';
+ $x[1]['BusinessObjectType'] = 'PaymentContract2';
+ $x[1]['SalesChannel'] = 'www.merchantsite2.com';
+ $x[1]['Charge']['ChargeType'] = 'VicePrincipal';
+ $x[1]['Charge']['Amount'] = '5.99';
+ $x[1]['Charge']['CurrencyCode'] = 'USD';
+ $x[1]['FeeList'][0]['FeeType'] = 'GiftWrapFee';
+ $x[1]['FeeList'][0]['Amount'] = '-1.99';
+ $x[1]['FeeList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['PaymentAmountType'] = 'Sales2';
+ $x[1]['AmountDescription'] = 'Pay more with amazon transaction';
+ $x[1]['FulfillmentChannel'] = 'AFN';
+ $x[1]['StoreName'] = 'TestStoreName2';
+
+ $list = $o->getPayWithAmazonEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getPayWithAmazonEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetServiceProviderCreditEvents($o) {
+ $x = array();
+ $x[0]['ProviderTransactionType'] = 'SolutionProviderCredit';
+ $x[0]['SellerOrderId'] = '333-7654321-7654321';
+ $x[0]['MarketplaceId'] = '12';
+ $x[0]['MarketplaceCountryCode'] = 'US';
+ $x[0]['SellerId'] = '987918809';
+ $x[0]['SellerStoreName'] = 'TestSellerStoreName';
+ $x[0]['ProviderId'] = '6798769889';
+ $x[0]['ProviderStoreName'] = 'TestProviderStoreName';
+ $x[1]['ProviderTransactionType'] = 'SolutionProviderCredit2';
+ $x[1]['SellerOrderId'] = '555-7654321-7654321';
+ $x[1]['MarketplaceId'] = '13';
+ $x[1]['MarketplaceCountryCode'] = 'US';
+ $x[1]['SellerId'] = '999918809';
+ $x[1]['SellerStoreName'] = 'TestSellerStoreName2';
+ $x[1]['ProviderId'] = '6798769999';
+ $x[1]['ProviderStoreName'] = 'TestProviderStoreName2';
+
+ $list = $o->getServiceProviderCreditEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getServiceProviderCreditEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetRetrochargeEvents($o) {
+ $x = array();
+ $x[0]['RetrochargeEventType'] = 'Retrocharge';
+ $x[0]['AmazonOrderId'] = '333-1234567-1234567';
+ $x[0]['PostedDate'] = '2013-09-071T02:00:00.000-06:00';
+ $x[0]['BaseTax']['Amount'] = '1.99';
+ $x[0]['BaseTax']['CurrencyCode'] = 'USD';
+ $x[0]['ShippingTax']['Amount'] = '2.99';
+ $x[0]['ShippingTax']['CurrencyCode'] = 'USD';
+ $x[0]['MarketplaceName'] = 'amazon.com';
+ $x[1]['RetrochargeEventType'] = 'Retrocharge2';
+ $x[1]['AmazonOrderId'] = '999-1234567-1234567';
+ $x[1]['PostedDate'] = '2013-09-081T02:00:00.000-06:00';
+ $x[1]['BaseTax']['Amount'] = '3.99';
+ $x[1]['BaseTax']['CurrencyCode'] = 'USD';
+ $x[1]['ShippingTax']['Amount'] = '4.99';
+ $x[1]['ShippingTax']['CurrencyCode'] = 'USD';
+ $x[1]['MarketplaceName'] = 'amazon2.com';
+
+ $list = $o->getRetrochargeEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getRetrochargeEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetRentalTransactionEvents($o) {
+ $x = array();
+ $x[0]['AmazonOrderId'] = '333-1234567-1234567';
+ $x[0]['RentalEventType'] = 'RentalCustomerPayment-Buyout';
+ $x[0]['ExtensionLength'] = '12';
+ $x[0]['PostedDate'] = '2013-09-071T02:00:00.000-06:00';
+ $x[0]['RentalChargeList'][0]['ChargeType'] = 'Tax';
+ $x[0]['RentalChargeList'][0]['Amount'] = '0.99';
+ $x[0]['RentalChargeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['RentalChargeList'][1]['ChargeType'] = 'TaxTax';
+ $x[0]['RentalChargeList'][1]['Amount'] = '0.50';
+ $x[0]['RentalChargeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['RentalFeeList'][0]['FeeType'] = 'SalesTaxServiceFee';
+ $x[0]['RentalFeeList'][0]['Amount'] = '-1.99';
+ $x[0]['RentalFeeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['RentalFeeList'][1]['FeeType'] = 'SalesTaxServiceFeeTax';
+ $x[0]['RentalFeeList'][1]['Amount'] = '-0.99';
+ $x[0]['RentalFeeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['MarketplaceName'] = 'amazon.com';
+ $x[0]['RentalInitialValue']['Amount'] = '3.99';
+ $x[0]['RentalInitialValue']['CurrencyCode'] = 'USD';
+ $x[0]['RentalReimbursement']['Amount'] = '1.99';
+ $x[0]['RentalReimbursement']['CurrencyCode'] = 'USD';
+ $x[1]['AmazonOrderId'] = '555-1234567-1234567';
+ $x[1]['RentalEventType'] = 'RentalCustomerPayment-Buyout2';
+ $x[1]['ExtensionLength'] = '11';
+ $x[1]['PostedDate'] = '2013-09-081T02:00:00.000-06:00';
+ $x[1]['RentalChargeList'][0]['ChargeType'] = 'RentalTax';
+ $x[1]['RentalChargeList'][0]['Amount'] = '0.70';
+ $x[1]['RentalChargeList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['RentalFeeList'][0]['FeeType'] = 'SalesTaxTax';
+ $x[1]['RentalFeeList'][0]['Amount'] = '-0.70';
+ $x[1]['RentalFeeList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['MarketplaceName'] = 'amazon2.com';
+ $x[1]['RentalInitialValue']['Amount'] = '5.99';
+ $x[1]['RentalInitialValue']['CurrencyCode'] = 'USD';
+ $x[1]['RentalReimbursement']['Amount'] = '4.99';
+ $x[1]['RentalReimbursement']['CurrencyCode'] = 'USD';
+
+ $list = $o->getRentalTransactionEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getRentalTransactionEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetPerformanceBondRefundEvents($o) {
+ $x = array();
+ $x[0]['MarketplaceCountryCode'] = 'US';
+ $x[0]['Amount'] = '1.99';
+ $x[0]['CurrencyCode'] = 'USD';
+ $x[0]['ProductGroupList'][0] = 'gl_books';
+ $x[0]['ProductGroupList'][1] = 'gl_magazines';
+ $x[1]['MarketplaceCountryCode'] = 'UK';
+ $x[1]['Amount'] = '2.99';
+ $x[1]['CurrencyCode'] = 'EUR';
+ $x[1]['ProductGroupList'][0] = 'gl_boxes';
+
+ $list = $o->getPerformanceBondRefundEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getPerformanceBondRefundEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetServiceFeeEvents($o) {
+ $x = array();
+ $x[0]['AmazonOrderId'] = '333-1234567-1234567';
+ $x[0]['FeeReason'] = 'fba inbound defect fee';
+ $x[0]['FeeList'][0]['FeeType'] = 'FBAOrderHandlingFee';
+ $x[0]['FeeList'][0]['Amount'] = '-0.99';
+ $x[0]['FeeList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['FeeList'][1]['FeeType'] = 'FBAOrderHandlingFeeTax';
+ $x[0]['FeeList'][1]['Amount'] = '-1.99';
+ $x[0]['FeeList'][1]['CurrencyCode'] = 'USD';
+ $x[0]['SellerSKU'] = 'CBA_OF_1';
+ $x[0]['FnSKU'] = 'AKSJD12';
+ $x[0]['FeeDescription'] = 'Test Fee description';
+ $x[0]['ASIN'] = 'BT0093TELA';
+ $x[1]['AmazonOrderId'] = '555-1234567-1234567';
+ $x[1]['FeeReason'] = 'fba inbound defect again';
+ $x[1]['FeeList'][0]['FeeType'] = 'HandlingFee';
+ $x[1]['FeeList'][0]['Amount'] = '-3.99';
+ $x[1]['FeeList'][0]['CurrencyCode'] = 'USD';
+ $x[1]['SellerSKU'] = 'CBA_OF_2';
+ $x[1]['FnSKU'] = 'ASDFJ12';
+ $x[1]['FeeDescription'] = 'Test Fee more';
+ $x[1]['ASIN'] = 'BT0093F0N3';
+
+ $list = $o->getServiceFeeEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getServiceFeeEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetDebtRecoveryEvents($o) {
+ $x = array();
+ $x[0]['DebtRecoveryType'] = 'DebtAdjustment';
+ $x[0]['RecoveryAmount']['Amount'] = '10.99';
+ $x[0]['RecoveryAmount']['CurrencyCode'] = 'USD';
+ $x[0]['OverPaymentCredit']['Amount'] = '8.99';
+ $x[0]['OverPaymentCredit']['CurrencyCode'] = 'USD';
+ $x[0]['DebtRecoveryItemList'][0]['RecoveryAmount']['Amount'] = '5.99';
+ $x[0]['DebtRecoveryItemList'][0]['RecoveryAmount']['CurrencyCode'] = 'USD';
+ $x[0]['DebtRecoveryItemList'][0]['OriginalAmount']['Amount'] = '4.99';
+ $x[0]['DebtRecoveryItemList'][0]['OriginalAmount']['CurrencyCode'] = 'USD';
+ $x[0]['DebtRecoveryItemList'][0]['GroupBeginDate'] = '2013-09-09T01:30:00.000-06:00';
+ $x[0]['DebtRecoveryItemList'][0]['GroupEndDate'] = '2013-09-23T01:30:00.000-06:00';
+ $x[0]['DebtRecoveryItemList'][1]['RecoveryAmount']['Amount'] = '3.99';
+ $x[0]['DebtRecoveryItemList'][1]['RecoveryAmount']['CurrencyCode'] = 'USD';
+ $x[0]['DebtRecoveryItemList'][1]['OriginalAmount']['Amount'] = '2.99';
+ $x[0]['DebtRecoveryItemList'][1]['OriginalAmount']['CurrencyCode'] = 'USD';
+ $x[0]['DebtRecoveryItemList'][1]['GroupBeginDate'] = '2013-09-10T01:30:00.000-06:00';
+ $x[0]['DebtRecoveryItemList'][1]['GroupEndDate'] = '2013-09-24T01:30:00.000-06:00';
+ $x[0]['ChargeInstrumentList'][0]['Description'] = 'Credit card';
+ $x[0]['ChargeInstrumentList'][0]['Tail'] = '9887';
+ $x[0]['ChargeInstrumentList'][0]['Amount'] = '9.99';
+ $x[0]['ChargeInstrumentList'][0]['CurrencyCode'] = 'USD';
+ $x[0]['ChargeInstrumentList'][1]['Description'] = 'Debit card';
+ $x[0]['ChargeInstrumentList'][1]['Tail'] = '9889';
+ $x[0]['ChargeInstrumentList'][1]['Amount'] = '10.99';
+ $x[0]['ChargeInstrumentList'][1]['CurrencyCode'] = 'USD';
+ $x[1]['DebtRecoveryType'] = 'DebtAdjustment2';
+ $x[1]['RecoveryAmount']['Amount'] = '11.99';
+ $x[1]['RecoveryAmount']['CurrencyCode'] = 'USD';
+ $x[1]['OverPaymentCredit']['Amount'] = '9.99';
+ $x[1]['OverPaymentCredit']['CurrencyCode'] = 'USD';
+ $x[1]['DebtRecoveryItemList'][0]['RecoveryAmount']['Amount'] = '2.99';
+ $x[1]['DebtRecoveryItemList'][0]['RecoveryAmount']['CurrencyCode'] = 'USD';
+ $x[1]['DebtRecoveryItemList'][0]['OriginalAmount']['Amount'] = '1.99';
+ $x[1]['DebtRecoveryItemList'][0]['OriginalAmount']['CurrencyCode'] = 'USD';
+ $x[1]['DebtRecoveryItemList'][0]['GroupBeginDate'] = '2013-09-11T01:30:00.000-06:00';
+ $x[1]['DebtRecoveryItemList'][0]['GroupEndDate'] = '2013-09-25T01:30:00.000-06:00';
+ $x[1]['ChargeInstrumentList'][0]['Description'] = 'Debit card';
+ $x[1]['ChargeInstrumentList'][0]['Tail'] = '1234';
+ $x[1]['ChargeInstrumentList'][0]['Amount'] = '5.99';
+ $x[1]['ChargeInstrumentList'][0]['CurrencyCode'] = 'USD';
+
+ $list = $o->getDebtRecoveryEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getDebtRecoveryEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetLoanServicingEvents($o) {
+ $x = array();
+ $x[0]['Amount'] = '13.99';
+ $x[0]['CurrencyCode'] = 'USD';
+ $x[0]['SourceBusinessEventType'] = 'LoanAdvance';
+ $x[1]['Amount'] = '15.99';
+ $x[1]['CurrencyCode'] = 'USD';
+ $x[1]['SourceBusinessEventType'] = 'LoanAdvance2';
+
+ $list = $o->getLoanServicingEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getLoanServicingEvents());
+ }
+
+ /**
+ * @param AmazonFinancialEventList $o
+ * @depends testFetchEventList
+ */
+ public function testGetAdjustmentEvents($o) {
+ $x = array();
+ $x[0]['AdjustmentType'] = 'PostageBilling';
+ $x[0]['Amount'] = '-5.99';
+ $x[0]['CurrencyCode'] = 'USD';
+ $x[0]['AdjustmentItemList'][0]['Quantity'] = '2';
+ $x[0]['AdjustmentItemList'][0]['PerUnitAmount']['Amount'] = '-1.99';
+ $x[0]['AdjustmentItemList'][0]['PerUnitAmount']['CurrencyCode'] = 'USD';
+ $x[0]['AdjustmentItemList'][0]['TotalAmount']['Amount'] = '-5.99';
+ $x[0]['AdjustmentItemList'][0]['TotalAmount']['CurrencyCode'] = 'USD';
+ $x[0]['AdjustmentItemList'][0]['SellerSKU'] = 'ASK_AS_1';
+ $x[0]['AdjustmentItemList'][0]['FnSKU'] = 'ASLKLDS12';
+ $x[0]['AdjustmentItemList'][0]['ProductDescription'] = 'Test Product';
+ $x[0]['AdjustmentItemList'][0]['ASIN'] = 'BT0093TELA';
+ $x[0]['AdjustmentItemList'][1]['Quantity'] = '1';
+ $x[0]['AdjustmentItemList'][1]['PerUnitAmount']['Amount'] = '-2.99';
+ $x[0]['AdjustmentItemList'][1]['PerUnitAmount']['CurrencyCode'] = 'USD';
+ $x[0]['AdjustmentItemList'][1]['TotalAmount']['Amount'] = '-6.99';
+ $x[0]['AdjustmentItemList'][1]['TotalAmount']['CurrencyCode'] = 'USD';
+ $x[0]['AdjustmentItemList'][1]['SellerSKU'] = 'ASK_AS_2';
+ $x[0]['AdjustmentItemList'][1]['FnSKU'] = 'ASDFJDS12';
+ $x[0]['AdjustmentItemList'][1]['ProductDescription'] = 'Test Product 2';
+ $x[0]['AdjustmentItemList'][1]['ASIN'] = 'BT0093F0N3';
+ $x[1]['AdjustmentType'] = 'PostageBilling2';
+ $x[1]['Amount'] = '-8.99';
+ $x[1]['CurrencyCode'] = 'USD';
+ $x[1]['AdjustmentItemList'][0]['Quantity'] = '3';
+ $x[1]['AdjustmentItemList'][0]['PerUnitAmount']['Amount'] = '-4.99';
+ $x[1]['AdjustmentItemList'][0]['PerUnitAmount']['CurrencyCode'] = 'USD';
+ $x[1]['AdjustmentItemList'][0]['TotalAmount']['Amount'] = '-7.99';
+ $x[1]['AdjustmentItemList'][0]['TotalAmount']['CurrencyCode'] = 'USD';
+ $x[1]['AdjustmentItemList'][0]['SellerSKU'] = 'ASK_AS_3';
+ $x[1]['AdjustmentItemList'][0]['FnSKU'] = 'ASDFJDS99';
+ $x[1]['AdjustmentItemList'][0]['ProductDescription'] = 'Test Product 3';
+ $x[1]['AdjustmentItemList'][0]['ASIN'] = 'BT0093BNNA';
+
+ $list = $o->getAdjustmentEvents();
+ $this->assertInternalType('array', $list);
+ $this->assertEquals($x, $list);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getAdjustmentEvents());
+ }
+
+}
+
+require_once('helperFunctions.php');
diff --git a/test-cases/includes/classes/AmazonFinancialGroupListTest.php b/test-cases/includes/classes/AmazonFinancialGroupListTest.php
new file mode 100644
index 00000000..0323f9b0
--- /dev/null
+++ b/test-cases/includes/classes/AmazonFinancialGroupListTest.php
@@ -0,0 +1,335 @@
+object = new AmazonFinancialGroupList('testStore', true, null, __DIR__.'/../../test-config.php');
+ }
+
+ public function testSetUseToken(){
+ $this->assertNull($this->object->setUseToken());
+ $this->assertNull($this->object->setUseToken(true));
+ $this->assertNull($this->object->setUseToken(false));
+ $this->assertFalse($this->object->setUseToken('wrong'));
+ }
+
+ public function testSetMaxResultsPerPage(){
+ $this->assertFalse($this->object->setMaxResultsPerPage(null)); //can't be nothing
+ $this->assertFalse($this->object->setMaxResultsPerPage(-5)); //too low
+ $this->assertFalse($this->object->setMaxResultsPerPage(150)); //too high
+ $this->assertFalse($this->object->setMaxResultsPerPage(array(5, 7))); //not a valid value
+ $this->assertFalse($this->object->setMaxResultsPerPage('banana')); //what are you even doing
+ $this->assertNull($this->object->setMaxResultsPerPage(77));
+ $this->assertNull($this->object->setMaxResultsPerPage('75'));
+ $o = $this->object->getOptions();
+ $this->assertArrayHasKey('MaxResultsPerPage', $o);
+ $this->assertEquals('75', $o['MaxResultsPerPage']);
+ }
+
+ /**
+ * @return array
+ */
+ public function timeProvider() {
+ return array(
+ array(null, null, false, false), //nothing given, so no change
+ array(time(), time(), true, true), //timestamps
+ array('', '', false, false), //strings, but empty
+ array('-1 min', null, true, false), //one set
+ array(null, '-1 min', false, false), //other set
+ array('-1 min', '-1 min', true, true), //both set
+ );
+ }
+
+ /**
+ * @dataProvider timeProvider
+ */
+ public function testSetTimeLimits($a, $b, $c, $d){
+ $try = $this->object->setTimeLimits($a, $b);
+ $o = $this->object->getOptions();
+ if ($c) {
+ $this->assertNull($try);
+ $this->assertArrayHasKey('FinancialEventGroupStartedAfter', $o);
+ $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['FinancialEventGroupStartedAfter']);
+ } else {
+ $this->assertFalse($try);
+ $this->assertArrayNotHasKey('FinancialEventGroupStartedAfter', $o);
+ }
+
+ if ($c && $d) {
+ $this->assertArrayHasKey('FinancialEventGroupStartedBefore', $o);
+ $this->assertStringMatchesFormat('%d-%d-%dT%d:%d:%d%i', $o['FinancialEventGroupStartedBefore']);
+ //setting only first date resets second one
+ $this->assertNull($this->object->setTimeLimits($a));
+ $o2 = $this->object->getOptions();
+ $this->assertArrayNotHasKey('FinancialEventGroupStartedBefore', $o2);
+ } else {
+ $this->assertArrayNotHasKey('FinancialEventGroupStartedBefore', $o);
+ }
+ }
+
+ public function testFetchGroupList() {
+ resetLog();
+ $this->object->setMock(true, 'fetchFinancialGroups.xml'); //no token
+ $this->assertFalse($this->object->fetchGroupList()); //no date yet
+ $this->object->setTimeLimits('-1 day');
+ $this->assertNull($this->object->fetchGroupList());
+
+ $check = parseLog();
+ $this->assertEquals('Single Mock File set: fetchFinancialGroups.xml', $check[1]);
+ $this->assertEquals('Start date must be set in order to fetch financial event groups', $check[2]);
+ $this->assertEquals('Fetched Mock File: mock/fetchFinancialGroups.xml', $check[3]);
+
+ $o = $this->object->getOptions();
+ $this->assertEquals('ListFinancialEventGroups', $o['Action']);
+
+ $this->assertFalse($this->object->hasToken());
+
+ return $this->object;
+ }
+
+ public function testFetchGroupListToken1() {
+ resetLog();
+ $this->object->setMock(true, 'fetchFinancialGroupsToken.xml');
+ //without using token
+ $this->object->setTimeLimits('-1 day');
+ $this->assertNull($this->object->fetchGroupList());
+ $check = parseLog();
+ $this->assertEquals('Single Mock File set: fetchFinancialGroupsToken.xml', $check[1]);
+ $this->assertEquals('Fetched Mock File: mock/fetchFinancialGroupsToken.xml', $check[2]);
+
+ $this->assertTrue($this->object->hasToken());
+ $o = $this->object->getOptions();
+ $this->assertEquals('ListFinancialEventGroups', $o['Action']);
+ $r = $this->object->getGroups();
+ $this->assertInternalType('array', $r);
+ $this->assertCount(1, $r);
+ }
+
+ public function testFetchGroupListToken2() {
+ resetLog();
+ $this->object->setMock(true, array('fetchFinancialGroupsToken.xml', 'fetchFinancialGroupsToken2.xml'));
+
+ //with using token
+ $this->object->setUseToken();
+ $this->object->setTimeLimits('-1 day');
+ $this->assertNull($this->object->fetchGroupList());
+ $check = parseLog();
+ $this->assertEquals('Mock files array set.', $check[1]);
+ $this->assertEquals('Fetched Mock File: mock/fetchFinancialGroupsToken.xml', $check[2]);
+ $this->assertEquals('Recursively fetching more Financial Event Groups', $check[3]);
+ $this->assertEquals('Fetched Mock File: mock/fetchFinancialGroupsToken2.xml', $check[4]);
+ $this->assertFalse($this->object->hasToken());
+ $o = $this->object->getOptions();
+ $this->assertEquals('ListFinancialEventGroupsByNextToken', $o['Action']);
+ $this->assertArrayNotHasKey('FinancialEventGroupStartedAfter', $o);
+ $r = $this->object->getGroups();
+ $this->assertInternalType('array', $r);
+ $this->assertCount(2, $r);
+ $this->assertNotEquals($r[0], $r[1]);
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetGroups($o) {
+ $list = $o->getGroups();
+ $this->assertInternalType('array', $list);
+ $this->assertCount(2, $list);
+ $this->assertArrayHasKey(0, $list);
+ $this->assertArrayHasKey(1, $list);
+ $this->assertArrayHasKey('FinancialEventGroupId', $list[0]);
+ $this->assertEquals($o->getGroupId(0), $list[0]['FinancialEventGroupId']);
+ $this->assertArrayHasKey('ProcessingStatus', $list[0]);
+ $this->assertEquals($o->getProcessingStatus(0), $list[0]['ProcessingStatus']);
+ $this->assertArrayHasKey('FundTransferStatus', $list[0]);
+ $this->assertEquals($o->getTransferStatus(0), $list[0]['FundTransferStatus']);
+ $this->assertArrayHasKey('OriginalTotal', $list[0]);
+ $this->assertEquals($o->getOriginalTotal(0), $list[0]['OriginalTotal']);
+ $this->assertArrayHasKey('ConvertedTotal', $list[0]);
+ $this->assertEquals($o->getConvertedTotal(0), $list[0]['ConvertedTotal']);
+ $this->assertArrayHasKey('FundTransferDate', $list[0]);
+ $this->assertEquals($o->getTransferDate(0), $list[0]['FundTransferDate']);
+ $this->assertArrayHasKey('TraceId', $list[0]);
+ $this->assertEquals($o->getTraceId(0), $list[0]['TraceId']);
+ $this->assertArrayHasKey('AccountTail', $list[0]);
+ $this->assertEquals($o->getAccountTail(0), $list[0]['AccountTail']);
+ $this->assertArrayHasKey('BeginningBalance', $list[0]);
+ $this->assertEquals($o->getBeginningBalance(0), $list[0]['BeginningBalance']);
+ $this->assertArrayHasKey('FinancialEventGroupStart', $list[0]);
+ $this->assertEquals($o->getStartDate(0), $list[0]['FinancialEventGroupStart']);
+ $this->assertArrayHasKey('FinancialEventGroupEnd', $list[0]);
+ $this->assertEquals($o->getEndDate(0), $list[0]['FinancialEventGroupEnd']);
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getGroups());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetGroupId($o) {
+ $this->assertEquals('22YgYW55IGNhcm5hbCBwbGVhEXAMPLE', $o->getGroupId(0));
+ $this->assertEquals('22Y99995IGNhcm5hbANOTHEREXAMPLE', $o->getGroupId(1));
+ $this->assertEquals($o->getGroupId(0), $o->getGroupId());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getGroupId());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetProcessingStatus($o) {
+ $this->assertEquals('Closed', $o->getProcessingStatus(0));
+ $this->assertEquals('Closed2', $o->getProcessingStatus(1));
+ $this->assertEquals($o->getProcessingStatus(0), $o->getProcessingStatus());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getProcessingStatus());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetTransferStatus($o) {
+ $this->assertEquals('Successful', $o->getTransferStatus(0));
+ $this->assertEquals('Successful2', $o->getTransferStatus(1));
+ $this->assertEquals($o->getTransferStatus(0), $o->getTransferStatus());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getTransferStatus());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetOriginalTotal($o) {
+ $x0 = array();
+ $x0['Amount'] = '19.00';
+ $x0['CurrencyCode'] = 'USD';
+ $x1 = array();
+ $x1['Amount'] = '42.00';
+ $x1['CurrencyCode'] = 'USD';
+ $this->assertEquals($x0, $o->getOriginalTotal(0));
+ $this->assertEquals($x0['Amount'], $o->getOriginalTotal(0, true));
+ $this->assertEquals($x1, $o->getOriginalTotal(1));
+ $this->assertEquals($x1['Amount'], $o->getOriginalTotal(1, true));
+ $this->assertEquals($o->getOriginalTotal(0), $o->getOriginalTotal());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getOriginalTotal());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetConvertedTotal($o) {
+ $x0 = array();
+ $x0['Amount'] = '19.50';
+ $x0['CurrencyCode'] = 'USD';
+ $x1 = array();
+ $x1['Amount'] = '42.50';
+ $x1['CurrencyCode'] = 'USD';
+ $this->assertEquals($x0, $o->getConvertedTotal(0));
+ $this->assertEquals($x0['Amount'], $o->getConvertedTotal(0, true));
+ $this->assertEquals($x1, $o->getConvertedTotal(1));
+ $this->assertEquals($x1['Amount'], $o->getConvertedTotal(1, true));
+ $this->assertEquals($o->getConvertedTotal(0), $o->getConvertedTotal());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getConvertedTotal());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetTransferDate($o) {
+ $this->assertEquals('2014-09-09T01:30:00.000-06:00', $o->getTransferDate(0));
+ $this->assertEquals('2014-10-09T01:30:00.000-06:00', $o->getTransferDate(1));
+ $this->assertEquals($o->getTransferDate(0), $o->getTransferDate());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getTransferDate());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetTraceId($o) {
+ $this->assertEquals('128311029381HSADJEXAMPLE', $o->getTraceId(0));
+ $this->assertEquals('128999929381HADJEXAMPLE2', $o->getTraceId(1));
+ $this->assertEquals($o->getTraceId(0), $o->getTraceId());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getTraceId());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetAccountTail($o) {
+ $this->assertEquals('1212', $o->getAccountTail(0));
+ $this->assertEquals('1313', $o->getAccountTail(1));
+ $this->assertEquals($o->getAccountTail(0), $o->getAccountTail());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getAccountTail());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetBeginningBalance($o) {
+ $x0 = array();
+ $x0['Amount'] = '0.00';
+ $x0['CurrencyCode'] = 'USD';
+ $x1 = array();
+ $x1['Amount'] = '20.00';
+ $x1['CurrencyCode'] = 'USD';
+ $this->assertEquals($x0, $o->getBeginningBalance(0));
+ $this->assertEquals($x0['Amount'], $o->getBeginningBalance(0, true));
+ $this->assertEquals($x1, $o->getBeginningBalance(1));
+ $this->assertEquals($x1['Amount'], $o->getBeginningBalance(1, true));
+ $this->assertEquals($o->getBeginningBalance(0), $o->getBeginningBalance());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getBeginningBalance());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetStartDate($o) {
+ $this->assertEquals('2014-09-01T01:30:00.000-06:00', $o->getStartDate(0));
+ $this->assertEquals('2014-10-01T01:30:00.000-06:00', $o->getStartDate(1));
+ $this->assertEquals($o->getStartDate(0), $o->getStartDate());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getStartDate());
+ }
+
+ /**
+ * @param AmazonFinancialGroupList $o
+ * @depends testFetchGroupList
+ */
+ public function testGetEndDate($o) {
+ $this->assertEquals('2014-09-09T01:30:00.000-06:00', $o->getEndDate(0));
+ $this->assertEquals('2014-10-09T01:30:00.000-06:00', $o->getEndDate(1));
+ $this->assertEquals($o->getEndDate(0), $o->getEndDate());
+ //not fetched yet for this object
+ $this->assertFalse($this->object->getEndDate());
+ }
+
+}
+
+require_once('helperFunctions.php');
diff --git a/test-cases/mock/fetchFinancialEvents.xml b/test-cases/mock/fetchFinancialEvents.xml
new file mode 100644
index 00000000..9a22cceb
--- /dev/null
+++ b/test-cases/mock/fetchFinancialEvents.xml
@@ -0,0 +1,985 @@
+
+
+
+
+
+
+ 333-1234567-1234567
+ 333-1234567-7654321
+ amazon.com
+
+
+ Principal
+
+ USD
+ 10.00
+
+
+
+ Tax
+
+ USD
+ 1.00
+
+
+
+
+
+ FBAStorageFee
+
+ USD
+ -1.50
+
+
+
+ FBAStorageTax
+
+ USD
+ -5.00
+
+
+
+
+
+ LabellingFee
+
+ USD
+ -1.00
+
+
+
+ LabellingTax
+
+ USD
+ -3.00
+
+
+
+ 2012-07-18T00:00:00Z
+
+
+ StoredValuedCardRevenue
+
+ USD
+ 1.20
+
+
+
+ Money
+
+ USD
+ 5.50
+
+
+
+
+
+ CBA_OTF_1
+ 6882857EXAMPLE
+ 2
+
+
+ Discount
+
+ USD
+ 1.99
+
+
+
+ Tax
+
+ USD
+ 0.50
+
+
+
+
+
+ FBAStorageFee
+
+ USD
+ -1.99
+
+
+
+ ItemFeeTax
+
+ USD
+ -0.99
+
+
+
+
+
+ Shipping
+ SummerEXAMPLE
+
+ USD
+ -15.99
+
+
+
+ Shipping2
+ WinterEXAMPLE
+
+ USD
+ -3.99
+
+
+
+
+ USD
+ -5.99
+
+
+
+ CBA_OTF_2
+ 9992857EXAMPLE
+ 1
+
+
+ Tax
+
+ USD
+ 0.40
+
+
+
+
+
+ ItemFeeTax
+
+ USD
+ -0.30
+
+
+
+
+
+ Shipping3
+ SpringEXAMPLE
+
+ USD
+ -5.99
+
+
+
+
+ USD
+ -5.99
+
+
+
+
+
+ 999-1234567-1234567
+ 999-1234567-7654321
+ amazon2.com
+
+
+ Main
+
+ USD
+ 12.00
+
+
+
+
+
+ BigFee
+
+ USD
+ -10.50
+
+
+
+
+
+ LabellingFee2
+
+ USD
+ -2.00
+
+
+
+ 2012-07-19T00:00:00Z
+
+
+ Money
+
+ USD
+ 2.50
+
+
+
+
+
+ CBA_OTF_3
+ 3212857EXAMPLE
+ 3
+
+ USD
+ -1.99
+
+
+
+
+
+
+
+ 333-7654321-7654321
+ 333-7654321-1234567
+ amazon.com
+
+
+ ShippingCharge
+
+ USD
+ -1.99
+
+
+
+ Giftwrap
+
+ USD
+ -0.99
+
+
+
+
+
+ FBADeliveryServicesFee
+
+ USD
+ 1.99
+
+
+
+ FBAPlacementServiceFee
+
+ USD
+ 0.99
+
+
+
+
+
+ FBAInventoryReturnFee
+
+ USD
+ 1.99
+
+
+
+ FBAInventoryReturnFee2
+
+ USD
+ 2.99
+
+
+
+ 2012-07-18T00:00:00Z
+
+
+ CBA_OTF_1
+ 999EXAMPLE123
+ 6882857EXAMPLE
+ 4
+
+
+ ReturnShipping
+
+ USD
+ -1.99
+
+
+
+ Tax
+
+ USD
+ -0.99
+
+
+
+
+
+ ShippingChargeback
+
+ USD
+ 2.99
+
+
+
+ ShippingTax
+
+ USD
+ 0.99
+
+
+
+
+
+ Shipping
+ Summer099018
+
+ USD
+ 22.99
+
+
+
+ Shipping2
+ Winter099018
+
+ USD
+ 11.99
+
+
+
+
+ USD
+ 5.99
+
+
+
+ CBA_OTF_2
+ 999EXAMPLE456
+ 9992857EXAMPLE
+ 3
+
+
+ Tax
+
+ USD
+ -3.99
+
+
+
+
+
+ ShippingTax
+
+ USD
+ 2.99
+
+
+
+
+
+ Shipping3
+ Spring099018
+
+ USD
+ 5.99
+
+
+
+
+ USD
+ 2.99
+
+
+
+
+
+ 999-7654321-7654321
+ 999-7654321-1234567
+ amazon2.com
+
+
+ Giftwrap2
+
+ USD
+ -0.99
+
+
+
+
+
+ FBAPlacementServiceFee2
+
+ USD
+ 0.99
+
+
+
+
+
+ FBAInventoryReturnFee3
+
+ USD
+ 2.99
+
+
+
+ 2012-07-19T00:00:00Z
+
+
+ CBA_OTF_3
+ 999EXAMPLE789
+ 9992857EXAMPLE2
+ 5
+
+ USD
+ 1.99
+
+
+
+
+
+
+
+ 333-5551234-7654321
+ 333-5551234-1234567
+ amazon.com
+
+
+ ShippingCharge
+
+ USD
+ -5.99
+
+
+
+ 2012-07-20T00:00:00Z
+
+
+ CBA_OTF_1
+ 6992857EXAMPLE
+ 6992859EXAMPLE
+ 3
+
+
+ Tax
+
+ USD
+ -0.99
+
+
+
+
+
+ CBA_OTF_2
+ 9992857EXAMPLE
+ 9992897EXAMPLE
+ 3
+
+
+ Tax
+
+ USD
+ -3.50
+
+
+
+
+
+
+
+ 999-5554321-7654321
+ 999-5554321-1234567
+ amazon2.com
+
+
+ FBAPlacementServiceFee
+
+ USD
+ 7.99
+
+
+
+ FBAPlacementServiceFee2
+
+ USD
+ 5.99
+
+
+
+ 2012-07-21T00:00:00Z
+
+
+
+
+ 555-7654321-7654321
+ 555-7654321-1234567
+ amazon.com
+
+
+ ShippingCharge
+
+ USD
+ 17.99
+
+
+
+ Giftwrap
+
+ USD
+ 18.99
+
+
+
+ 2012-07-25T00:00:00Z
+
+
+ 999-5554321-7654321
+ 999-5554321-1234567
+ amazon2.com
+
+
+ FeeTax
+
+ USD
+ 2.75
+
+
+
+ BigFee
+
+ USD
+ 5.75
+
+
+
+ 2012-07-26T00:00:00Z
+
+
+
+
+ 333-7654321-7654321
+ 2013-09-071T02:00:00.000-06:00
+ PaymentContract
+ www.merchantsite.com
+
+ Principal
+
+ USD
+ 2.99
+
+
+
+
+ VariableClosingFee
+
+ USD
+ -0.99
+
+
+
+ GiftWrapFee
+
+ USD
+ -3.99
+
+
+
+ Sales
+ Pay with amazon transaction
+ MFN
+ TestStoreName
+
+
+ 555-7654321-7654321
+ 2013-09-091T02:00:00.000-06:00
+ PaymentContract2
+ www.merchantsite2.com
+
+ VicePrincipal
+
+ USD
+ 5.99
+
+
+
+
+ GiftWrapFee
+
+ USD
+ -1.99
+
+
+
+ Sales2
+ Pay more with amazon transaction
+ AFN
+ TestStoreName2
+
+
+
+
+ SolutionProviderCredit
+ 333-7654321-7654321
+ 12
+ US
+ 987918809
+ TestSellerStoreName
+ 6798769889
+ TestProviderStoreName
+
+
+ SolutionProviderCredit2
+ 555-7654321-7654321
+ 13
+ US
+ 999918809
+ TestSellerStoreName2
+ 6798769999
+ TestProviderStoreName2
+
+
+
+
+ Retrocharge
+ 333-1234567-1234567
+ 2013-09-071T02:00:00.000-06:00
+
+ USD
+ 1.99
+
+
+ USD
+ 2.99
+
+ amazon.com
+
+
+ Retrocharge2
+ 999-1234567-1234567
+ 2013-09-081T02:00:00.000-06:00
+
+ USD
+ 3.99
+
+
+ USD
+ 4.99
+
+ amazon2.com
+
+
+
+
+ 333-1234567-1234567
+ RentalCustomerPayment-Buyout
+ 2013-09-071T02:00:00.000-06:00
+ 12
+
+
+ Tax
+
+ USD
+ 0.99
+
+
+
+ TaxTax
+
+ USD
+ 0.50
+
+
+
+
+
+ SalesTaxServiceFee
+
+ USD
+ -1.99
+
+
+
+ SalesTaxServiceFeeTax
+
+ USD
+ -0.99
+
+
+
+ amazon.com
+
+ USD
+ 3.99
+
+
+ USD
+ 1.99
+
+
+
+ 555-1234567-1234567
+ RentalCustomerPayment-Buyout2
+ 2013-09-081T02:00:00.000-06:00
+ 11
+
+
+ RentalTax
+
+ USD
+ 0.70
+
+
+
+
+
+ SalesTaxTax
+
+ USD
+ -0.70
+
+
+
+ amazon2.com
+
+ USD
+ 5.99
+
+
+ USD
+ 4.99
+
+
+
+
+
+ US
+
+ USD
+ 1.99
+
+
+ gl_books
+ gl_magazines
+
+
+
+ UK
+
+ EUR
+ 2.99
+
+
+ gl_boxes
+
+
+
+
+
+ 333-1234567-1234567
+ fba inbound defect fee
+
+
+ FBAOrderHandlingFee
+
+ USD
+ -0.99
+
+
+
+ FBAOrderHandlingFeeTax
+
+ USD
+ -1.99
+
+
+
+ CBA_OF_1
+ AKSJD12
+ Test Fee description
+ BT0093TELA
+
+
+ 555-1234567-1234567
+ fba inbound defect again
+
+
+ HandlingFee
+
+ USD
+ -3.99
+
+
+
+ CBA_OF_2
+ ASDFJ12
+ Test Fee more
+ BT0093F0N3
+
+
+
+
+ DebtAdjustment
+
+ USD
+ 10.99
+
+
+ USD
+ 8.99
+
+
+
+
+ USD
+ 5.99
+
+
+ USD
+ 4.99
+
+ 2013-09-09T01:30:00.000-06:00
+ 2013-09-23T01:30:00.000-06:00
+
+
+
+ USD
+ 3.99
+
+
+ USD
+ 2.99
+
+ 2013-09-10T01:30:00.000-06:00
+ 2013-09-24T01:30:00.000-06:00
+
+
+
+
+ Credit card
+ 9887
+
+ USD
+ 9.99
+
+
+
+ Debit card
+ 9889
+
+ USD
+ 10.99
+
+
+
+
+
+ DebtAdjustment2
+
+ USD
+ 11.99
+
+
+ USD
+ 9.99
+
+
+
+
+ USD
+ 2.99
+
+
+ USD
+ 1.99
+
+ 2013-09-11T01:30:00.000-06:00
+ 2013-09-25T01:30:00.000-06:00
+
+
+
+
+ Debit card
+ 1234
+
+ USD
+ 5.99
+
+
+
+
+
+
+
+
+ USD
+ 13.99
+
+ LoanAdvance
+
+
+
+ USD
+ 15.99
+
+ LoanAdvance2
+
+
+
+
+ PostageBilling
+
+ USD
+ -5.99
+
+
+
+ 2
+
+ USD
+ -1.99
+
+
+ USD
+ -5.99
+
+ ASK_AS_1
+ ASLKLDS12
+ Test Product
+ BT0093TELA
+
+
+ 1
+
+ USD
+ -2.99
+
+
+ USD
+ -6.99
+
+ ASK_AS_2
+ ASDFJDS12
+ Test Product 2
+ BT0093F0N3
+
+
+
+
+ PostageBilling2
+
+ USD
+ -8.99
+
+
+
+ 3
+
+ USD
+ -4.99
+
+
+ USD
+ -7.99
+
+ ASK_AS_3
+ ASDFJDS99
+ Test Product 3
+ BT0093BNNA
+
+
+
+
+
+
+
+ 1105b931-6f1c-4480-8e97-f3b46EXAMPLE
+
+
diff --git a/test-cases/mock/fetchFinancialEventsToken.xml b/test-cases/mock/fetchFinancialEventsToken.xml
new file mode 100644
index 00000000..404aa881
--- /dev/null
+++ b/test-cases/mock/fetchFinancialEventsToken.xml
@@ -0,0 +1,669 @@
+
+
+
+ Token!
+
+
+
+ 333-1234567-1234567
+ 333-1234567-7654321
+ amazon.com
+
+
+ Principal
+
+ USD
+ 10.00
+
+
+
+ Tax
+
+ USD
+ 1.00
+
+
+
+
+
+ FBAStorageFee
+
+ USD
+ -1.50
+
+
+
+ FBAStorageTax
+
+ USD
+ -5.00
+
+
+
+
+
+ LabellingFee
+
+ USD
+ -1.00
+
+
+
+ LabellingTax
+
+ USD
+ -3.00
+
+
+
+ 2012-07-18T00:00:00Z
+
+
+ StoredValuedCardRevenue
+
+ USD
+ 1.20
+
+
+
+ Money
+
+ USD
+ 5.50
+
+
+
+
+
+ CBA_OTF_1
+ 6882857EXAMPLE
+ 2
+
+
+ Discount
+
+ USD
+ 1.99
+
+
+
+ Tax
+
+ USD
+ 0.50
+
+
+
+
+
+ FBAStorageFee
+
+ USD
+ -1.99
+
+
+
+ ItemFeeTax
+
+ USD
+ -0.99
+
+
+
+
+
+ Shipping
+ SummerEXAMPLE
+
+ USD
+ -15.99
+
+
+
+ Shipping2
+ WinterEXAMPLE
+
+ USD
+ -3.99
+
+
+
+
+ USD
+ -5.99
+
+
+
+ CBA_OTF_2
+ 9992857EXAMPLE
+ 1
+
+
+ Tax
+
+ USD
+ 0.40
+
+
+
+
+
+ ItemFeeTax
+
+ USD
+ -0.30
+
+
+
+
+
+ Shipping3
+ SpringEXAMPLE
+
+ USD
+ -5.99
+
+
+
+
+ USD
+ -5.99
+
+
+
+
+
+
+
+ 333-7654321-7654321
+ 333-7654321-1234567
+ amazon.com
+
+
+ ShippingCharge
+
+ USD
+ -1.99
+
+
+
+ Giftwrap
+
+ USD
+ -0.99
+
+
+
+
+
+ FBADeliveryServicesFee
+
+ USD
+ 1.99
+
+
+
+ FBAPlacementServiceFee
+
+ USD
+ 0.99
+
+
+
+
+
+ FBAInventoryReturnFee
+
+ USD
+ 1.99
+
+
+
+ FBAInventoryReturnFee2
+
+ USD
+ 2.99
+
+
+
+ 2012-07-18T00:00:00Z
+
+
+ CBA_OTF_1
+ 999EXAMPLE123
+ 6882857EXAMPLE
+ 4
+
+
+ ReturnShipping
+
+ USD
+ -1.99
+
+
+
+ Tax
+
+ USD
+ -0.99
+
+
+
+
+
+ ShippingChargeback
+
+ USD
+ 2.99
+
+
+
+ ShippingTax
+
+ USD
+ 0.99
+
+
+
+
+
+ Shipping
+ Summer099018
+
+ USD
+ 22.99
+
+
+
+ Shipping2
+ Winter099018
+
+ USD
+ 11.99
+
+
+
+
+ USD
+ 5.99
+
+
+
+ CBA_OTF_2
+ 999EXAMPLE456
+ 9992857EXAMPLE
+ 3
+
+
+ Tax
+
+ USD
+ -3.99
+
+
+
+
+
+ ShippingTax
+
+ USD
+ 2.99
+
+
+
+
+
+ Shipping3
+ Spring099018
+
+ USD
+ 5.99
+
+
+
+
+ USD
+ 2.99
+
+
+
+
+
+
+
+ 333-5551234-7654321
+ 333-5551234-1234567
+ amazon.com
+
+
+ ShippingCharge
+
+ USD
+ -5.99
+
+
+
+ 2012-07-20T00:00:00Z
+
+
+ CBA_OTF_1
+ 6992857EXAMPLE
+ 6992859EXAMPLE
+ 3
+
+
+ Tax
+
+ USD
+ -0.99
+
+
+
+
+
+ CBA_OTF_2
+ 9992857EXAMPLE
+ 9992897EXAMPLE
+ 3
+
+
+ Tax
+
+ USD
+ -3.50
+
+
+
+
+
+
+
+
+
+ 555-7654321-7654321
+ 555-7654321-1234567
+ amazon.com
+
+
+ ShippingCharge
+
+ USD
+ 17.99
+
+
+
+ Giftwrap
+
+ USD
+ 18.99
+
+
+
+ 2012-07-25T00:00:00Z
+
+
+
+
+ 333-7654321-7654321
+ 2013-09-071T02:00:00.000-06:00
+ PaymentContract
+ www.merchantsite.com
+
+ Principal
+
+ USD
+ 2.99
+
+
+
+
+ VariableClosingFee
+
+ USD
+ -0.99
+
+
+
+ GiftWrapFee
+
+ USD
+ -3.99
+
+
+
+ Sales
+ Pay with amazon transaction
+ MFN
+ TestStoreName
+
+
+
+
+ SolutionProviderCredit
+ 333-7654321-7654321
+ 12
+ US
+ 987918809
+ TestSellerStoreName
+ 6798769889
+ TestProviderStoreName
+
+
+
+
+ Retrocharge
+ 333-1234567-1234567
+ 2013-09-071T02:00:00.000-06:00
+
+ USD
+ 1.99
+
+
+ USD
+ 2.99
+
+ amazon.com
+
+
+
+
+ 333-1234567-1234567
+ RentalCustomerPayment-Buyout
+ 2013-09-071T02:00:00.000-06:00
+ 12
+
+
+ Tax
+
+ USD
+ 0.99
+
+
+
+ TaxTax
+
+ USD
+ 0.50
+
+
+
+
+
+ SalesTaxServiceFee
+
+ USD
+ -1.99
+
+
+
+ SalesTaxServiceFeeTax
+
+ USD
+ -0.99
+
+
+
+ amazon.com
+
+ USD
+ 3.99
+
+
+ USD
+ 1.99
+
+
+
+
+
+ US
+
+ USD
+ 1.99
+
+
+ gl_books
+ gl_magazines
+
+
+
+
+
+ 333-1234567-1234567
+ fba inbound defect fee
+
+
+ FBAOrderHandlingFee
+
+ USD
+ -0.99
+
+
+
+ FBAOrderHandlingFeeTax
+
+ USD
+ -1.99
+
+
+
+ CBA_OF_1
+ AKSJD12
+ Test Fee description
+ BT0093TELA
+
+
+
+
+ DebtAdjustment
+
+ USD
+ 10.99
+
+
+ USD
+ 8.99
+
+
+
+
+ USD
+ 5.99
+
+
+ USD
+ 4.99
+
+ 2013-09-09T01:30:00.000-06:00
+ 2013-09-23T01:30:00.000-06:00
+
+
+
+ USD
+ 3.99
+
+
+ USD
+ 2.99
+
+ 2013-09-10T01:30:00.000-06:00
+ 2013-09-24T01:30:00.000-06:00
+
+
+
+
+ Credit card
+ 9887
+
+ USD
+ 9.99
+
+
+
+ Debit card
+ 9889
+
+ USD
+ 10.99
+
+
+
+
+
+
+
+
+ USD
+ 13.99
+
+ LoanAdvance
+
+
+
+
+ PostageBilling
+
+ USD
+ -5.99
+
+
+
+ 2
+
+ USD
+ -1.99
+
+
+ USD
+ -5.99
+
+ ASK_AS_1
+ ASLKLDS12
+ Test Product
+ BT0093TELA
+
+
+ 1
+
+ USD
+ -2.99
+
+
+ USD
+ -6.99
+
+ ASK_AS_2
+ ASDFJDS12
+ Test Product 2
+ BT0093F0N3
+
+
+
+
+
+
+
+ 1105b931-6f1c-4480-8e97-f3b46EXAMPLE
+
+
+
diff --git a/test-cases/mock/fetchFinancialEventsToken2.xml b/test-cases/mock/fetchFinancialEventsToken2.xml
new file mode 100644
index 00000000..889c4378
--- /dev/null
+++ b/test-cases/mock/fetchFinancialEventsToken2.xml
@@ -0,0 +1,354 @@
+
+
+
+
+
+
+ 999-1234567-1234567
+ 999-1234567-7654321
+ amazon2.com
+
+
+ Main
+
+ USD
+ 12.00
+
+
+
+
+
+ BigFee
+
+ USD
+ -10.50
+
+
+
+
+
+ LabellingFee2
+
+ USD
+ -2.00
+
+
+
+ 2012-07-19T00:00:00Z
+
+
+ Money
+
+ USD
+ 2.50
+
+
+
+
+
+ CBA_OTF_3
+ 3212857EXAMPLE
+ 3
+
+ USD
+ -1.99
+
+
+
+
+
+
+
+ 999-7654321-7654321
+ 999-7654321-1234567
+ amazon2.com
+
+
+ Giftwrap2
+
+ USD
+ -0.99
+
+
+
+
+
+ FBAPlacementServiceFee2
+
+ USD
+ 0.99
+
+
+
+
+
+ FBAInventoryReturnFee3
+
+ USD
+ 2.99
+
+
+
+ 2012-07-19T00:00:00Z
+
+
+ CBA_OTF_3
+ 999EXAMPLE789
+ 9992857EXAMPLE2
+ 5
+
+ USD
+ 1.99
+
+
+
+
+
+
+
+ 999-5554321-7654321
+ 999-5554321-1234567
+ amazon2.com
+
+
+ FBAPlacementServiceFee
+
+ USD
+ 7.99
+
+
+
+ FBAPlacementServiceFee2
+
+ USD
+ 5.99
+
+
+
+ 2012-07-21T00:00:00Z
+
+
+
+
+ 999-5554321-7654321
+ 999-5554321-1234567
+ amazon2.com
+
+
+ FeeTax
+
+ USD
+ 2.75
+
+
+
+ BigFee
+
+ USD
+ 5.75
+
+
+
+ 2012-07-26T00:00:00Z
+
+
+
+
+ 555-7654321-7654321
+ 2013-09-091T02:00:00.000-06:00
+ PaymentContract2
+ www.merchantsite2.com
+
+ VicePrincipal
+
+ USD
+ 5.99
+
+
+
+
+ GiftWrapFee
+
+ USD
+ -1.99
+
+
+
+ Sales2
+ Pay more with amazon transaction
+ AFN
+ TestStoreName2
+
+
+
+
+ SolutionProviderCredit2
+ 555-7654321-7654321
+ 13
+ US
+ 999918809
+ TestSellerStoreName2
+ 6798769999
+ TestProviderStoreName2
+
+
+
+
+ Retrocharge2
+ 999-1234567-1234567
+ 2013-09-081T02:00:00.000-06:00
+
+ USD
+ 3.99
+
+
+ USD
+ 4.99
+
+ amazon2.com
+
+
+
+
+ 555-1234567-1234567
+ RentalCustomerPayment-Buyout2
+ 2013-09-081T02:00:00.000-06:00
+ 11
+
+
+ RentalTax
+
+ USD
+ 0.70
+
+
+
+
+
+ SalesTaxTax
+
+ USD
+ -0.70
+
+
+
+ amazon2.com
+
+ USD
+ 5.99
+
+
+ USD
+ 4.99
+
+
+
+
+
+ UK
+
+ EUR
+ 2.99
+
+
+ gl_boxes
+
+
+
+
+
+ 555-1234567-1234567
+ fba inbound defect again
+
+
+ HandlingFee
+
+ USD
+ -3.99
+
+
+
+ CBA_OF_2
+ ASDFJ12
+ Test Fee more
+ BT0093F0N3
+
+
+
+
+ DebtAdjustment2
+
+ USD
+ 11.99
+
+
+ USD
+ 9.99
+
+
+
+
+ USD
+ 2.99
+
+
+ USD
+ 1.99
+
+ 2013-09-11T01:30:00.000-06:00
+ 2013-09-25T01:30:00.000-06:00
+
+
+
+
+ Debit card
+ 1234
+
+ USD
+ 5.99
+
+
+
+
+
+
+
+
+ USD
+ 15.99
+
+ LoanAdvance2
+
+
+
+
+ PostageBilling2
+
+ USD
+ -8.99
+
+
+
+ 3
+
+ USD
+ -4.99
+
+
+ USD
+ -7.99
+
+ ASK_AS_3
+ ASDFJDS99
+ Test Product 3
+ BT0093BNNA
+
+
+
+
+
+
+
+ 1105b931-6f1c-4480-8e97-f3b46EXAMPLE
+
+
diff --git a/test-cases/mock/fetchFinancialGroups.xml b/test-cases/mock/fetchFinancialGroups.xml
new file mode 100644
index 00000000..9cdce17b
--- /dev/null
+++ b/test-cases/mock/fetchFinancialGroups.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+ 22YgYW55IGNhcm5hbCBwbGVhEXAMPLE
+ Closed
+ Successful
+
+ USD
+ 19.00
+
+
+ USD
+ 19.50
+
+ 2014-09-09T01:30:00.000-06:00
+ 128311029381HSADJEXAMPLE
+ 1212
+
+ USD
+ 0.00
+
+ 2014-09-01T01:30:00.000-06:00
+ 2014-09-09T01:30:00.000-06:00
+
+
+ 22Y99995IGNhcm5hbANOTHEREXAMPLE
+ Closed2
+ Successful2
+
+ USD
+ 42.00
+
+
+ USD
+ 42.50
+
+ 2014-10-09T01:30:00.000-06:00
+ 128999929381HADJEXAMPLE2
+ 1313
+
+ USD
+ 20.00
+
+ 2014-10-01T01:30:00.000-06:00
+ 2014-10-09T01:30:00.000-06:00
+
+
+
+
+ 1105b931-6f1c-4480-8e97-f3b46EXAMPLE
+
+
diff --git a/test-cases/mock/fetchFinancialGroupsToken.xml b/test-cases/mock/fetchFinancialGroupsToken.xml
new file mode 100644
index 00000000..71aba410
--- /dev/null
+++ b/test-cases/mock/fetchFinancialGroupsToken.xml
@@ -0,0 +1,33 @@
+
+
+
+ Token!
+
+
+ 22YgYW55IGNhcm5hbCBwbGVhEXAMPLE
+ Closed
+ Successful
+
+ USD
+ 19.00
+
+
+ USD
+ 19.00
+
+ 2014-09-09T01:30:00.000-06:00
+ 128311029381HSADJEXAMPLE
+ 1212
+
+ USD
+ 0.00
+
+ 2014-09-01T01:30:00.000-06:00
+ 2014-09-09T01:30:00.000-06:00
+
+
+
+
+ 1105b931-6f1c-4480-8e97-f3b46EXAMPLE
+
+
diff --git a/test-cases/mock/fetchFinancialGroupsToken2.xml b/test-cases/mock/fetchFinancialGroupsToken2.xml
new file mode 100644
index 00000000..05ca31b2
--- /dev/null
+++ b/test-cases/mock/fetchFinancialGroupsToken2.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+ 22Y99995IGNhcm5hbANOTHEREXAMPLE
+ Closed2
+ Successful2
+
+ USD
+ 42.00
+
+
+ USD
+ 42.00
+
+ 2014-05-09T01:30:00.000-06:00
+ 128311029381HSADJEXAMPLE
+ 1212
+
+ USD
+ 20.00
+
+ 2014-05-01T01:30:00.000-06:00
+ 2014-05-09T01:30:00.000-06:00
+
+
+
+
+ 1105b931-6f1c-4480-8e97-f3b46EXAMPLE
+
+
+