public update_label_order_meta_data ( $order_id, $new_label_data ) |
public function get_item($request) { $response = $this->api_client->get_label_status($request['label_id']); if (is_wp_error($response)) { $error = new WP_Error($response->get_error_code(), $response->get_error_message(), array('message' => $response->get_error_message())); $this->logger->log($error, __CLASS__); return $error; } $this->settings_store->update_label_order_meta_data($request['order_id'], $response->label); return array('success' => true, 'label' => $response->label); }
public function update_items($request) { $response = $this->api_client->send_shipping_label_refund_request($request['label_id']); if (isset($response->error)) { $response = new WP_Error(property_exists($response->error, 'code') ? $response->error->code : 'refund_error', property_exists($response->error, 'message') ? $response->error->message : ''); } if (is_wp_error($response)) { $response->add_data(array('message' => $response->get_error_message()), $response->get_error_code()); $this->logger->log($response, __CLASS__); return $response; } // TODO: use $response->refund->amount ? $label_refund = (object) array('label_id' => (int) $response->label->id, 'refunded_time' => time() * 1000); $this->settings_store->update_label_order_meta_data($request['order_id'], $label_refund); return array('success' => true, 'label' => $label_refund); }