Skip to content

Commit 82e1c42

Browse files
committed
Added: new response fields in Orders API
1 parent 2c9051a commit 82e1c42

File tree

2 files changed

+237
-2
lines changed

2 files changed

+237
-2
lines changed

includes/classes/AmazonOrder.php

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,18 @@ protected function parseXML($xml){
219219
if (isset($xml->ShipServiceLevelCategory)){
220220
$d['ShipServiceLevelCategory'] = (string)$xml->ShipServiceLevelCategory;
221221
}
222+
if (isset($xml->CbaDisplayableShippingLabel)){
223+
$d['CbaDisplayableShippingLabel'] = (string)$xml->CbaDisplayableShippingLabel;
224+
}
225+
if (isset($xml->ShippedByAmazonTFM)){
226+
$d['ShippedByAmazonTFM'] = (string)$xml->ShippedByAmazonTFM;
227+
}
228+
if (isset($xml->TFMShipmentStatus)){
229+
$d['TFMShipmentStatus'] = (string)$xml->TFMShipmentStatus;
230+
}
231+
if (isset($xml->OrderType)){
232+
$d['OrderType'] = (string)$xml->OrderType;
233+
}
222234
if (isset($xml->EarliestShipDate)){
223235
$d['EarliestShipDate'] = (string)$xml->EarliestShipDate;
224236
}
@@ -592,6 +604,78 @@ public function getShipServiceLevelCategory(){
592604
}
593605
}
594606

