Ejemplo n.º 1
0
 public function orderStatusChange($order_id, $data)
 {
     if ($this->config->get('amazon_checkout_status') == 1) {
         $order = $this->getOrder($order_id);
         if ($order) {
             $this->load->library('cba');
             $cba = new CBA($this->config->get('amazon_checkout_merchant_id'), $this->config->get('amazon_checkout_access_key'), $this->config->get('amazon_checkout_access_secret'), $this->config->get('amazon_checkout_marketplace'));
             if ($data['order_status_id'] == $this->config->get('amazon_checkout_shipped_status_id')) {
                 $cba->orderShipped($order);
             }
             if ($data['order_status_id'] == $this->config->get('amazon_checkout_canceled_status_id')) {
                 $cba->orderCanceled($order);
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function uploadOrderAdjustment()
 {
     $this->load->language('payment/amazon_checkout');
     $json = array();
     if (!empty($this->request->files['file']['name'])) {
         $filename = basename(html_entity_decode($this->request->files['file']['name'], ENT_QUOTES, 'UTF-8'));
         if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
             $json['error'] = $this->language->get('error_upload');
         }
     } else {
         $json['error'] = $this->language->get('error_upload');
     }
     if (!isset($json['error'])) {
         if (is_uploaded_file($this->request->files['file']['tmp_name']) && file_exists($this->request->files['file']['tmp_name'])) {
             $flat = str_replace(",", "\t", file_get_contents($this->request->files['file']['tmp_name']));
             $this->load->library('cba');
             $cba = new CBA($this->config->get('amazon_checkout_merchant_id'), $this->config->get('amazon_checkout_access_key'), $this->config->get('amazon_checkout_access_secret'), $this->config->get('amazon_checkout_marketplace'));
             $response = $cba->orderAdjustment($flat);
             $response_xml = simplexml_load_string($response);
             $submission_id = (string) $response_xml->SubmitFeedResult->FeedSubmissionInfo->FeedSubmissionId;
             if (!empty($submission_id)) {
                 $json['success'] = $this->language->get('text_upload_success');
                 $json['submission_id'] = $submission_id;
             }
         }
     }
     $this->response->addHeader('Content-Type: application/json');
     $this->response->setOutput(json_encode($json));
 }
 public function cron()
 {
     if (isset($this->request->get['token']) && $this->request->get['token'] == $this->config->get('amazon_checkout_cron_job_token') && $this->config->get('amazon_checkout_status') == 1) {
         $this->load->model('payment/amazon_checkout');
         $this->load->library('cba');
         $cba = new CBA($this->config->get('amazon_checkout_merchant_id'), $this->config->get('amazon_checkout_access_key'), $this->config->get('amazon_checkout_access_secret'));
         $cba->setMode('live');
         $cba->processOrderReports($this->config, $this->db);
         $cba->processFeedResponses($this->config, $this->db);
         $this->model_payment_amazon_checkout->updateCronJobRunTime();
     }
 }