_currentMethod->authorization_mode_erp_disabled == 'automatic_synchronous') {
return;
}
$order_history = array();
$amazonState = "";
$reasonCode = "";
if (!$this->amazonData->isSetOrderReference()) {
return NULL;
}
$orderReference = $this->amazonData->getOrderReference();
if (!$orderReference->isSetAmazonOrderReferenceId()) {
return NULL;
}
$status =$orderReference->isSetOrderReferenceStatus();
if (!$status->isSetState()) {
return NULL;
}
$amazonState = $status->getState();
if (!$status->isSetReasonCode()) {
return NULL;
}
$reasonCode = $status->getReasonCode();
// default value
$order_history['customer_notified'] = 0;
if ($amazonState != 'Open') {
$order_history['order_status'] = $this->_currentMethod->status_cancel;
} else {
$order_history['order_status'] = $this->_currentMethod->status_authorization;
}
$order_history['comments'] = $reasonCode;
$order_history['amazonState'] = $amazonState;
$orderModel = VmModel::getModel('orders');
$orderModel->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order_history, false);
}
/**
* *
* if moves to Open, then allowed operations are: getOrderReferenceDetails, Cancel, CloseOrder, authorize
* if moves to Suspended, then allowed operations are: getOrderReferenceDetails, Cancel, CloseOrder
* if moves to Canceled, then allowed operations are: getOrderReferenceDetails
* if moves to Closed, then allowed operations are: getOrderReferenceDetails
*
* @param $order
* @param $payments
* @param $amazonState
* @return bool|string
*/
public function onNotificationNextOperation ($order, $payments, $amazonState) {
if ($amazonState == 'Open') {
return 'onNotificationGetAuthorization';
}
return false;
}
public function getStoreInternalData () {
//$amazonInternalData = $this->getStoreResultParams();
$amazonInternalData = new stdClass();
if ($this->amazonData->isSetOrderReference()) {
$details = $this->amazonData->getOrderReference();
if ($details->isSetAmazonOrderReferenceId()) {
$amazonInternalData->amazon_response_amazonReferenceId = $details->getAmazonOrderReferenceId();
}
if ($details->isSetOrderReferenceStatus()) {
$status = $details->getOrderReferenceStatus();
if ($status->isSetState()) {
$amazonInternalData->amazon_response_state = $status->getState();
}
if ($status->isSetReasonCode()) {
$amazonInternalData->amazon_response_reasonCode = $status->getReasonCode();
}
if ($status->isSetReasonDescription()) {
$amazonInternalData->amazon_response_reasonDescription = $status->getReasonDescription();
}
}
}
return $amazonInternalData;
}
function getReferenceId () {
if (!$this->amazonData->isSetOrderReference()) {
return NULL;
}
$orderReference = $this->amazonData->getOrderReference();
if (!$orderReference->isSetSellerOrderAttributes()) {
return NULL;
}
$sellerOrderAttributes = $orderReference->getSellerOrderAttributes();
return $sellerOrderAttributes->getSellerOrderId();
}
function getAmazonReferenceId () {
if (!$this->amazonData->isSetOrderReference()) {
return NULL;
}
$orderReference = $this->amazonData->getOrderReference();
if (!$orderReference->isSetAmazonOrderReferenceId()) {
return NULL;
}
return $orderReference->getAmazonOrderReferenceId();
}
function getContents () {
$contents = $this->tableStart("OrderReference Notification");
if ($this->amazonData->isSetOrderReference()) {
$contents .= $this->getRowFirstCol("OrderReference");
$orderReference = $this->amazonData->getOrderReference();
if ($orderReference->isSetAmazonOrderReferenceId()) {
$contents .= $this->getRow("AmazonOrderReferenceId: ", $orderReference->getAmazonOrderReferenceId());
}
if ($orderReference->isSetOrderTotal()) {
$more = '';
$orderTotal = $orderReference->getOrderTotal();
if ($orderTotal->isSetAmount()) {
$more .= "
Amount: " . $orderTotal->getAmount();
}
if ($orderTotal->isSetCurrencyCode()) {
$more .= "
CurrencyCode: " . $orderTotal->getCurrencyCode();
}
$contents .= $this->getRow("OrderTotal: ", $more);
}
if ($orderReference->isSetSellerOrderAttributes()) {
$more = '';
$sellerOrderAttributes = $orderReference->getSellerOrderAttributes();
if ($sellerOrderAttributes->isSetSellerId()) {
$more .= "
SellerId: " . $sellerOrderAttributes->getSellerId();
}
if ($sellerOrderAttributes->isSetSellerOrderId()) {
$more .= "
SellerOrderId: " . $sellerOrderAttributes->getSellerOrderId();
}
if ($sellerOrderAttributes->isSetOrderItemCategories()) {
$more .= "
OrderItemCategories";
$orderItemCategories = $sellerOrderAttributes->getOrderItemCategories();
$orderItemCategoryList = $orderItemCategories->getOrderItemCategory();
foreach ($orderItemCategoryList as $orderItemCategory) {
$more .= "
OrderItemCategory: " . $orderItemCategory;
}
}
$contents .= $this->getRow("IdList: ", $more);
}
if ($orderReference->isSetOrderReferenceStatus()) {
$more = '';
$orderReferenceStatus = $orderReference->getOrderReferenceStatus();
if ($orderReferenceStatus->isSetState()) {
$more .= "
State";
$more .= $orderReferenceStatus->getState();
}
if ($orderReferenceStatus->isSetLastUpdateTimestamp()) {
$more .= "
LastUpdateTimestamp: " . $orderReferenceStatus->getLastUpdateTimestamp();
}
if ($orderReferenceStatus->isSetReasonCode()) {
$more .= "
ReasonCode: " . $orderReferenceStatus->getReasonCode();
}
if ($orderReferenceStatus->isSetReasonDescription()) {
$more .= "
ReasonDescription: " . $orderReferenceStatus->getReasonDescription();
}
$contents .= $this->getRow("CaptureStatus: ", $more);
}
if ($orderReference->isSetCreationTimestamp()) {
$contents .= $this->getRow("CreationTimestamp: ", $orderReference->getCreationTimestamp());
}
if ($orderReference->isSetExpirationTimestamp()) {
$contents .= $this->getRow("ExpirationTimestamp: ", $orderReference->getExpirationTimestamp());
}
}
$contents .= $this->tableEnd();
return $contents;
}
}