607+
/**
608+
* Returns the customized Checkout by Amazon (CBA) label of the Order.
609+
*
610+
* This method will return <b>FALSE</b> if the CBA label category has not been set yet.
611+
* @return string|boolean single value, or <b>FALSE</b> if label not set yet
612+
*/
613+
public function getCbaDisplayableShippingLabel(){
614+
if (isset($this->data['CbaDisplayableShippingLabel'])){
615+
return $this->data['CbaDisplayableShippingLabel'];
616+
} else {
617+
return false;
618+
}
619+
}
620+
621+
/**
622+
* Returns an indication of whether or not the Order was shipped with the Amazon TFM service.
623+
*
624+
* This method will return <b>FALSE</b> if the status has not been set yet.
625+
* @return string|boolean single value, or <b>FALSE</b> if value not set yet
626+
*/
627+
public function getShippedByAmazonTfm(){
628+
if (isset($this->data['ShippedByAmazonTFM'])){
629+
return $this->data['ShippedByAmazonTFM'];
630+
} else {
631+
return false;
632+
}
633+
}
634+
635+
/**
636+
* Returns the status of an Order shipped using Amazon TFM.
637+
*
638+
* This method will return <b>FALSE</b> if the status has not been set yet.
639+
* Valid values for the status are...
640+
* <ul>
641+
* <li>PendingPickUp</li>
642+
* <li>LabelCanceled</li>
643+
* <li>PickedUp</li>
644+
* <li>AtDestinationFC</li>
645+
* <li>Delivered</li>
646+
* <li>RejectedByBuyer</li>
647+
* <li>Undeliverable</li>
648+
* <li>ReturnedToSeller</li>
649+
* </ul>
650+
* @return string|boolean single value, or <b>FALSE</b> if status not set yet
651+
*/
652+
public function getTfmShipmentStatus(){
653+
if (isset($this->data['TFMShipmentStatus'])){
654+
return $this->data['TFMShipmentStatus'];
655+
} else {
656+
return false;
657+
}
658+
}
659+
660+
/**
661+
* Returns the type of the order.
662+
*
663+
* This method will return <b>FALSE</b> if the type has not been set yet.
664+
* Valid values for the type are...
665+
* <ul>
666+
* <li>StandardOrder</li>
667+
* <li>Preorder</li>
668+
* </ul>
669+
* @return string|boolean single value, or <b>FALSE</b> if order type not set yet
670+
*/
671+
public function getOrderType(){
672+
if (isset($this->data['OrderType'])){
673+
return $this->data['OrderType'];
674+
} else {
675+
return false;
676+
}
677+
}
678+
595679
/**
596680
* Returns the timestamp of the earliest shipping date.
597681
*

includes/classes/AmazonOrderItemList.php

Lines changed: 153 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,35 @@ protected function parseXML($xml){
253253
$i++;
254254
}
255255
}
256+
if (isset($item->InvoiceData)){
257+
if (isset($item->InvoiceData->InvoiceRequirement)){
258+
$this->itemList[$n]['InvoiceData']['InvoiceRequirement'] = (string)$item->InvoiceData->InvoiceRequirement;
259+
}
260+
if (isset($item->InvoiceData->BuyerSelectedInvoiceCategory)){
261+
$this->itemList[$n]['InvoiceData']['BuyerSelectedInvoiceCategory'] = (string)$item->InvoiceData->BuyerSelectedInvoiceCategory;
262+
}
263+
if (isset($item->InvoiceData->InvoiceTitle)){
264+
$this->itemList[$n]['InvoiceData']['InvoiceTitle'] = (string)$item->InvoiceData->InvoiceTitle;
265+
}
266+
if (isset($item->InvoiceData->InvoiceInformation)){
267+
$this->itemList[$n]['InvoiceData']['InvoiceInformation'] = (string)$item->InvoiceData->InvoiceInformation;
268+
}
269+
}
270+
if (isset($item->ConditionId)){
271+
$this->itemList[$n]['ConditionId'] = (string)$item->ConditionId;
272+
}
273+
if (isset($item->ConditionSubtypeId)){
274+
$this->itemList[$n]['ConditionSubtypeId'] = (string)$item->ConditionSubtypeId;
275+
}
276+
if (isset($item->ConditionNote)){
277+
$this->itemList[$n]['ConditionNote'] = (string)$item->ConditionNote;
278+
}
279+
if (isset($item->ScheduledDeliveryStartDate)){
280+
$this->itemList[$n]['ScheduledDeliveryStartDate'] = (string)$item->ScheduledDeliveryStartDate;
281+
}
282+
if (isset($item->ScheduledDeliveryEndDate)){
283+
$this->itemList[$n]['ScheduledDeliveryEndDate'] = (string)$item->ScheduledDeliveryEndDate;
284+
}
256285
$this->index++;
257286
}
258287

@@ -608,7 +637,7 @@ public function getPromotionDiscount($i = 0, $only = false){
608637
}
609638

610639
/**
611-
* Returns specified promotion ID for specified item.
640+
* Returns specified promotion ID for the specified item.
612641
*
613642
* This method will return the entire list of Promotion IDs if <i>$j</i> is not set.
614643
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
@@ -625,7 +654,129 @@ public function getPromotionIds($i = 0, $j = null){
625654
} else {
626655
return false;
627656
}
628-
657+
}
658+
659+
/**
660+
* Returns invoice data for the specified item.
661+
*
662+
* This method will return <b>FALSE</b> if the list has not yet been filled.
663+
* The array for invoice data may have the following fields:
664+
* <ul>
665+
* <li><b>InvoiceRequirement</b> - invoice requirement information</li>
666+
* <li><b>BuyerSelectedInvoiceCategory</b> - invoice category information selected by the buyer</li>
667+
* <li><b>InvoiceTitle</b> - the title of the invoice as specified by the buyer</li>
668+
* <li><b>InvoiceInformation</b> - additional invoice information</li>
669+
* </ul>
670+
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
671+
* @return array|boolean array, or <b>FALSE</b> if incorrect index
672+
*/
673+
public function getInvoiceData($i = 0){
674+
if (isset($this->itemList[$i]['InvoiceData'])){
675+
return $this->itemList[$i]['InvoiceData'];
676+
} else {
677+
return false;
678+
}
679+
}
680+
681+
/**
682+
* Returns the condition for the specified item.
683+
*
684+
* This method will return <b>FALSE</b> if the list has not yet been filled.
685+
* Possible values for the condition ID are...
686+
* <ul>
687+
* <li>New</li>
688+
* <li>Used</li>
689+
* <li>Collectible</li>
690+
* <li>Refurbished</li>
691+
* <li>Preorder</li>
692+
* <li>Club</li>
693+
* </ul>
694+
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
695+
* @return string|boolean single value, or <b>FALSE</b> if incorrect index
696+
*/
697+
public function getConditionId($i = 0){
698+
if (isset($this->itemList[$i]['ConditionId'])){
699+
return $this->itemList[$i]['ConditionId'];
700+
} else {
701+
return false;
702+
}
703+
}
704+
705+
/**
706+
* Returns the subcondition for the specified item.
707+
*
708+
* This method will return <b>FALSE</b> if the list has not yet been filled.
709+
* Possible values for the subcondition ID are...
710+
* <ul>
711+
* <li>New</li>
712+
* <li>Mint</li>
713+
* <li>Very Good</li>
714+
* <li>Good</li>
715+
* <li>Acceptable</li>
716+
* <li>Poor</li>
717+
* <li>Club</li>
718+
* <li>OEM</li>
719+
* <li>Warranty</li>
720+
* <li>Refurbished Warranty</li>
721+
* <li>Refurbished</li>
722+
* <li>Open Box</li>
723+
* <li>Any</li>
724+
* <li>Other</li>
725+
* </ul>
726+
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
727+
* @return string|boolean single value, or <b>FALSE</b> if incorrect index
728+
*/
729+
public function getConditionSubtypeId($i = 0){
730+
if (isset($this->itemList[$i]['ConditionSubtypeId'])){
731+
return $this->itemList[$i]['ConditionSubtypeId'];
732+
} else {
733+
return false;
734+
}
735+
}
736+
737+
/**
738+
* Returns the condition description for the specified item.
739+
*
740+
* This method will return <b>FALSE</b> if the list has not yet been filled.
741+
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
742+
* @return string|boolean single value, or <b>FALSE</b> if incorrect index
743+
*/
744+
public function getConditionNote($i = 0){
745+
if (isset($this->itemList[$i]['ConditionNote'])){
746+
return $this->itemList[$i]['ConditionNote'];
747+
} else {
748+
return false;
749+
}
750+
}
751+
752+
/**
753+
* Returns the earliest date in the scheduled delivery window for the specified item.
754+
*
755+
* This method will return <b>FALSE</b> if the list has not yet been filled.
756+
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
757+
* @return string|boolean single value, or <b>FALSE</b> if incorrect index
758+
*/
759+
public function getScheduledDeliveryStartDate($i = 0){
760+
if (isset($this->itemList[$i]['ScheduledDeliveryStartDate'])){
761+
return $this->itemList[$i]['ScheduledDeliveryStartDate'];
762+
} else {
763+
return false;
764+
}
765+
}
766+
767+
/**
768+
* Returns the latest date in the scheduled delivery window for the specified item.
769+
*
770+
* This method will return <b>FALSE</b> if the list has not yet been filled.
771+
* @param int $i [optional] <p>List index to retrieve the value from. Defaults to 0.</p>
772+
* @return string|boolean single value, or <b>FALSE</b> if incorrect index
773+
*/
774+
public function getScheduledDeliveryEndDate($i = 0){
775+
if (isset($this->itemList[$i]['ScheduledDeliveryEndDate'])){
776+
return $this->itemList[$i]['ScheduledDeliveryEndDate'];
777+
} else {
778+
return false;
779+
}
629780
}
630781

631782
/**

0 commit comments

Comments
 (0)