WooCommerce Correios - Version 3.1.0

Version Description

  • 2016/09/13 =

  • Adicionado os mtodos Impresso Normal e Impresso Urgente (obrigado a @jckronbauer).

  • Adicionada opo para enviar novamente e-mail do cdigo de rastreio.

  • Adicionada mensagem de erro quando servio indisponvel no trecho informado.

Download this release

Release Info

Developer claudiosanches
Plugin Icon 128x128 WooCommerce Correios
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.6 to 3.1.0

includes/abstracts/abstract-wc-correios-shipping-carta.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Abstract Correios Carta shipping method.
4
+ *
5
+ * @package WooCommerce_Correios/Abstracts
6
+ * @since 3.1.0
7
+ * @version 3.1.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * Default Correios Carta shipping method abstract class.
16
+ */
17
+ abstract class WC_Correios_Shipping_Carta extends WC_Correios_Shipping {
18
+
19
+ /**
20
+ * Initialize Carta Registrada.
21
+ *
22
+ * @param int $instance_id Shipping zone instance.
23
+ */
24
+ public function __construct( $instance_id = 0 ) {
25
+ $this->instance_id = absint( $instance_id );
26
+ $this->method_description = sprintf( __( '%s is a shipping method from Correios.', 'woocommerce-correios' ), $this->method_title );
27
+ $this->supports = array(
28
+ 'shipping-zones',
29
+ 'instance-settings',
30
+ );
31
+
32
+ // Load the form fields.
33
+ $this->init_form_fields();
34
+
35
+ // Define user set variables.
36
+ $this->enabled = $this->get_option( 'enabled' );
37
+ $this->title = $this->get_option( 'title' );
38
+ $this->shipping_class = $this->get_option( 'shipping_class' );
39
+ $this->fee = $this->get_option( 'fee' );
40
+ $this->receipt_notice = $this->get_option( 'receipt_notice' );
41
+ $this->own_hands = $this->get_option( 'own_hands' );
42
+ $this->debug = $this->get_option( 'debug' );
43
+
44
+ // Active logs.
45
+ if ( 'yes' === $this->debug ) {
46
+ $this->log = new WC_Logger();
47
+ }
48
+
49
+ // Save admin options.
50
+ add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
51
+ }
52
+
53
+ /**
54
+ * Get shipping classes options.
55
+ *
56
+ * @return array
57
+ */
58
+ protected function get_shipping_classes_options() {
59
+ $shipping_classes = WC()->shipping->get_shipping_classes();
60
+ $options = array(
61
+ '' => __( '-- Select a shipping class --', 'woocommerce-correios' ),
62
+ );
63
+
64
+ if ( ! empty( $shipping_classes ) ) {
65
+ $options += wp_list_pluck( $shipping_classes, 'name', 'slug' );
66
+ }
67
+
68
+ return $options;
69
+ }
70
+
71
+ /**
72
+ * Admin options fields.
73
+ */
74
+ public function init_form_fields() {
75
+ $this->instance_form_fields = array(
76
+ 'enabled' => array(
77
+ 'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
78
+ 'type' => 'checkbox',
79
+ 'label' => __( 'Enable this shipping method', 'woocommerce-correios' ),
80
+ 'default' => 'yes',
81
+ ),
82
+ 'title' => array(
83
+ 'title' => __( 'Title', 'woocommerce-correios' ),
84
+ 'type' => 'text',
85
+ 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-correios' ),
86
+ 'desc_tip' => true,
87
+ 'default' => $this->method_title,
88
+ ),
89
+ 'behavior_options' => array(
90
+ 'title' => __( 'Behavior Options', 'woocommerce-correios' ),
91
+ 'type' => 'title',
92
+ 'default' => '',
93
+ ),
94
+ 'shipping_class' => array(
95
+ 'title' => __( 'Shipping Class', 'woocommerce-correios' ),
96
+ 'type' => 'select',
97
+ 'description' => __( 'Select for which shipping class this method will be applied.', 'woocommerce-correios' ),
98
+ 'desc_tip' => true,
99
+ 'default' => '',
100
+ 'class' => 'wc-enhanced-select',
101
+ 'options' => $this->get_shipping_classes_options(),
102
+ ),
103
+ 'fee' => array(
104
+ 'title' => __( 'Handling Fee', 'woocommerce-correios' ),
105
+ 'type' => 'price',
106
+ 'description' => __( 'Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce-correios' ),
107
+ 'desc_tip' => true,
108
+ 'placeholder' => '0.00',
109
+ 'default' => '',
110
+ ),
111
+ 'optional_services' => array(
112
+ 'title' => __( 'Optional Services', 'woocommerce-correios' ),
113
+ 'type' => 'title',
114
+ 'description' => __( 'Use these options to add the value of each service provided by the Correios.', 'woocommerce-correios' ),
115
+ 'default' => '',
116
+ ),
117
+ 'receipt_notice' => array(
118
+ 'title' => __( 'Receipt Notice', 'woocommerce-correios' ),
119
+ 'type' => 'checkbox',
120
+ 'label' => __( 'Enable receipt notice', 'woocommerce-correios' ),
121
+ 'description' => __( 'This controls whether to add costs of the receipt notice service.', 'woocommerce-correios' ),
122
+ 'desc_tip' => true,
123
+ 'default' => 'no',
124
+ ),
125
+ 'own_hands' => array(
126
+ 'title' => __( 'Own Hands', 'woocommerce-correios' ),
127
+ 'type' => 'checkbox',
128
+ 'label' => __( 'Enable own hands', 'woocommerce-correios' ),
129
+ 'description' => __( 'This controls whether to add costs of the own hands service', 'woocommerce-correios' ),
130
+ 'desc_tip' => true,
131
+ 'default' => 'no',
132
+ ),
133
+ 'testing' => array(
134
+ 'title' => __( 'Testing', 'woocommerce-correios' ),
135
+ 'type' => 'title',
136
+ 'default' => '',
137
+ ),
138
+ 'debug' => array(
139
+ 'title' => __( 'Debug Log', 'woocommerce-correios' ),
140
+ 'type' => 'checkbox',
141
+ 'label' => __( 'Enable logging', 'woocommerce-correios' ),
142
+ 'default' => 'no',
143
+ 'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), $this->method_title ) . $this->get_log_link(),
144
+ ),
145
+ );
146
+ }
147
+
148
+ /**
149
+ * Get costs.
150
+ *
151
+ * @return array
152
+ */
153
+ protected function get_costs() {
154
+ return array();
155
+ }
156
+
157
+ /**
158
+ * Get shpping cost.
159
+ *
160
+ * @param array $package Shipping package.
161
+ * @return float
162
+ */
163
+ protected function get_shipping_cost( $package ) {
164
+ return 0;
165
+ }
166
+
167
+ /**
168
+ * Get package weight.
169
+ *
170
+ * @param array $package Shipping package.
171
+ *
172
+ * @return float
173
+ */
174
+ protected function get_package_weight( $package ) {
175
+ $weight = 0;
176
+
177
+ foreach ( $package['contents'] as $value ) {
178
+ $product = $value['data'];
179
+ $qty = $value['quantity'];
180
+ $product_weight = 0;
181
+
182
+ // Check if all or some items in the cart don't supports this shipping method.
183
+ if ( $this->shipping_class !== $product->get_shipping_class() ) {
184
+ if ( 'yes' === $this->debug ) {
185
+ $this->log->add( $this->id, 'One or all items in the cart do not supports the configured shipping class' );
186
+ }
187
+
188
+ return 0;
189
+ }
190
+
191
+ if ( $qty > 0 && $product->needs_shipping() ) {
192
+ $product_weight = wc_get_weight( str_replace( ',', '.', $product->weight ), 'g' );
193
+
194
+ if ( $qty > 1 ) {
195
+ $product_weight *= $qty;
196
+ }
197
+ }
198
+
199
+ $weight += $product_weight;
200
+ }
201
+
202
+ return $weight;
203
+ }
204
+
205
+ /**
206
+ * Calculates the shipping rate.
207
+ *
208
+ * @param array $package Order package.
209
+ */
210
+ public function calculate_shipping( $package = array() ) {
211
+ // Check if valid to be calculeted.
212
+ if ( '' === $package['destination']['postcode'] || 'BR' !== $package['destination']['country'] ) {
213
+ return;
214
+ }
215
+
216
+ // Cost.
217
+ $cost = $this->get_shipping_cost( $package );
218
+
219
+ if ( 0 === $cost ) {
220
+ return;
221
+ }
222
+
223
+ // Apply fees.
224
+ $fee = $this->get_fee( $this->fee, $cost );
225
+
226
+ // Create the rate and apply filters.
227
+ $rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
228
+ 'id' => $this->id . $this->instance_id,
229
+ 'label' => $this->title,
230
+ 'cost' => $cost + $fee,
231
+ ), $this->instance_id );
232
+
233
+ // Add rate to WooCommerce.
234
+ $this->add_rate( $rate );
235
+ }
236
+ }
includes/abstracts/abstract-wc-correios-shipping-impresso.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Abstract Correios Impresso shipping method.
4
+ *
5
+ * @package WooCommerce_Correios/Abstracts
6
+ * @since 3.1.0
7
+ * @version 3.1.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * Default Correios Impresso shipping method abstract class.
16
+ *
17
+ * This is a abstract method with default options for all methods.
18
+ */
19
+ abstract class WC_Correios_Shipping_Impresso extends WC_Correios_Shipping_Carta {
20
+
21
+ /**
22
+ * National Registry cost.
23
+ *
24
+ * Cost based in 25/08/2016 from:
25
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
26
+ *
27
+ * @var float
28
+ */
29
+ protected $national_registry_cost = 4.30;
30
+
31
+ /**
32
+ * Reasonable Registry cost.
33
+ *
34
+ * Cost based in 25/08/2016 from:
35
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
36
+ *
37
+ * @var float
38
+ */
39
+ protected $reasonable_registry_cost = 2.15;
40
+
41
+ /**
42
+ * Receipt Notice cost.
43
+ *
44
+ * Cost based in 25/08/2016 from:
45
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
46
+ *
47
+ * @var float
48
+ */
49
+ protected $receipt_notice_cost = 4.30;
50
+
51
+ /**
52
+ * Own Hands cost.
53
+ *
54
+ * Cost based in 25/08/2016 from:
55
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-adicionais-nacionais
56
+ *
57
+ * @var float
58
+ */
59
+ protected $own_hands_cost = 5.50;
60
+
61
+ /**
62
+ * Weight limit for reasonable registry.
63
+ *
64
+ * Value based in 25/08/2016 from:
65
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
66
+ *
67
+ * @var float
68
+ */
69
+ protected $reasonable_registry_weight_limit = 500.000;
70
+
71
+ /**
72
+ * Initialize Impresso shipping method.
73
+ *
74
+ * @param int $instance_id Shipping zone instance.
75
+ */
76
+ public function __construct( $instance_id = 0 ) {
77
+ $this->instance_id = absint( $instance_id );
78
+ $this->method_description = sprintf( __( '%s is a shipping method from Correios.', 'woocommerce-correios' ), $this->method_title );
79
+ $this->supports = array(
80
+ 'shipping-zones',
81
+ 'instance-settings',
82
+ );
83
+
84
+ // Load the form fields.
85
+ $this->init_form_fields();
86
+
87
+ // Define user set variables.
88
+ $this->enabled = $this->get_option( 'enabled' );
89
+ $this->title = $this->get_option( 'title' );
90
+ $this->shipping_class = $this->get_option( 'shipping_class' );
91
+ $this->registry_type = $this->get_option( 'registry_type' );
92
+ $this->fee = $this->get_option( 'fee' );
93
+ $this->receipt_notice = $this->get_option( 'receipt_notice' );
94
+ $this->own_hands = $this->get_option( 'own_hands' );
95
+ $this->debug = $this->get_option( 'debug' );
96
+
97
+ // Active logs.
98
+ if ( 'yes' === $this->debug ) {
99
+ $this->log = new WC_Logger();
100
+ }
101
+
102
+ // Save admin options.
103
+ add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
104
+ }
105
+
106
+ /**
107
+ * Admin options fields.
108
+ */
109
+ public function init_form_fields() {
110
+ $this->instance_form_fields = array(
111
+ 'enabled' => array(
112
+ 'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
113
+ 'type' => 'checkbox',
114
+ 'label' => __( 'Enable this shipping method', 'woocommerce-correios' ),
115
+ 'default' => 'yes',
116
+ ),
117
+ 'title' => array(
118
+ 'title' => __( 'Title', 'woocommerce-correios' ),
119
+ 'type' => 'text',
120
+ 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-correios' ),
121
+ 'desc_tip' => true,
122
+ 'default' => $this->method_title,
123
+ ),
124
+ 'behavior_options' => array(
125
+ 'title' => __( 'Behavior Options', 'woocommerce-correios' ),
126
+ 'type' => 'title',
127
+ 'default' => '',
128
+ ),
129
+ 'shipping_class' => array(
130
+ 'title' => __( 'Shipping Class', 'woocommerce-correios' ),
131
+ 'type' => 'select',
132
+ 'description' => __( 'Select for which shipping class this method will be applied.', 'woocommerce-correios' ),
133
+ 'desc_tip' => true,
134
+ 'default' => '',
135
+ 'class' => 'wc-enhanced-select',
136
+ 'options' => $this->get_shipping_classes_options(),
137
+ ),
138
+ 'registry_type' => array(
139
+ 'title' => __( 'Registry Type', 'woocommerce-correios' ),
140
+ 'type' => 'select',
141
+ 'description' => __( 'Select for which registry type this method will be applied.', 'woocommerce-correios' ),
142
+ 'desc_tip' => true,
143
+ 'default' => '',
144
+ 'class' => 'wc-enhanced-select',
145
+ 'options' => array(
146
+ '' => __( '-- Select a registry type --', 'woocommerce-correios' ),
147
+ 'RN' => __( 'Registro Nacional', 'woocommerce-correios' ),
148
+ 'RM' => __( 'Registro Módico', 'woocommerce-correios' ),
149
+ ),
150
+ 'default' => 'RM',
151
+ ),
152
+ 'fee' => array(
153
+ 'title' => __( 'Handling Fee', 'woocommerce-correios' ),
154
+ 'type' => 'price',
155
+ 'description' => __( 'Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce-correios' ),
156
+ 'desc_tip' => true,
157
+ 'placeholder' => '0.00',
158
+ 'default' => '',
159
+ ),
160
+ 'optional_services' => array(
161
+ 'title' => __( 'Optional Services', 'woocommerce-correios' ),
162
+ 'type' => 'title',
163
+ 'description' => __( 'Use these options to add the value of each service provided by the Correios.', 'woocommerce-correios' ),
164
+ 'default' => '',
165
+ ),
166
+ 'receipt_notice' => array(
167
+ 'title' => __( 'Receipt Notice', 'woocommerce-correios' ),
168
+ 'type' => 'checkbox',
169
+ 'label' => __( 'Enable receipt notice', 'woocommerce-correios' ),
170
+ 'description' => __( 'This controls whether to add costs of the receipt notice service.', 'woocommerce-correios' ),
171
+ 'desc_tip' => true,
172
+ 'default' => 'no',
173
+ ),
174
+ 'own_hands' => array(
175
+ 'title' => __( 'Own Hands', 'woocommerce-correios' ),
176
+ 'type' => 'checkbox',
177
+ 'label' => __( 'Enable own hands', 'woocommerce-correios' ),
178
+ 'description' => __( 'This controls whether to add costs of the own hands service', 'woocommerce-correios' ),
179
+ 'desc_tip' => true,
180
+ 'default' => 'no',
181
+ ),
182
+ 'testing' => array(
183
+ 'title' => __( 'Testing', 'woocommerce-correios' ),
184
+ 'type' => 'title',
185
+ 'default' => '',
186
+ ),
187
+ 'debug' => array(
188
+ 'title' => __( 'Debug Log', 'woocommerce-correios' ),
189
+ 'type' => 'checkbox',
190
+ 'label' => __( 'Enable logging', 'woocommerce-correios' ),
191
+ 'default' => 'no',
192
+ 'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), $this->method_title ) . $this->get_log_link(),
193
+ ),
194
+ );
195
+ }
196
+ }
includes/abstracts/{abstract-wc-correios-international-shipping.php → abstract-wc-correios-shipping-international.php} RENAMED
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  *
17
  * This is a abstract method with default options for all methods.
18
  */
19
- abstract class WC_Correios_International_Shipping extends WC_Correios_Shipping {
20
 
21
  /**
22
  * Initialize the Correios shipping method.
@@ -167,7 +167,7 @@ abstract class WC_Correios_International_Shipping extends WC_Correios_Shipping {
167
  $api = new WC_Correios_Webservice_International( $this->id, $this->instance_id );
168
 
169
  // Check if valid to be calculeted.
170
- if ( ! in_array( $package['destination']['country'], $api->get_allowed_countries() ) ) {
171
  return;
172
  }
173
 
@@ -179,7 +179,7 @@ abstract class WC_Correios_International_Shipping extends WC_Correios_Shipping {
179
 
180
  // Set the shipping rates.
181
  $label = $this->title;
182
- if ( 'yes' == $this->show_delivery_time ) {
183
  $label .= ' (' . sanitize_text_field( (string) $shipping->dados_postais->prazo_entrega ) . ')';
184
  }
185
  $cost = sanitize_text_field( (float) $shipping->dados_postais->preco_postal );
16
  *
17
  * This is a abstract method with default options for all methods.
18
  */
19
+ abstract class WC_Correios_Shipping_International extends WC_Correios_Shipping {
20
 
21
  /**
22
  * Initialize the Correios shipping method.
167
  $api = new WC_Correios_Webservice_International( $this->id, $this->instance_id );
168
 
169
  // Check if valid to be calculeted.
170
+ if ( ! in_array( $package['destination']['country'], $api->get_allowed_countries(), true ) ) {
171
  return;
172
  }
173
 
179
 
180
  // Set the shipping rates.
181
  $label = $this->title;
182
+ if ( 'yes' === $this->show_delivery_time ) {
183
  $label .= ' (' . sanitize_text_field( (string) $shipping->dados_postais->prazo_entrega ) . ')';
184
  }
185
  $cost = sanitize_text_field( (float) $shipping->dados_postais->preco_postal );
includes/abstracts/abstract-wc-correios-shipping.php CHANGED
@@ -17,7 +17,6 @@ if ( ! defined( 'ABSPATH' ) ) {
17
  * This is a abstract method with default options for all methods.
18
  */
19
  abstract class WC_Correios_Shipping extends WC_Shipping_Method {
20
-
21
  /**
22
  * Service code.
23
  *
@@ -363,7 +362,7 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
363
  * @return array
364
  */
365
  protected function get_accepted_error_codes() {
366
- $codes = apply_filters( 'woocommerce_correios_accepted_error_codes', array( '-33', '-3', '010' ) );
367
  $codes[] = '0';
368
 
369
  return $codes;
@@ -378,7 +377,7 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
378
  * @return string
379
  */
380
  protected function get_shipping_method_label( $days, $package ) {
381
- if ( 'yes' == $this->show_delivery_time ) {
382
  return wc_correios_get_estimating_delivery( $this->title, $days, $this->get_additional_time( $package ) );
383
  }
384
 
@@ -405,15 +404,15 @@ abstract class WC_Correios_Shipping extends WC_Shipping_Method {
405
  $error_number = (string) $shipping->Erro;
406
 
407
  // Exit if have errors.
408
- if ( ! in_array( $error_number, $this->get_accepted_error_codes() ) ) {
409
  return;
410
  }
411
 
412
  // Display Correios errors.
413
  $error_message = wc_correios_get_error_message( $error_number );
414
- if ( '' != $error_message ) {
415
- $notice_type = ( '010' == $error_number ) ? 'notice' : 'error';
416
- $notice = '<strong>' . __( $this->title, 'woocommerce-correios' ) . ':</strong> ' . esc_html( $error_message );
417
  wc_add_notice( $notice, $notice_type );
418
  }
419
 
17
  * This is a abstract method with default options for all methods.
18
  */
19
  abstract class WC_Correios_Shipping extends WC_Shipping_Method {
 
20
  /**
21
  * Service code.
22
  *
362
  * @return array
363
  */
364
  protected function get_accepted_error_codes() {
365
+ $codes = apply_filters( 'woocommerce_correios_accepted_error_codes', array( '-33', '-3', '008', '010' ) );
366
  $codes[] = '0';
367
 
368
  return $codes;
377
  * @return string
378
  */
379
  protected function get_shipping_method_label( $days, $package ) {
380
+ if ( 'yes' === $this->show_delivery_time ) {
381
  return wc_correios_get_estimating_delivery( $this->title, $days, $this->get_additional_time( $package ) );
382
  }
383
 
404
  $error_number = (string) $shipping->Erro;
405
 
406
  // Exit if have errors.
407
+ if ( ! in_array( $error_number, $this->get_accepted_error_codes(), true ) ) {
408
  return;
409
  }
410
 
411
  // Display Correios errors.
412
  $error_message = wc_correios_get_error_message( $error_number );
413
+ if ( '' !== $error_message ) {
414
+ $notice_type = ( '010' === $error_number ) ? 'notice' : 'error';
415
+ $notice = '<strong>' . $this->title . ':</strong> ' . esc_html( $error_message );
416
  wc_add_notice( $notice, $notice_type );
417
  }
418
 
includes/admin/class-wc-correios-admin-orders.php CHANGED
@@ -22,6 +22,7 @@ class WC_Correios_Admin_Orders {
22
  public function __construct() {
23
  add_action( 'add_meta_boxes', array( $this, 'register_metabox' ) );
24
  add_action( 'woocommerce_process_shop_order_meta', array( $this, 'save_tracking_code' ) );
 
25
  }
26
 
27
  /**
@@ -62,6 +63,19 @@ class WC_Correios_Admin_Orders {
62
  wc_correios_update_tracking_code( $post_id, wp_unslash( $_POST['correios_tracking'] ) );
63
  }
64
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  }
66
 
67
  new WC_Correios_Admin_Orders();
22
  public function __construct() {
23
  add_action( 'add_meta_boxes', array( $this, 'register_metabox' ) );
24
  add_action( 'woocommerce_process_shop_order_meta', array( $this, 'save_tracking_code' ) );
25
+ add_filter( 'woocommerce_resend_order_emails_available', array( $this, 'resend_tracking_code_email' ) );
26
  }
27
 
28
  /**
63
  wc_correios_update_tracking_code( $post_id, wp_unslash( $_POST['correios_tracking'] ) );
64
  }
65
  }
66
+
67
+ /**
68
+ * Include option to resend the tracking code email.
69
+ *
70
+ * @param array $emails List of emails.
71
+ *
72
+ * @return array
73
+ */
74
+ public function resend_tracking_code_email( $emails ) {
75
+ $emails[] = 'correios_tracking';
76
+
77
+ return $emails;
78
+ }
79
  }
80
 
81
  new WC_Correios_Admin_Orders();
includes/admin/views/html-admin-help-message.php CHANGED
@@ -12,6 +12,6 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  if ( apply_filters( 'woocommerce_correios_help_message', true ) ) : ?>
13
  <div class="updated woocommerce-message inline">
14
  <p><?php echo esc_html( sprintf( __( 'Help us keep the %s plugin free making a donation or rate &#9733;&#9733;&#9733;&#9733;&#9733; on WordPress.org. Thank you in advance!', 'woocommerce-correios' ), __( 'WooCommerce Correios', 'woocommerce-correios' ) ) ); ?></p>
15
- <p><a href="http://claudiosmweb.com/doacoes/" target="_blank" class="button button-primary"><?php esc_html_e( 'Make a donation', 'woocommerce-correios' ); ?></a> <a href="https://wordpress.org/support/view/plugin-reviews/woocommerce-correios?filter=5#postform" target="_blank" class="button button-secondary"><?php esc_html_e( 'Make a review', 'woocommerce-correios' ); ?></a></p>
16
  </div>
17
  <?php endif;
12
  if ( apply_filters( 'woocommerce_correios_help_message', true ) ) : ?>
13
  <div class="updated woocommerce-message inline">
14
  <p><?php echo esc_html( sprintf( __( 'Help us keep the %s plugin free making a donation or rate &#9733;&#9733;&#9733;&#9733;&#9733; on WordPress.org. Thank you in advance!', 'woocommerce-correios' ), __( 'WooCommerce Correios', 'woocommerce-correios' ) ) ); ?></p>
15
+ <p><a href="http://claudiosmweb.com/doacoes/" target="_blank" class="button button-primary"><?php esc_html_e( 'Make a donation', 'woocommerce-correios' ); ?></a> <a href="https://wordpress.org/support/plugin/woocommerce-correios/reviews/?filter=5#new-post" target="_blank" class="button button-secondary"><?php esc_html_e( 'Make a review', 'woocommerce-correios' ); ?></a></p>
16
  </div>
17
  <?php endif;
includes/class-wc-correios-autofill-addresses.php CHANGED
@@ -89,7 +89,7 @@ class WC_Correios_Autofill_Addresses {
89
  /**
90
  * Get address by postcode.
91
  *
92
- * @param string $postcode
93
  *
94
  * @return stdClass
95
  */
@@ -126,7 +126,7 @@ class WC_Correios_Autofill_Addresses {
126
  /**
127
  * Check if postcode is expired.
128
  *
129
- * @param string $last_query
130
  * @return bool
131
  */
132
  protected static function check_if_expired( $last_query ) {
@@ -142,7 +142,7 @@ class WC_Correios_Autofill_Addresses {
142
  /**
143
  * Insert an address.
144
  *
145
- * @param array $address
146
  *
147
  * @return bool
148
  */
@@ -171,6 +171,8 @@ class WC_Correios_Autofill_Addresses {
171
 
172
  /**
173
  * Delete an address from database.
 
 
174
  */
175
  protected static function delete_address( $postcode ) {
176
  global $wpdb;
@@ -181,7 +183,7 @@ class WC_Correios_Autofill_Addresses {
181
  /**
182
  * Update an address.
183
  *
184
- * @param array $address
185
  *
186
  * @return bool
187
  */
@@ -194,7 +196,7 @@ class WC_Correios_Autofill_Addresses {
194
  /**
195
  * Fetch an address from Correios Webservices.
196
  *
197
- * @param string $postcode
198
  * @return stdClass
199
  */
200
  protected static function fetch_address( $postcode ) {
@@ -256,7 +258,7 @@ class WC_Correios_Autofill_Addresses {
256
  exit;
257
  }
258
 
259
- $postcode = wc_correios_sanitize_postcode( $_GET['postcode'] );
260
 
261
  if ( empty( $postcode ) || 8 !== strlen( $postcode ) ) {
262
  wp_send_json_error( array( 'message' => __( 'Invalid postcode.', 'woocommerce-correios' ) ) );
89
  /**
90
  * Get address by postcode.
91
  *
92
+ * @param string $postcode Address postcode.
93
  *
94
  * @return stdClass
95
  */
126
  /**
127
  * Check if postcode is expired.
128
  *
129
+ * @param string $last_query Date of the last query.
130
  * @return bool
131
  */
132
  protected static function check_if_expired( $last_query ) {
142
  /**
143
  * Insert an address.
144
  *
145
+ * @param array $address Address data to save.
146
  *
147
  * @return bool
148
  */
171
 
172
  /**
173
  * Delete an address from database.
174
+ *
175
+ * @param string $postcode Address postcode.
176
  */
177
  protected static function delete_address( $postcode ) {
178
  global $wpdb;
183
  /**
184
  * Update an address.
185
  *
186
+ * @param array $address Address data.
187
  *
188
  * @return bool
189
  */
196
  /**
197
  * Fetch an address from Correios Webservices.
198
  *
199
+ * @param string $postcode Address postcode.
200
  * @return stdClass
201
  */
202
  protected static function fetch_address( $postcode ) {
258
  exit;
259
  }
260
 
261
+ $postcode = wc_correios_sanitize_postcode( wp_unslash( $_GET['postcode'] ) );
262
 
263
  if ( empty( $postcode ) || 8 !== strlen( $postcode ) ) {
264
  wp_send_json_error( array( 'message' => __( 'Invalid postcode.', 'woocommerce-correios' ) ) );
includes/class-wc-correios-package.php CHANGED
@@ -111,10 +111,11 @@ class WC_Correios_Package {
111
  */
112
  protected function cubage_total( $height, $width, $length ) {
113
  // Sets the cubage of all products.
114
- $all = array();
115
- $total = 0;
 
116
 
117
- for ( $i = 0; $i < count( $height ); $i++ ) {
118
  $all[ $i ] = $height[ $i ] * $width[ $i ] * $length[ $i ];
119
  }
120
 
@@ -158,7 +159,7 @@ class WC_Correios_Package {
158
  $cubage_total = $this->cubage_total( $height, $width, $length );
159
  $root = 0;
160
 
161
- if ( 0 != $cubage_total ) {
162
  // Dividing the value of scaling of all products.
163
  // With the measured value of greater.
164
  $division = $cubage_total / max( $max_values );
@@ -182,7 +183,7 @@ class WC_Correios_Package {
182
  $cubage = array();
183
  $max_values = $this->get_max_values( $height, $width, $length );
184
  $root = $this->calculate_root( $height, $width, $length, $max_values );
185
- $greatest = array_search( max( $max_values ), $max_values );
186
 
187
  switch ( $greatest ) {
188
  case 'height' :
111
  */
112
  protected function cubage_total( $height, $width, $length ) {
113
  // Sets the cubage of all products.
114
+ $all = array();
115
+ $total = 0;
116
+ $total_items = count( $height );
117
 
118
+ for ( $i = 0; $i < $total_items; $i++ ) {
119
  $all[ $i ] = $height[ $i ] * $width[ $i ] * $length[ $i ];
120
  }
121
 
159
  $cubage_total = $this->cubage_total( $height, $width, $length );
160
  $root = 0;
161
 
162
+ if ( 0 !== $cubage_total ) {
163
  // Dividing the value of scaling of all products.
164
  // With the measured value of greater.
165
  $division = $cubage_total / max( $max_values );
183
  $cubage = array();
184
  $max_values = $this->get_max_values( $height, $width, $length );
185
  $root = $this->calculate_root( $height, $width, $length, $max_values );
186
+ $greatest = array_search( max( $max_values ), $max_values, true );
187
 
188
  switch ( $greatest ) {
189
  case 'height' :
includes/class-wc-correios-soap-client.php CHANGED
@@ -19,7 +19,7 @@ class WC_Correios_Soap_Client extends SoapClient {
19
  /**
20
  * SoapClient construct.
21
  *
22
- * @param mixed $wsdl
23
  */
24
  public function __construct( $wsdl ) {
25
  parent::__construct( $wsdl, array(
19
  /**
20
  * SoapClient construct.
21
  *
22
+ * @param mixed $wsdl WSDL URL.
23
  */
24
  public function __construct( $wsdl ) {
25
  parent::__construct( $wsdl, array(
includes/class-wc-correios-webservice-international.php CHANGED
@@ -114,13 +114,13 @@ class WC_Correios_Webservice_International {
114
  /**
115
  * Initialize webservice.
116
  *
117
- * @param string $id
118
- * @param int $instance_id
119
  */
120
  public function __construct( $id = 'correios', $instance_id = 0 ) {
121
  $this->id = $id;
122
  $this->instance_id = $instance_id;
123
- $this->log = new WC_Logger();
124
  }
125
 
126
  /**
@@ -149,7 +149,7 @@ class WC_Correios_Webservice_International {
149
  $this->set_weight( wc_get_weight( $data['weight'], 'g', 'kg' ) );
150
  }
151
 
152
- if ( 'yes' == $this->debug ) {
153
  if ( ! empty( $data ) ) {
154
  $data = array(
155
  'weight' => $this->get_weight(),
@@ -614,7 +614,7 @@ class WC_Correios_Webservice_International {
614
 
615
  $url = add_query_arg( $args, $this->get_webservice_url() );
616
 
617
- if ( 'yes' == $this->debug ) {
618
  $this->log->add( $this->id, 'Requesting Correios WebServices: ' . $url );
619
  }
620
 
@@ -622,27 +622,27 @@ class WC_Correios_Webservice_International {
622
  $response = wp_safe_remote_get( $url, array( 'timeout' => 30 ) );
623
 
624
  if ( is_wp_error( $response ) ) {
625
- if ( 'yes' == $this->debug ) {
626
  $this->log->add( $this->id, 'WP_Error: ' . $response->get_error_message() );
627
  }
628
  } elseif ( $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
629
  try {
630
  $result = wc_correios_safe_load_xml( $response['body'], LIBXML_NOCDATA );
631
  } catch ( Exception $e ) {
632
- if ( 'yes' == $this->debug ) {
633
  $this->log->add( $this->id, 'Correios WebServices invalid XML: ' . $e->getMessage() );
634
  }
635
  }
636
 
637
  if ( isset( $result->tipo_servico ) ) {
638
- if ( 'yes' == $this->debug ) {
639
  $this->log->add( $this->id, 'Correios WebServices response: ' . print_r( $result, true ) );
640
  }
641
 
642
  $shipping = $result->tipo_servico;
643
  }
644
  } else {
645
- if ( 'yes' == $this->debug ) {
646
  $this->log->add( $this->id, 'Error accessing the Correios WebServices: ' . print_r( $response, true ) );
647
  }
648
  }
114
  /**
115
  * Initialize webservice.
116
  *
117
+ * @param string $id Method ID.
118
+ * @param int $instance_id Instance ID.
119
  */
120
  public function __construct( $id = 'correios', $instance_id = 0 ) {
121
  $this->id = $id;
122
  $this->instance_id = $instance_id;
123
+ $this->log = new WC_Logger();
124
  }
125
 
126
  /**
149
  $this->set_weight( wc_get_weight( $data['weight'], 'g', 'kg' ) );
150
  }
151
 
152
+ if ( 'yes' === $this->debug ) {
153
  if ( ! empty( $data ) ) {
154
  $data = array(
155
  'weight' => $this->get_weight(),
614
 
615
  $url = add_query_arg( $args, $this->get_webservice_url() );
616
 
617
+ if ( 'yes' === $this->debug ) {
618
  $this->log->add( $this->id, 'Requesting Correios WebServices: ' . $url );
619
  }
620
 
622
  $response = wp_safe_remote_get( $url, array( 'timeout' => 30 ) );
623
 
624
  if ( is_wp_error( $response ) ) {
625
+ if ( 'yes' === $this->debug ) {
626
  $this->log->add( $this->id, 'WP_Error: ' . $response->get_error_message() );
627
  }
628
  } elseif ( $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
629
  try {
630
  $result = wc_correios_safe_load_xml( $response['body'], LIBXML_NOCDATA );
631
  } catch ( Exception $e ) {
632
+ if ( 'yes' === $this->debug ) {
633
  $this->log->add( $this->id, 'Correios WebServices invalid XML: ' . $e->getMessage() );
634
  }
635
  }
636
 
637
  if ( isset( $result->tipo_servico ) ) {
638
+ if ( 'yes' === $this->debug ) {
639
  $this->log->add( $this->id, 'Correios WebServices response: ' . print_r( $result, true ) );
640
  }
641
 
642
  $shipping = $result->tipo_servico;
643
  }
644
  } else {
645
+ if ( 'yes' === $this->debug ) {
646
  $this->log->add( $this->id, 'Error accessing the Correios WebServices: ' . print_r( $response, true ) );
647
  }
648
  }
includes/class-wc-correios-webservice.php CHANGED
@@ -177,8 +177,8 @@ class WC_Correios_Webservice {
177
  /**
178
  * Initialize webservice.
179
  *
180
- * @param string $id
181
- * @param int $instance_id
182
  */
183
  public function __construct( $id = 'correios', $instance_id = 0 ) {
184
  $this->id = $id;
@@ -189,7 +189,7 @@ class WC_Correios_Webservice {
189
  /**
190
  * Set the service
191
  *
192
- * @param string|array $service
193
  */
194
  public function set_service( $service = '' ) {
195
  if ( is_array( $service ) ) {
@@ -202,7 +202,7 @@ class WC_Correios_Webservice {
202
  /**
203
  * Set shipping package.
204
  *
205
- * @param array $package
206
  */
207
  public function set_package( $package = array() ) {
208
  $package = new WC_Correios_Package( $package );
@@ -216,7 +216,7 @@ class WC_Correios_Webservice {
216
  $this->set_weight( $data['weight'] );
217
  }
218
 
219
- if ( 'yes' == $this->debug ) {
220
  if ( ! empty( $data ) ) {
221
  $data = array(
222
  'weight' => $this->get_weight(),
@@ -233,7 +233,7 @@ class WC_Correios_Webservice {
233
  /**
234
  * Set origin postcode.
235
  *
236
- * @param string $postcode
237
  */
238
  public function set_origin_postcode( $postcode = '' ) {
239
  $this->origin_postcode = $postcode;
@@ -242,7 +242,7 @@ class WC_Correios_Webservice {
242
  /**
243
  * Set destination postcode.
244
  *
245
- * @param string $postcode
246
  */
247
  public function set_destination_postcode( $postcode = '' ) {
248
  $this->destination_postcode = $postcode;
@@ -251,7 +251,7 @@ class WC_Correios_Webservice {
251
  /**
252
  * Set login.
253
  *
254
- * @param string $login
255
  */
256
  public function set_login( $login = '' ) {
257
  $this->login = $login;
@@ -260,7 +260,7 @@ class WC_Correios_Webservice {
260
  /**
261
  * Set password.
262
  *
263
- * @param string $password
264
  */
265
  public function set_password( $password = '' ) {
266
  $this->password = $password;
@@ -269,7 +269,7 @@ class WC_Correios_Webservice {
269
  /**
270
  * Set shipping package height.
271
  *
272
- * @param float $height
273
  */
274
  public function set_height( $height = 0 ) {
275
  $this->height = (float) $height;
@@ -278,7 +278,7 @@ class WC_Correios_Webservice {
278
  /**
279
  * Set shipping package width.
280
  *
281
- * @param float $width
282
  */
283
  public function set_width( $width = 0 ) {
284
  $this->width = (float) $width;
@@ -287,7 +287,7 @@ class WC_Correios_Webservice {
287
  /**
288
  * Set shipping package diameter.
289
  *
290
- * @param float $diameter
291
  */
292
  public function set_diameter( $diameter = 0 ) {
293
  $this->diameter = (float) $diameter;
@@ -296,7 +296,7 @@ class WC_Correios_Webservice {
296
  /**
297
  * Set shipping package length.
298
  *
299
- * @param float $length
300
  */
301
  public function set_length( $length = 0 ) {
302
  $this->length = (float) $length;
@@ -305,7 +305,7 @@ class WC_Correios_Webservice {
305
  /**
306
  * Set shipping package weight.
307
  *
308
- * @param float $weight
309
  */
310
  public function set_weight( $weight = 0 ) {
311
  $this->weight = (float) $weight;
@@ -314,7 +314,7 @@ class WC_Correios_Webservice {
314
  /**
315
  * Set minimum height.
316
  *
317
- * @param float $minimum_height
318
  */
319
  public function set_minimum_height( $minimum_height = 2 ) {
320
  $this->minimum_height = 2 <= $minimum_height ? $minimum_height : 2;
@@ -323,7 +323,7 @@ class WC_Correios_Webservice {
323
  /**
324
  * Set minimum width.
325
  *
326
- * @param float $minimum_width
327
  */
328
  public function set_minimum_width( $minimum_width = 11 ) {
329
  $this->minimum_width = 11 <= $minimum_width ? $minimum_width : 11;
@@ -332,7 +332,7 @@ class WC_Correios_Webservice {
332
  /**
333
  * Set minimum length.
334
  *
335
- * @param float $minimum_length
336
  */
337
  public function set_minimum_length( $minimum_length = 16 ) {
338
  $this->minimum_length = 16 <= $minimum_length ? $minimum_length : 16;
@@ -341,7 +341,7 @@ class WC_Correios_Webservice {
341
  /**
342
  * Set declared value.
343
  *
344
- * @param string $declared_value
345
  */
346
  public function set_declared_value( $declared_value = '0' ) {
347
  $this->declared_value = $declared_value;
@@ -350,7 +350,7 @@ class WC_Correios_Webservice {
350
  /**
351
  * Set own hands.
352
  *
353
- * @param string $own_hands
354
  */
355
  public function set_own_hands( $own_hands = 'N' ) {
356
  $this->own_hands = $own_hands;
@@ -359,7 +359,7 @@ class WC_Correios_Webservice {
359
  /**
360
  * Set receipt notice.
361
  *
362
- * @param string $receipt_notice
363
  */
364
  public function set_receipt_notice( $receipt_notice = 'N' ) {
365
  $this->receipt_notice = $receipt_notice;
@@ -520,7 +520,7 @@ class WC_Correios_Webservice {
520
 
521
  $url = add_query_arg( $args, $this->get_webservice_url() );
522
 
523
- if ( 'yes' == $this->debug ) {
524
  $this->log->add( $this->id, 'Requesting Correios WebServices: ' . $url );
525
  }
526
 
@@ -528,27 +528,27 @@ class WC_Correios_Webservice {
528
  $response = wp_safe_remote_get( esc_url_raw( $url ), array( 'timeout' => 30 ) );
529
 
530
  if ( is_wp_error( $response ) ) {
531
- if ( 'yes' == $this->debug ) {
532
  $this->log->add( $this->id, 'WP_Error: ' . $response->get_error_message() );
533
  }
534
  } elseif ( $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
535
  try {
536
  $result = wc_correios_safe_load_xml( $response['body'], LIBXML_NOCDATA );
537
  } catch ( Exception $e ) {
538
- if ( 'yes' == $this->debug ) {
539
  $this->log->add( $this->id, 'Correios WebServices invalid XML: ' . $e->getMessage() );
540
  }
541
  }
542
 
543
  if ( isset( $result->cServico ) ) {
544
- if ( 'yes' == $this->debug ) {
545
  $this->log->add( $this->id, 'Correios WebServices response: ' . print_r( $result, true ) );
546
  }
547
 
548
  $shipping = $result->cServico;
549
  }
550
  } else {
551
- if ( 'yes' == $this->debug ) {
552
  $this->log->add( $this->id, 'Error accessing the Correios WebServices: ' . print_r( $response, true ) );
553
  }
554
  }
177
  /**
178
  * Initialize webservice.
179
  *
180
+ * @param string $id Method ID.
181
+ * @param int $instance_id Instance ID.
182
  */
183
  public function __construct( $id = 'correios', $instance_id = 0 ) {
184
  $this->id = $id;
189
  /**
190
  * Set the service
191
  *
192
+ * @param string|array $service Service.
193
  */
194
  public function set_service( $service = '' ) {
195
  if ( is_array( $service ) ) {
202
  /**
203
  * Set shipping package.
204
  *
205
+ * @param array $package Shipping package.
206
  */
207
  public function set_package( $package = array() ) {
208
  $package = new WC_Correios_Package( $package );
216
  $this->set_weight( $data['weight'] );
217
  }
218
 
219
+ if ( 'yes' === $this->debug ) {
220
  if ( ! empty( $data ) ) {
221
  $data = array(
222
  'weight' => $this->get_weight(),
233
  /**
234
  * Set origin postcode.
235
  *
236
+ * @param string $postcode Origin postcode.
237
  */
238
  public function set_origin_postcode( $postcode = '' ) {
239
  $this->origin_postcode = $postcode;
242
  /**
243
  * Set destination postcode.
244
  *
245
+ * @param string $postcode Destination postcode.
246
  */
247
  public function set_destination_postcode( $postcode = '' ) {
248
  $this->destination_postcode = $postcode;
251
  /**
252
  * Set login.
253
  *
254
+ * @param string $login User login.
255
  */
256
  public function set_login( $login = '' ) {
257
  $this->login = $login;
260
  /**
261
  * Set password.
262
  *
263
+ * @param string $password User login.
264
  */
265
  public function set_password( $password = '' ) {
266
  $this->password = $password;
269
  /**
270
  * Set shipping package height.
271
  *
272
+ * @param float $height Package height.
273
  */
274
  public function set_height( $height = 0 ) {
275
  $this->height = (float) $height;
278
  /**
279
  * Set shipping package width.
280
  *
281
+ * @param float $width Package width.
282
  */
283
  public function set_width( $width = 0 ) {
284
  $this->width = (float) $width;
287
  /**
288
  * Set shipping package diameter.
289
  *
290
+ * @param float $diameter Package diameter.
291
  */
292
  public function set_diameter( $diameter = 0 ) {
293
  $this->diameter = (float) $diameter;
296
  /**
297
  * Set shipping package length.
298
  *
299
+ * @param float $length Package length.
300
  */
301
  public function set_length( $length = 0 ) {
302
  $this->length = (float) $length;
305
  /**
306
  * Set shipping package weight.
307
  *
308
+ * @param float $weight Package weight.
309
  */
310
  public function set_weight( $weight = 0 ) {
311
  $this->weight = (float) $weight;
314
  /**
315
  * Set minimum height.
316
  *
317
+ * @param float $minimum_height Package minimum height.
318
  */
319
  public function set_minimum_height( $minimum_height = 2 ) {
320
  $this->minimum_height = 2 <= $minimum_height ? $minimum_height : 2;
323
  /**
324
  * Set minimum width.
325
  *
326
+ * @param float $minimum_width Package minimum width.
327
  */
328
  public function set_minimum_width( $minimum_width = 11 ) {
329
  $this->minimum_width = 11 <= $minimum_width ? $minimum_width : 11;
332
  /**
333
  * Set minimum length.
334
  *
335
+ * @param float $minimum_length Package minimum length.
336
  */
337
  public function set_minimum_length( $minimum_length = 16 ) {
338
  $this->minimum_length = 16 <= $minimum_length ? $minimum_length : 16;
341
  /**
342
  * Set declared value.
343
  *
344
+ * @param string $declared_value Declared value.
345
  */
346
  public function set_declared_value( $declared_value = '0' ) {
347
  $this->declared_value = $declared_value;
350
  /**
351
  * Set own hands.
352
  *
353
+ * @param string $own_hands Use 'N' for no and 'S' for yes.
354
  */
355
  public function set_own_hands( $own_hands = 'N' ) {
356
  $this->own_hands = $own_hands;
359
  /**
360
  * Set receipt notice.
361
  *
362
+ * @param string $receipt_notice Use 'N' for no and 'S' for yes.
363
  */
364
  public function set_receipt_notice( $receipt_notice = 'N' ) {
365
  $this->receipt_notice = $receipt_notice;
520
 
521
  $url = add_query_arg( $args, $this->get_webservice_url() );
522
 
523
+ if ( 'yes' === $this->debug ) {
524
  $this->log->add( $this->id, 'Requesting Correios WebServices: ' . $url );
525
  }
526
 
528
  $response = wp_safe_remote_get( esc_url_raw( $url ), array( 'timeout' => 30 ) );
529
 
530
  if ( is_wp_error( $response ) ) {
531
+ if ( 'yes' === $this->debug ) {
532
  $this->log->add( $this->id, 'WP_Error: ' . $response->get_error_message() );
533
  }
534
  } elseif ( $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
535
  try {
536
  $result = wc_correios_safe_load_xml( $response['body'], LIBXML_NOCDATA );
537
  } catch ( Exception $e ) {
538
+ if ( 'yes' === $this->debug ) {
539
  $this->log->add( $this->id, 'Correios WebServices invalid XML: ' . $e->getMessage() );
540
  }
541
  }
542
 
543
  if ( isset( $result->cServico ) ) {
544
+ if ( 'yes' === $this->debug ) {
545
  $this->log->add( $this->id, 'Correios WebServices response: ' . print_r( $result, true ) );
546
  }
547
 
548
  $shipping = $result->cServico;
549
  }
550
  } else {
551
+ if ( 'yes' === $this->debug ) {
552
  $this->log->add( $this->id, 'Error accessing the Correios WebServices: ' . print_r( $response, true ) );
553
  }
554
  }
includes/emails/class-wc-correios-tracking-email.php CHANGED
@@ -140,7 +140,12 @@ class WC_Correios_Tracking_Email extends WC_Email {
140
  * @param WC_Order $order Order data.
141
  * @param string $tracking_code Tracking code.
142
  */
143
- public function trigger( $order, $tracking_code ) {
 
 
 
 
 
144
  if ( is_object( $order ) ) {
145
  $this->object = $order;
146
  $this->recipient = $this->object->billing_email;
@@ -151,6 +156,10 @@ class WC_Correios_Tracking_Email extends WC_Email {
151
  $this->find[] = '{date}';
152
  $this->replace[] = date_i18n( wc_date_format(), time() );
153
 
 
 
 
 
154
  $this->find[] = '{tracking_code}';
155
  $this->replace[] = $this->get_tracking_code_url( $tracking_code );
156
  }
140
  * @param WC_Order $order Order data.
141
  * @param string $tracking_code Tracking code.
142
  */
143
+ public function trigger( $order, $tracking_code = '' ) {
144
+ // Get the order object while resending emails.
145
+ if ( is_numeric( $order ) ) {
146
+ $order = wc_get_order( $order );
147
+ }
148
+
149
  if ( is_object( $order ) ) {
150
  $this->object = $order;
151
  $this->recipient = $this->object->billing_email;
156
  $this->find[] = '{date}';
157
  $this->replace[] = date_i18n( wc_date_format(), time() );
158
 
159
+ if ( empty( $tracking_code ) ) {
160
+ $tracking_code = get_post_meta( $this->object->id, '_correios_tracking_code', true );
161
+ }
162
+
163
  $this->find[] = '{tracking_code}';
164
  $this->replace[] = $this->get_tracking_code_url( $tracking_code );
165
  }
includes/integrations/class-wc-correios-integration.php CHANGED
@@ -39,7 +39,7 @@ class WC_Correios_Integration extends WC_Integration {
39
  $this->autofill_debug = $this->get_option( 'autofill_debug' );
40
 
41
  // Actions.
42
- add_action( 'woocommerce_update_options_integration_' . $this->id, array( $this, 'process_admin_options' ) );
43
 
44
  // Tracking history actions.
45
  add_filter( 'woocommerce_correios_enable_tracking_history', array( $this, 'setup_tracking_history' ), 10 );
39
  $this->autofill_debug = $this->get_option( 'autofill_debug' );
40
 
41
  // Actions.
42
+ add_action( 'woocommerce_update_options_integration_' . $this->id, array( $this, 'process_admin_options' ) );
43
 
44
  // Tracking history actions.
45
  add_filter( 'woocommerce_correios_enable_tracking_history', array( $this, 'setup_tracking_history' ), 10 );
includes/shipping/class-wc-correios-shipping-carta-registrada.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  /**
15
  * Carta Registrada shipping method class.
16
  */
17
- class WC_Correios_Shipping_Carta_Registrada extends WC_Correios_Shipping {
18
 
19
  /**
20
  * Initialize Carta Registrada.
@@ -23,134 +23,15 @@ class WC_Correios_Shipping_Carta_Registrada extends WC_Correios_Shipping {
23
  */
24
  public function __construct( $instance_id = 0 ) {
25
  $this->id = 'correios-carta-registrada';
26
- $this->instance_id = absint( $instance_id );
27
  $this->method_title = __( 'Carta Registrada', 'woocommerce-correios' );
28
- $this->method_description = sprintf( __( '%s is a shipping method from Correios.', 'woocommerce-correios' ), $this->method_title );
29
  $this->more_link = 'http://www.correios.com.br/para-voce/correios-de-a-a-z/carta-comercial';
30
- $this->supports = array(
31
- 'shipping-zones',
32
- 'instance-settings',
33
- );
34
 
35
- // Load the form fields.
36
- $this->init_form_fields();
37
-
38
- // Define user set variables.
39
- $this->enabled = $this->get_option( 'enabled' );
40
- $this->title = $this->get_option( 'title' );
41
- $this->shipping_class = $this->get_option( 'shipping_class' );
42
- $this->fee = $this->get_option( 'fee' );
43
- $this->receipt_notice = $this->get_option( 'receipt_notice' );
44
- $this->own_hands = $this->get_option( 'own_hands' );
45
- $this->debug = $this->get_option( 'debug' );
46
-
47
- // Active logs.
48
- if ( 'yes' == $this->debug ) {
49
- $this->log = new WC_Logger();
50
- }
51
-
52
- // Save admin options.
53
- add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
54
- }
55
-
56
- /**
57
- * Get shipping classes options.
58
- *
59
- * @return array
60
- */
61
- protected function get_shipping_classes_options() {
62
- $shipping_classes = WC()->shipping->get_shipping_classes();
63
- $options = array(
64
- '' => __( '-- Select a shipping class --', 'woocommerce-correios' ),
65
- );
66
-
67
- if ( ! empty( $shipping_classes ) ) {
68
- $options += wp_list_pluck( $shipping_classes, 'name', 'slug' );
69
- }
70
-
71
- return $options;
72
- }
73
-
74
- /**
75
- * Admin options fields.
76
- */
77
- public function init_form_fields() {
78
- $this->instance_form_fields = array(
79
- 'enabled' => array(
80
- 'title' => __( 'Enable/Disable', 'woocommerce-correios' ),
81
- 'type' => 'checkbox',
82
- 'label' => __( 'Enable this shipping method', 'woocommerce-correios' ),
83
- 'default' => 'yes',
84
- ),
85
- 'title' => array(
86
- 'title' => __( 'Title', 'woocommerce-correios' ),
87
- 'type' => 'text',
88
- 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-correios' ),
89
- 'desc_tip' => true,
90
- 'default' => $this->method_title,
91
- ),
92
- 'behavior_options' => array(
93
- 'title' => __( 'Behavior Options', 'woocommerce-correios' ),
94
- 'type' => 'title',
95
- 'default' => '',
96
- ),
97
- 'shipping_class' => array(
98
- 'title' => __( 'Shipping Class', 'woocommerce-correios' ),
99
- 'type' => 'select',
100
- 'description' => __( 'Select for which shipping class this method will be applied.', 'woocommerce-correios' ),
101
- 'desc_tip' => true,
102
- 'default' => '',
103
- 'class' => 'wc-enhanced-select',
104
- 'options' => $this->get_shipping_classes_options(),
105
- ),
106
- 'fee' => array(
107
- 'title' => __( 'Handling Fee', 'woocommerce-correios' ),
108
- 'type' => 'price',
109
- 'description' => __( 'Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woocommerce-correios' ),
110
- 'desc_tip' => true,
111
- 'placeholder' => '0.00',
112
- 'default' => '',
113
- ),
114
- 'optional_services' => array(
115
- 'title' => __( 'Optional Services', 'woocommerce-correios' ),
116
- 'type' => 'title',
117
- 'description' => __( 'Use these options to add the value of each service provided by the Correios.', 'woocommerce-correios' ),
118
- 'default' => '',
119
- ),
120
- 'receipt_notice' => array(
121
- 'title' => __( 'Receipt Notice', 'woocommerce-correios' ),
122
- 'type' => 'checkbox',
123
- 'label' => __( 'Enable receipt notice', 'woocommerce-correios' ),
124
- 'description' => __( 'This controls whether to add costs of the receipt notice service.', 'woocommerce-correios' ),
125
- 'desc_tip' => true,
126
- 'default' => 'no',
127
- ),
128
- 'own_hands' => array(
129
- 'title' => __( 'Own Hands', 'woocommerce-correios' ),
130
- 'type' => 'checkbox',
131
- 'label' => __( 'Enable own hands', 'woocommerce-correios' ),
132
- 'description' => __( 'This controls whether to add costs of the own hands service', 'woocommerce-correios' ),
133
- 'desc_tip' => true,
134
- 'default' => 'no',
135
- ),
136
- 'testing' => array(
137
- 'title' => __( 'Testing', 'woocommerce-correios' ),
138
- 'type' => 'title',
139
- 'default' => '',
140
- ),
141
- 'debug' => array(
142
- 'title' => __( 'Debug Log', 'woocommerce-correios' ),
143
- 'type' => 'checkbox',
144
- 'label' => __( 'Enable logging', 'woocommerce-correios' ),
145
- 'default' => 'no',
146
- 'description' => sprintf( __( 'Log %s events, such as WebServices requests.', 'woocommerce-correios' ), $this->method_title ) . $this->get_log_link(),
147
- ),
148
- );
149
  }
150
 
151
  /**
152
  * Get costs.
153
- * Costs based in 14/12/2015 from:
154
  * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/carta
155
  *
156
  * @return array
@@ -158,70 +39,70 @@ class WC_Correios_Shipping_Carta_Registrada extends WC_Correios_Shipping {
158
  protected function get_costs() {
159
  return apply_filters( 'woocommerce_correios_carta_registrada_costs', array(
160
  '20' => array(
161
- 'R' => '5.40',
162
- 'AR' => '9.30',
163
- 'MP' => '10.40',
164
- 'AR+MP' => '14.30',
165
  ),
166
  '50' => array(
167
- 'R' => '6.00',
168
- 'AR' => '9.90',
169
- 'MP' => '11.00',
170
- 'AR+MP' => '14.90',
171
  ),
172
  '100' => array(
173
- 'R' => '6.85',
174
- 'AR' => '10.75',
175
- 'MP' => '11.85',
176
- 'AR+MP' => '15.75',
177
  ),
178
  '150' => array(
179
- 'R' => '7.50',
180
- 'AR' => '11.40',
181
- 'MP' => '12.50',
182
- 'AR+MP' => '16.40',
183
  ),
184
  '200' => array(
185
- 'R' => '8.15',
186
- 'AR' => '12.05',
187
- 'MP' => '13.15',
188
- 'AR+MP' => '17.05',
189
  ),
190
  '250' => array(
191
- 'R' => '8.80',
192
- 'AR' => '12.70',
193
- 'MP' => '13.80',
194
- 'AR+MP' => '17.70',
195
  ),
196
  '300' => array(
197
- 'R' => '9.50',
198
- 'AR' => '13.40',
199
- 'MP' => '14.50',
200
- 'AR+MP' => '18.40',
201
  ),
202
  '350' => array(
203
- 'R' => '10.15',
204
- 'AR' => '14.05',
205
- 'MP' => '15.15',
206
- 'AR+MP' => '19.05',
207
  ),
208
  '400' => array(
209
- 'R' => '10.80',
210
- 'AR' => '14.70',
211
- 'MP' => '15.80',
212
- 'AR+MP' => '19.70',
213
  ),
214
  '450' => array(
215
- 'R' => '11.45',
216
- 'AR' => '15.35',
217
- 'MP' => '16.45',
218
- 'AR+MP' => '20.35',
219
  ),
220
  '500' => array(
221
- 'R' => '12.10',
222
- 'AR' => '16.00',
223
- 'MP' => '17.10',
224
- 'AR+MP' => '21.00',
225
  ),
226
  ), $this->id, $this->instance_id );
227
  }
@@ -251,90 +132,34 @@ class WC_Correios_Shipping_Carta_Registrada extends WC_Correios_Shipping {
251
  * @return float
252
  */
253
  protected function get_shipping_cost( $package ) {
254
- $type = $this->get_type_of_cost();
255
- $cost = 0;
256
- $total_weight = 0;
257
 
258
- if ( 'yes' == $this->debug ) {
259
  $this->log->add( $this->id, 'Calculating cost for Carta Registrada' );
260
  }
261
 
262
  if ( '' === $this->shipping_class ) {
263
- if ( 'yes' == $this->debug ) {
264
  $this->log->add( $this->id, 'Error: No shipping class has been configured!' );
265
  }
266
 
267
  return 0;
268
  }
269
 
270
- foreach ( $package['contents'] as $value ) {
271
- $product = $value['data'];
272
- $qty = $value['quantity'];
273
- $weight = 0;
274
-
275
- // Check if all or some items in the cart don't supports this shipping method.
276
- if ( $this->shipping_class !== $product->get_shipping_class() ) {
277
- if ( 'yes' == $this->debug ) {
278
- $this->log->add( $this->id, 'One or all items in the cart do not supports the configured shipping class' );
279
- }
280
-
281
- return 0;
282
- }
283
-
284
- if ( $qty > 0 && $product->needs_shipping() ) {
285
- $weight = wc_get_weight( str_replace( ',', '.', $product->weight ), 'g' );
286
-
287
- if ( $qty > 1 ) {
288
- $weight *= $qty;
289
- }
290
- }
291
-
292
- $total_weight += $weight;
293
- }
294
 
295
  foreach ( $this->get_costs() as $cost_weight => $costs ) {
296
- if ( $total_weight <= $cost_weight ) {
297
  $cost = $costs[ $type ];
298
  break;
299
  }
300
  }
301
 
302
- if ( 'yes' == $this->debug ) {
303
- $this->log->add( $this->id, sprintf( 'Total cost for %sg%s: %s', $total_weight, 'R' !== $type ? ' and ' . $type : '', $cost ) );
304
  }
305
 
306
  return $cost;
307
  }
308
-
309
- /**
310
- * Calculates the shipping rate.
311
- *
312
- * @param array $package Order package.
313
- */
314
- public function calculate_shipping( $package = array() ) {
315
- // Check if valid to be calculeted.
316
- if ( '' === $package['destination']['postcode'] || 'BR' !== $package['destination']['country'] ) {
317
- return;
318
- }
319
-
320
- // Cost.
321
- $cost = $this->get_shipping_cost( $package );
322
-
323
- if ( 0 === $cost ) {
324
- return;
325
- }
326
-
327
- // Apply fees.
328
- $fee = $this->get_fee( $this->fee, $cost );
329
-
330
- // Create the rate and apply filters.
331
- $rate = apply_filters( 'woocommerce_correios_' . $this->id . '_rate', array(
332
- 'id' => $this->id . $this->instance_id,
333
- 'label' => $this->title,
334
- 'cost' => $cost + $fee,
335
- ), $this->instance_id );
336
-
337
- // Add rate to WooCommerce.
338
- $this->add_rate( $rate );
339
- }
340
  }
14
  /**
15
  * Carta Registrada shipping method class.
16
  */
17
+ class WC_Correios_Shipping_Carta_Registrada extends WC_Correios_Shipping_Carta {
18
 
19
  /**
20
  * Initialize Carta Registrada.
23
  */
24
  public function __construct( $instance_id = 0 ) {
25
  $this->id = 'correios-carta-registrada';
 
26
  $this->method_title = __( 'Carta Registrada', 'woocommerce-correios' );
 
27
  $this->more_link = 'http://www.correios.com.br/para-voce/correios-de-a-a-z/carta-comercial';
 
 
 
 
28
 
29
+ parent::__construct( $instance_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
31
 
32
  /**
33
  * Get costs.
34
+ * Costs based in 28/06/2016 from:
35
  * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/carta
36
  *
37
  * @return array
39
  protected function get_costs() {
40
  return apply_filters( 'woocommerce_correios_carta_registrada_costs', array(
41
  '20' => array(
42
+ 'R' => 6.00,
43
+ 'AR' => 10.30,
44
+ 'MP' => 11.50,
45
+ 'AR+MP' => 15.80,
46
  ),
47
  '50' => array(
48
+ 'R' => 6.65,
49
+ 'AR' => 10.95,
50
+ 'MP' => 12.15,
51
+ 'AR+MP' => 16.45,
52
  ),
53
  '100' => array(
54
+ 'R' => 7.55,
55
+ 'AR' => 11.85,
56
+ 'MP' => 13.05,
57
+ 'AR+MP' => 17.35,
58
  ),
59
  '150' => array(
60
+ 'R' => 8.30,
61
+ 'AR' => 12.60,
62
+ 'MP' => 13.80,
63
+ 'AR+MP' => 18.10,
64
  ),
65
  '200' => array(
66
+ 'R' => 9.00,
67
+ 'AR' => 13.30,
68
+ 'MP' => 14.50,
69
+ 'AR+MP' => 18.80,
70
  ),
71
  '250' => array(
72
+ 'R' => 9.70,
73
+ 'AR' => 14.00,
74
+ 'MP' => 15.20,
75
+ 'AR+MP' => 19.50,
76
  ),
77
  '300' => array(
78
+ 'R' => 10.50,
79
+ 'AR' => 14.80,
80
+ 'MP' => 16.00,
81
+ 'AR+MP' => 20.30,
82
  ),
83
  '350' => array(
84
+ 'R' => 11.25,
85
+ 'AR' => 15.55,
86
+ 'MP' => 16.75,
87
+ 'AR+MP' => 21.05,
88
  ),
89
  '400' => array(
90
+ 'R' => 11.95,
91
+ 'AR' => 16.25,
92
+ 'MP' => 17.45,
93
+ 'AR+MP' => 21.75,
94
  ),
95
  '450' => array(
96
+ 'R' => 12.65,
97
+ 'AR' => 16.95,
98
+ 'MP' => 18.15,
99
+ 'AR+MP' => 22.45,
100
  ),
101
  '500' => array(
102
+ 'R' => 13.40,
103
+ 'AR' => 17.70,
104
+ 'MP' => 18.90,
105
+ 'AR+MP' => 23.20,
106
  ),
107
  ), $this->id, $this->instance_id );
108
  }
132
  * @return float
133
  */
134
  protected function get_shipping_cost( $package ) {
135
+ $type = $this->get_type_of_cost();
136
+ $cost = 0;
 
137
 
138
+ if ( 'yes' === $this->debug ) {
139
  $this->log->add( $this->id, 'Calculating cost for Carta Registrada' );
140
  }
141
 
142
  if ( '' === $this->shipping_class ) {
143
+ if ( 'yes' === $this->debug ) {
144
  $this->log->add( $this->id, 'Error: No shipping class has been configured!' );
145
  }
146
 
147
  return 0;
148
  }
149
 
150
+ $weight = $this->get_package_weight( $package );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
 
152
  foreach ( $this->get_costs() as $cost_weight => $costs ) {
153
+ if ( $weight <= $cost_weight ) {
154
  $cost = $costs[ $type ];
155
  break;
156
  }
157
  }
158
 
159
+ if ( 'yes' === $this->debug ) {
160
+ $this->log->add( $this->id, sprintf( 'Total cost for %sg%s: %s', $weight, 'R' !== $type ? ' and ' . $type : '', $cost ) );
161
  }
162
 
163
  return $cost;
164
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  }
includes/shipping/class-wc-correios-shipping-impresso-normal.php ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Correios Impresso Normal shipping method.
4
+ *
5
+ * @package WooCommerce_Correios/Classes/Shipping
6
+ * @since 3.1.0
7
+ * @version 3.1.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * Impresso Normal shipping method class.
16
+ */
17
+ class WC_Correios_Shipping_Impresso_Normal extends WC_Correios_Shipping_Impresso {
18
+
19
+ /**
20
+ * Additional cost per kg or fraction.
21
+ *
22
+ * Cost based in 25/08/2016 from:
23
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
24
+ *
25
+ * @var float
26
+ */
27
+ protected $additional_cost_per_kg = 3.70;
28
+
29
+ /**
30
+ * Weight limit for this shipping method.
31
+ *
32
+ * Value based in 25/08/2016 from:
33
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
34
+ *
35
+ * @var float
36
+ */
37
+ protected $shipping_method_weight_limit = 20000.000;
38
+
39
+ /**
40
+ * Initialize Impresso Normal.
41
+ *
42
+ * @param int $instance_id Shipping zone instance.
43
+ */
44
+ public function __construct( $instance_id = 0 ) {
45
+ $this->id = 'correios-impresso-normal';
46
+ $this->method_title = __( 'Impresso Normal', 'woocommerce-correios' );
47
+ $this->more_link = 'http://www.correios.com.br/para-voce/correios-de-a-a-z/impresso-normal';
48
+
49
+ parent::__construct( $instance_id );
50
+ }
51
+
52
+ /**
53
+ * Get costs.
54
+ * Costs based in 25/08/2016 from:
55
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
56
+ *
57
+ * @return array
58
+ */
59
+ protected function get_costs() {
60
+ return apply_filters( 'woocommerce_correios_impresso_normal_costs', array(
61
+ '20' => 0.95,
62
+ '50' => 1.45,
63
+ '100' => 1.95,
64
+ '150' => 2.35,
65
+ '200' => 2.75,
66
+ '250' => 3.20,
67
+ '300' => 3.65,
68
+ '350' => 4.05,
69
+ '400' => 4.50,
70
+ '450' => 4.95,
71
+ '500' => 5.40,
72
+ '550' => 5.75,
73
+ '600' => 6.15,
74
+ '650' => 6.55,
75
+ '700' => 6.90,
76
+ '750' => 7.25,
77
+ '800' => 7.65,
78
+ '850' => 8.05,
79
+ '900' => 8.50,
80
+ '950' => 8.85,
81
+ '1000' => 9.25,
82
+ ), $this->id, $this->instance_id );
83
+ }
84
+
85
+ /**
86
+ * Get shipping cost.
87
+ *
88
+ * @param array $package Order package.
89
+ *
90
+ * @return float
91
+ */
92
+ protected function get_shipping_cost( $package ) {
93
+ $cost = 0;
94
+ $additional_weight_kgs = 0;
95
+ $additional_weight_gs = 0;
96
+
97
+ if ( 'yes' === $this->debug ) {
98
+ $this->log->add( $this->id, 'Calculating cost for Impresso Normal' );
99
+ }
100
+
101
+ if ( '' === $this->shipping_class ) {
102
+ if ( 'yes' === $this->debug ) {
103
+ $this->log->add( $this->id, 'Error: No shipping class has been configured!' );
104
+ }
105
+
106
+ return 0;
107
+ }
108
+
109
+ $weight = $this->get_package_weight( $package );
110
+
111
+ if ( $weight <= $this->shipping_method_weight_limit ) {
112
+ if ( $weight > 1000 ) {
113
+ // Get the additional kgs over 1 kg.
114
+ $additional_weight_kgs = intval( $weight / 1000 );
115
+
116
+ // To ensure it will get the maximum price for 1 kg.
117
+ $additional_weight_gs = 1000;
118
+ } else {
119
+ // Get the cart weight itself.
120
+ $additional_weight_gs = $weight;
121
+ }
122
+
123
+ foreach ( $this->get_costs() as $cost_weights => $costs ) {
124
+ if ( $additional_weight_gs <= $cost_weights ) {
125
+ $cost = $costs;
126
+
127
+ if ( $additional_weight_kgs > 0 ) {
128
+ $cost += $additional_weight_kgs * $this->additional_cost_per_kg;
129
+ }
130
+
131
+ if ( $weight > $this->reasonable_registry_weight_limit || 'yes' === $this->own_hands || 'RN' === $this->registry_type ) {
132
+ $cost += $this->national_registry_cost;
133
+ } else {
134
+ $cost += $this->reasonable_registry_cost;
135
+ }
136
+
137
+ if ( 'yes' === $this->receipt_notice ) {
138
+ $cost += $this->receipt_notice_cost;
139
+ }
140
+
141
+ if ( 'yes' === $this->own_hands ) {
142
+ $cost += $this->own_hands_cost;
143
+ }
144
+
145
+ break;
146
+ }
147
+ }
148
+
149
+ if ( 'yes' === $this->debug ) {
150
+ $this->log->add( $this->id, sprintf( 'Total cost for %sg and %s: %s', $weight, $this->registry_type, $cost ) );
151
+ }
152
+ } else {
153
+ if ( 'yes' === $this->debug ) {
154
+ $this->log->add( $this->id, sprintf( 'The cart weight of %.3f exceeds the shipping method supported weight limit of %.3f', $weight, $this->shipping_method_weight_limit ) );
155
+ }
156
+ }
157
+
158
+ return $cost;
159
+ }
160
+ }
includes/shipping/class-wc-correios-shipping-impresso-urgente.php ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Correios Impresso Urgente shipping method.
4
+ *
5
+ * @package WooCommerce_Correios/Classes/Shipping
6
+ * @since 3.1.0
7
+ * @version 3.1.0
8
+ */
9
+
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /**
15
+ * Impresso Urgente shipping method class.
16
+ */
17
+ class WC_Correios_Shipping_Impresso_Urgente extends WC_Correios_Shipping_Impresso {
18
+
19
+ /**
20
+ * Weight limit for this shipping method.
21
+ *
22
+ * Value based in 25/08/2016 from:
23
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
24
+ *
25
+ * @var float
26
+ */
27
+ protected $shipping_method_weight_limit = 500.000;
28
+
29
+ /**
30
+ * Initialize Impresso Urgente.
31
+ *
32
+ * @param int $instance_id Shipping zone instance.
33
+ */
34
+ public function __construct( $instance_id = 0 ) {
35
+ $this->id = 'correios-impresso-urgente';
36
+ $this->method_title = __( 'Impresso Urgente', 'woocommerce-correios' );
37
+ $this->more_link = 'http://www.correios.com.br/para-voce/correios-de-a-a-z/impresso-normal';
38
+
39
+ parent::__construct( $instance_id );
40
+ }
41
+
42
+ /**
43
+ * Get costs.
44
+ * Costs based in 25/08/2016 from:
45
+ * http://www.correios.com.br/para-voce/consultas-e-solicitacoes/precos-e-prazos/servicos-nacionais_pasta/impresso-normal
46
+ *
47
+ * @return array
48
+ */
49
+ protected function get_costs() {
50
+ return apply_filters( 'woocommerce_correios_impresso_urgente_costs', array(
51
+ '20' => 1.40,
52
+ '50' => 1.95,
53
+ '100' => 2.60,
54
+ '150' => 3.20,
55
+ '200' => 3.75,
56
+ '250' => 4.40,
57
+ '300' => 4.95,
58
+ '350' => 5.55,
59
+ '400' => 6.05,
60
+ '450' => 6.70,
61
+ '500' => 7.25,
62
+ ), $this->id, $this->instance_id );
63
+ }
64
+
65
+ /**
66
+ * Get shipping cost.
67
+ *
68
+ * @param array $package Order package.
69
+ *
70
+ * @return float
71
+ */
72
+ protected function get_shipping_cost( $package ) {
73
+ $cost = 0;
74
+
75
+ if ( 'yes' === $this->debug ) {
76
+ $this->log->add( $this->id, 'Calculating cost for Impresso Urgente' );
77
+ }
78
+
79
+ if ( '' === $this->shipping_class ) {
80
+ if ( 'yes' === $this->debug ) {
81
+ $this->log->add( $this->id, 'Error: No shipping class has been configured!' );
82
+ }
83
+
84
+ return 0;
85
+ }
86
+
87
+ $weight = $this->get_package_weight( $package );
88
+
89
+ if ( $weight <= $this->shipping_method_weight_limit ) {
90
+ foreach ( $this->get_costs() as $cost_weights => $costs ) {
91
+ if ( $weight <= $cost_weights ) {
92
+ $cost = $costs;
93
+
94
+ if ( 'yes' === $this->own_hands || 'RN' === $this->registry_type ) {
95
+ $cost += $this->national_registry_cost;
96
+ } else {
97
+ $cost += $this->reasonable_registry_cost;
98
+ }
99
+
100
+ if ( 'yes' === $this->receipt_notice ) {
101
+ $cost += $this->receipt_notice_cost;
102
+ }
103
+
104
+ if ( 'yes' === $this->own_hands ) {
105
+ $cost += $this->own_hands_cost;
106
+ }
107
+
108
+ break;
109
+ }
110
+ }
111
+
112
+ if ( 'yes' === $this->debug ) {
113
+ $this->log->add( $this->id, sprintf( 'Total cost for %sg and %s: %s', $weight, $this->registry_type, $cost ) );
114
+ }
115
+ } else {
116
+ if ( 'yes' === $this->debug ) {
117
+ $this->log->add( $this->id, sprintf( 'The cart weight of %.3f exceeds the shipping method supported weight limit of %.3f', $weight, $this->shipping_method_weight_limit ) );
118
+ }
119
+ }
120
+
121
+ return $cost;
122
+ }
123
+ }
includes/shipping/class-wc-correios-shipping-leve-internacional.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  /**
15
  * Leve Internacional shipping method class.
16
  */
17
- class WC_Correios_Shipping_Leve_Internacional extends WC_Correios_International_Shipping {
18
 
19
  /**
20
  * Service code.
@@ -31,7 +31,7 @@ class WC_Correios_Shipping_Leve_Internacional extends WC_Correios_International_
31
  */
32
  public function __construct( $instance_id = 0 ) {
33
  $this->id = 'correios-leve-internacional';
34
- $this->method_title = __( 'Leve Internacional', 'woocommerce-correios' ) . ' ' . __( '(beta)', 'woocommerce-correios' );
35
  $this->more_link = '';
36
 
37
  parent::__construct( $instance_id );
14
  /**
15
  * Leve Internacional shipping method class.
16
  */
17
+ class WC_Correios_Shipping_Leve_Internacional extends WC_Correios_Shipping_International {
18
 
19
  /**
20
  * Service code.
31
  */
32
  public function __construct( $instance_id = 0 ) {
33
  $this->id = 'correios-leve-internacional';
34
+ $this->method_title = __( 'Leve Internacional', 'woocommerce-correios' );
35
  $this->more_link = '';
36
 
37
  parent::__construct( $instance_id );
includes/shipping/class-wc-correios-shipping-mercadoria-economica.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  /**
15
  * Mercadoria Econômica shipping method class.
16
  */
17
- class WC_Correios_Shipping_Mercadoria_Economica extends WC_Correios_International_Shipping {
18
 
19
  /**
20
  * Service code.
@@ -31,7 +31,7 @@ class WC_Correios_Shipping_Mercadoria_Economica extends WC_Correios_Internationa
31
  */
32
  public function __construct( $instance_id = 0 ) {
33
  $this->id = 'correios-mercadoria-economica';
34
- $this->method_title = __( 'Mercadoria Econ&ocirc;mica', 'woocommerce-correios' ) . ' ' . __( '(beta)', 'woocommerce-correios' );
35
  $this->more_link = '';
36
 
37
  parent::__construct( $instance_id );
14
  /**
15
  * Mercadoria Econômica shipping method class.
16
  */
17
+ class WC_Correios_Shipping_Mercadoria_Economica extends WC_Correios_Shipping_International {
18
 
19
  /**
20
  * Service code.
31
  */
32
  public function __construct( $instance_id = 0 ) {
33
  $this->id = 'correios-mercadoria-economica';
34
+ $this->method_title = __( 'Mercadoria Econ&ocirc;mica', 'woocommerce-correios' );
35
  $this->more_link = '';
36
 
37
  parent::__construct( $instance_id );
includes/shipping/class-wc-correios-shipping-mercadoria-expressa.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  /**
15
  * Mercadoria Expressa shipping method class.
16
  */
17
- class WC_Correios_Shipping_Mercadoria_Expressa extends WC_Correios_International_Shipping {
18
 
19
  /**
20
  * Service code.
@@ -31,7 +31,7 @@ class WC_Correios_Shipping_Mercadoria_Expressa extends WC_Correios_International
31
  */
32
  public function __construct( $instance_id = 0 ) {
33
  $this->id = 'correios-mercadoria-expressa';
34
- $this->method_title = __( 'Mercadoria Expressa', 'woocommerce-correios' ) . ' ' . __( '(beta)', 'woocommerce-correios' );
35
  $this->more_link = '';
36
 
37
  parent::__construct( $instance_id );
14
  /**
15
  * Mercadoria Expressa shipping method class.
16
  */
17
+ class WC_Correios_Shipping_Mercadoria_Expressa extends WC_Correios_Shipping_International {
18
 
19
  /**
20
  * Service code.
31
  */
32
  public function __construct( $instance_id = 0 ) {
33
  $this->id = 'correios-mercadoria-expressa';
34
+ $this->method_title = __( 'Mercadoria Expressa', 'woocommerce-correios' );
35
  $this->more_link = '';
36
 
37
  parent::__construct( $instance_id );
includes/wc-correios-functions.php CHANGED
@@ -105,6 +105,7 @@ function wc_correios_get_error_message( $code ) {
105
  $messages = apply_filters( 'woocommerce_correios_available_error_messages', array(
106
  '-33' => __( 'System temporarily down. Please try again later.', 'woocommerce-correios' ),
107
  '-3' => __( 'Invalid zip code.', 'woocommerce-correios' ),
 
108
  '010' => __( 'Area with delivery temporarily subjected to different periods.', 'woocommerce-correios' ),
109
  ) );
110
 
@@ -162,7 +163,7 @@ function wc_correios_update_tracking_code( $order_id, $tracking_code ) {
162
  /**
163
  * Get address by postcode.
164
  *
165
- * @param string $postcode
166
  *
167
  * @return stdClass
168
  */
105
  $messages = apply_filters( 'woocommerce_correios_available_error_messages', array(
106
  '-33' => __( 'System temporarily down. Please try again later.', 'woocommerce-correios' ),
107
  '-3' => __( 'Invalid zip code.', 'woocommerce-correios' ),
108
+ '008' => __( 'Service unavailable to the informed route.', 'woocommerce-correios' ),
109
  '010' => __( 'Area with delivery temporarily subjected to different periods.', 'woocommerce-correios' ),
110
  ) );
111
 
163
  /**
164
  * Get address by postcode.
165
  *
166
+ * @param string $postcode Postcode.
167
  *
168
  * @return stdClass
169
  */
languages/woocommerce-correios.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Correios 3.0.6\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/plugins/woocommerce-domination/\n"
7
- "POT-Creation-Date: 2016-08-20 18:37:13+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -13,305 +13,359 @@ msgstr ""
13
  "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
15
 
16
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:28
17
- msgid "%s is a international shipping method from Correios."
 
 
 
 
 
 
18
  msgstr ""
19
 
20
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:56
21
- #: includes/abstracts/abstract-wc-correios-shipping.php:91
 
 
22
  #: includes/emails/class-wc-correios-tracking-email.php:50
23
  #: includes/integrations/class-wc-correios-integration.php:78
24
  #: includes/integrations/class-wc-correios-integration.php:96
25
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:80
26
  #: includes/shipping/class-wc-correios-shipping-legacy.php:79
27
  msgid "Enable/Disable"
28
  msgstr ""
29
 
30
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:58
31
- #: includes/abstracts/abstract-wc-correios-shipping.php:93
32
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:82
 
33
  #: includes/shipping/class-wc-correios-shipping-legacy.php:81
34
  msgid "Enable this shipping method"
35
  msgstr ""
36
 
37
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:62
38
- #: includes/abstracts/abstract-wc-correios-shipping.php:97
39
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:86
 
40
  #: includes/shipping/class-wc-correios-shipping-legacy.php:85
41
  msgid "Title"
42
  msgstr ""
43
 
44
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:64
45
- #: includes/abstracts/abstract-wc-correios-shipping.php:99
46
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:88
 
47
  #: includes/shipping/class-wc-correios-shipping-legacy.php:87
48
  msgid "This controls the title which the user sees during checkout."
49
  msgstr ""
50
 
51
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:69
52
- #: includes/abstracts/abstract-wc-correios-shipping.php:104
53
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:93
 
54
  msgid "Behavior Options"
55
  msgstr ""
56
 
57
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:74
58
- msgid "Origin State"
59
- msgstr ""
60
-
61
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:76
62
- msgid "The UF of the location your packages are delivered from."
63
  msgstr ""
64
 
65
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:83
66
- msgid "Origin Locale"
 
67
  msgstr ""
68
 
69
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:85
70
- msgid "The location of your packages are delivered from."
 
 
 
 
71
  msgstr ""
72
 
73
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:90
74
- msgid "Capital"
 
 
 
 
 
 
75
  msgstr ""
76
 
77
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:91
78
- msgid "Interior"
 
 
 
79
  msgstr ""
80
 
81
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:95
82
- #: includes/abstracts/abstract-wc-correios-shipping.php:117
83
- msgid "Delivery Time"
 
 
84
  msgstr ""
85
 
86
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:97
87
- #: includes/abstracts/abstract-wc-correios-shipping.php:119
88
- msgid "Show estimated delivery time"
 
89
  msgstr ""
90
 
91
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:98
92
- #: includes/abstracts/abstract-wc-correios-shipping.php:120
93
- msgid "Display the estimated delivery time in working days."
 
94
  msgstr ""
95
 
96
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:103
97
- #: includes/abstracts/abstract-wc-correios-shipping.php:133
98
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:107
99
- #: includes/shipping/class-wc-correios-shipping-legacy.php:123
100
- msgid "Handling Fee"
101
  msgstr ""
102
 
103
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:105
104
- #: includes/abstracts/abstract-wc-correios-shipping.php:135
105
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:109
106
- #: includes/shipping/class-wc-correios-shipping-legacy.php:125
107
- msgid ""
108
- "Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to "
109
- "disable."
110
  msgstr ""
111
 
112
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:111
113
- #: includes/abstracts/abstract-wc-correios-shipping.php:141
114
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:115
115
- msgid "Optional Services"
116
  msgstr ""
117
 
118
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:113
119
- #: includes/abstracts/abstract-wc-correios-shipping.php:143
120
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:117
121
- msgid "Use these options to add the value of each service provided by the Correios."
122
  msgstr ""
123
 
124
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:117
125
- #: includes/abstracts/abstract-wc-correios-shipping.php:237
126
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:137
 
127
  #: includes/shipping/class-wc-correios-shipping-legacy.php:224
128
  msgid "Testing"
129
  msgstr ""
130
 
131
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:122
132
- #: includes/abstracts/abstract-wc-correios-shipping.php:242
 
 
133
  #: includes/integrations/class-wc-correios-integration.php:84
134
  #: includes/integrations/class-wc-correios-integration.php:137
135
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:142
136
  #: includes/shipping/class-wc-correios-shipping-legacy.php:228
137
  msgid "Debug Log"
138
  msgstr ""
139
 
140
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:124
141
- #: includes/abstracts/abstract-wc-correios-shipping.php:244
142
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:144
 
143
  #: includes/shipping/class-wc-correios-shipping-legacy.php:230
144
  msgid "Enable logging"
145
  msgstr ""
146
 
147
- #: includes/abstracts/abstract-wc-correios-international-shipping.php:126
148
- #: includes/abstracts/abstract-wc-correios-shipping.php:246
 
 
149
  #: includes/integrations/class-wc-correios-integration.php:88
150
  #: includes/integrations/class-wc-correios-integration.php:141
151
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:146
152
  msgid "Log %s events, such as WebServices requests."
153
  msgstr ""
154
 
155
- #: includes/abstracts/abstract-wc-correios-shipping.php:42
156
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:28
157
- msgid "%s is a shipping method from Correios."
158
  msgstr ""
159
 
160
- #: includes/abstracts/abstract-wc-correios-shipping.php:81
161
- #: includes/integrations/class-wc-correios-integration.php:63
162
- msgid "View logs."
163
  msgstr ""
164
 
165
- #: includes/abstracts/abstract-wc-correios-shipping.php:109
166
- msgid "Origin Postcode"
167
  msgstr ""
168
 
169
- #: includes/abstracts/abstract-wc-correios-shipping.php:111
170
- msgid "The postcode of the location your packages are delivered from."
171
  msgstr ""
172
 
173
- #: includes/abstracts/abstract-wc-correios-shipping.php:125
174
- msgid "Additional Days"
175
  msgstr ""
176
 
177
- #: includes/abstracts/abstract-wc-correios-shipping.php:127
178
- msgid "Additional working days to the estimated delivery."
179
  msgstr ""
180
 
181
- #: includes/abstracts/abstract-wc-correios-shipping.php:147
182
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:121
183
- msgid "Receipt Notice"
184
  msgstr ""
185
 
186
- #: includes/abstracts/abstract-wc-correios-shipping.php:149
187
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:123
188
- msgid "Enable receipt notice"
189
  msgstr ""
190
 
191
- #: includes/abstracts/abstract-wc-correios-shipping.php:150
192
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:124
193
- msgid "This controls whether to add costs of the receipt notice service."
194
  msgstr ""
195
 
196
- #: includes/abstracts/abstract-wc-correios-shipping.php:155
197
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:129
198
- msgid "Own Hands"
199
  msgstr ""
200
 
201
- #: includes/abstracts/abstract-wc-correios-shipping.php:157
202
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:131
203
- msgid "Enable own hands"
204
  msgstr ""
205
 
206
- #: includes/abstracts/abstract-wc-correios-shipping.php:158
207
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:132
208
- msgid "This controls whether to add costs of the own hands service"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  msgstr ""
210
 
211
- #: includes/abstracts/abstract-wc-correios-shipping.php:163
 
 
 
 
 
 
 
 
212
  msgid "Declare Value for Insurance"
213
  msgstr ""
214
 
215
- #: includes/abstracts/abstract-wc-correios-shipping.php:165
216
  msgid "Enable declared value"
217
  msgstr ""
218
 
219
- #: includes/abstracts/abstract-wc-correios-shipping.php:166
220
  msgid ""
221
  "This controls if the price of the package must be declared for insurance "
222
  "purposes."
223
  msgstr ""
224
 
225
- #: includes/abstracts/abstract-wc-correios-shipping.php:171
226
  msgid "Service Options"
227
  msgstr ""
228
 
229
- #: includes/abstracts/abstract-wc-correios-shipping.php:176
230
  msgid "Service Code"
231
  msgstr ""
232
 
233
- #: includes/abstracts/abstract-wc-correios-shipping.php:178
234
  msgid "Service code, use this for custom codes."
235
  msgstr ""
236
 
237
- #: includes/abstracts/abstract-wc-correios-shipping.php:184
238
  #: includes/shipping/class-wc-correios-shipping-esedex.php:40
239
  msgid "Service Type"
240
  msgstr ""
241
 
242
- #: includes/abstracts/abstract-wc-correios-shipping.php:186
243
  #: includes/shipping/class-wc-correios-shipping-esedex.php:42
244
  #: includes/shipping/class-wc-correios-shipping-legacy.php:136
245
  msgid "Choose between conventional or corporate service."
246
  msgstr ""
247
 
248
- #: includes/abstracts/abstract-wc-correios-shipping.php:191
249
  #: includes/shipping/class-wc-correios-shipping-legacy.php:140
250
  msgid "Conventional"
251
  msgstr ""
252
 
253
- #: includes/abstracts/abstract-wc-correios-shipping.php:192
254
  #: includes/shipping/class-wc-correios-shipping-esedex.php:47
255
  #: includes/shipping/class-wc-correios-shipping-legacy.php:141
256
  msgid "Corporate"
257
  msgstr ""
258
 
259
- #: includes/abstracts/abstract-wc-correios-shipping.php:196
260
  #: includes/shipping/class-wc-correios-shipping-legacy.php:145
261
  msgid "Administrative Code"
262
  msgstr ""
263
 
264
- #: includes/abstracts/abstract-wc-correios-shipping.php:198
265
  msgid "Your Correios login. It's usually your CNPJ."
266
  msgstr ""
267
 
268
- #: includes/abstracts/abstract-wc-correios-shipping.php:203
269
  #: includes/shipping/class-wc-correios-shipping-legacy.php:151
270
  msgid "Administrative Password"
271
  msgstr ""
272
 
273
- #: includes/abstracts/abstract-wc-correios-shipping.php:205
274
  #: includes/shipping/class-wc-correios-shipping-legacy.php:153
275
  msgid "Your Correios password."
276
  msgstr ""
277
 
278
- #: includes/abstracts/abstract-wc-correios-shipping.php:210
279
  #: includes/shipping/class-wc-correios-shipping-legacy.php:197
280
  msgid "Package Standard"
281
  msgstr ""
282
 
283
- #: includes/abstracts/abstract-wc-correios-shipping.php:212
284
  msgid "Minimum measure for your shipping packages."
285
  msgstr ""
286
 
287
- #: includes/abstracts/abstract-wc-correios-shipping.php:216
288
  #: includes/shipping/class-wc-correios-shipping-legacy.php:203
289
  msgid "Minimum Height"
290
  msgstr ""
291
 
292
- #: includes/abstracts/abstract-wc-correios-shipping.php:218
293
  msgid "Minimum height of your shipping packages. Correios needs at least 2cm."
294
  msgstr ""
295
 
296
- #: includes/abstracts/abstract-wc-correios-shipping.php:223
297
  #: includes/shipping/class-wc-correios-shipping-legacy.php:210
298
  msgid "Minimum Width"
299
  msgstr ""
300
 
301
- #: includes/abstracts/abstract-wc-correios-shipping.php:225
302
  msgid "Minimum width of your shipping packages. Correios needs at least 11cm."
303
  msgstr ""
304
 
305
- #: includes/abstracts/abstract-wc-correios-shipping.php:230
306
  #: includes/shipping/class-wc-correios-shipping-legacy.php:217
307
  msgid "Minimum Length"
308
  msgstr ""
309
 
310
- #: includes/abstracts/abstract-wc-correios-shipping.php:232
311
  msgid "Minimum length of your shipping packages. Correios needs at least 16cm."
312
  msgstr ""
313
 
314
- #: includes/admin/class-wc-correios-admin-orders.php:47
315
  msgid "Tracking code:"
316
  msgstr ""
317
 
@@ -349,12 +403,12 @@ msgstr ""
349
  msgid "More about %s."
350
  msgstr ""
351
 
352
- #: includes/class-wc-correios-autofill-addresses.php:255
353
  msgid "Missing postcode paramater."
354
  msgstr ""
355
 
356
- #: includes/class-wc-correios-autofill-addresses.php:262
357
- #: includes/class-wc-correios-autofill-addresses.php:269
358
  msgid "Invalid postcode."
359
  msgstr ""
360
 
@@ -572,25 +626,21 @@ msgstr ""
572
  msgid "Postcode database emptied successfully!"
573
  msgstr ""
574
 
575
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:27
576
  msgid "Carta Registrada"
577
  msgstr ""
578
 
579
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:64
580
- msgid "-- Select a shipping class --"
581
- msgstr ""
582
-
583
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:98
584
- msgid "Shipping Class"
585
  msgstr ""
586
 
587
- #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:100
588
- msgid "Select for which shipping class this method will be applied."
589
  msgstr ""
590
 
591
- #: includes/shipping/class-wc-correios-shipping-esedex.php:34
592
- #: includes/shipping/class-wc-correios-shipping-legacy.php:189
593
- msgid "e-SEDEX"
594
  msgstr ""
595
 
596
  #: includes/shipping/class-wc-correios-shipping-legacy.php:18
@@ -731,12 +781,6 @@ msgstr ""
731
  msgid "Leve Internacional"
732
  msgstr ""
733
 
734
- #: includes/shipping/class-wc-correios-shipping-leve-internacional.php:34
735
- #: includes/shipping/class-wc-correios-shipping-mercadoria-economica.php:34
736
- #: includes/shipping/class-wc-correios-shipping-mercadoria-expressa.php:34
737
- msgid "(beta)"
738
- msgstr ""
739
-
740
  #: includes/shipping/class-wc-correios-shipping-mercadoria-economica.php:34
741
  msgid "Mercadoria Econ&ocirc;mica"
742
  msgstr ""
@@ -772,10 +816,14 @@ msgid "Invalid zip code."
772
  msgstr ""
773
 
774
  #: includes/wc-correios-functions.php:108
 
 
 
 
775
  msgid "Area with delivery temporarily subjected to different periods."
776
  msgstr ""
777
 
778
- #: includes/wc-correios-functions.php:147
779
  msgid "Added a Correios tracking code: %s"
780
  msgstr ""
781
 
2
  # This file is distributed under the GPLv2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Correios 3.1.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/plugins/woocommerce-domination/\n"
7
+ "POT-Creation-Date: 2016-09-13 05:28:26+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
13
  "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
15
 
16
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:26
17
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:78
18
+ #: includes/abstracts/abstract-wc-correios-shipping.php:41
19
+ msgid "%s is a shipping method from Correios."
20
+ msgstr ""
21
+
22
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:61
23
+ msgid "-- Select a shipping class --"
24
  msgstr ""
25
 
26
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:77
27
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:112
28
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:56
29
+ #: includes/abstracts/abstract-wc-correios-shipping.php:90
30
  #: includes/emails/class-wc-correios-tracking-email.php:50
31
  #: includes/integrations/class-wc-correios-integration.php:78
32
  #: includes/integrations/class-wc-correios-integration.php:96
 
33
  #: includes/shipping/class-wc-correios-shipping-legacy.php:79
34
  msgid "Enable/Disable"
35
  msgstr ""
36
 
37
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:79
38
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:114
39
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:58
40
+ #: includes/abstracts/abstract-wc-correios-shipping.php:92
41
  #: includes/shipping/class-wc-correios-shipping-legacy.php:81
42
  msgid "Enable this shipping method"
43
  msgstr ""
44
 
45
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:83
46
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:118
47
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:62
48
+ #: includes/abstracts/abstract-wc-correios-shipping.php:96
49
  #: includes/shipping/class-wc-correios-shipping-legacy.php:85
50
  msgid "Title"
51
  msgstr ""
52
 
53
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:85
54
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:120
55
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:64
56
+ #: includes/abstracts/abstract-wc-correios-shipping.php:98
57
  #: includes/shipping/class-wc-correios-shipping-legacy.php:87
58
  msgid "This controls the title which the user sees during checkout."
59
  msgstr ""
60
 
61
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:90
62
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:125
63
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:69
64
+ #: includes/abstracts/abstract-wc-correios-shipping.php:103
65
  msgid "Behavior Options"
66
  msgstr ""
67
 
68
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:95
69
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:130
70
+ msgid "Shipping Class"
 
 
 
71
  msgstr ""
72
 
73
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:97
74
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:132
75
+ msgid "Select for which shipping class this method will be applied."
76
  msgstr ""
77
 
78
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:104
79
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:153
80
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:103
81
+ #: includes/abstracts/abstract-wc-correios-shipping.php:132
82
+ #: includes/shipping/class-wc-correios-shipping-legacy.php:123
83
+ msgid "Handling Fee"
84
  msgstr ""
85
 
86
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:106
87
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:155
88
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:105
89
+ #: includes/abstracts/abstract-wc-correios-shipping.php:134
90
+ #: includes/shipping/class-wc-correios-shipping-legacy.php:125
91
+ msgid ""
92
+ "Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to "
93
+ "disable."
94
  msgstr ""
95
 
96
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:112
97
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:161
98
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:111
99
+ #: includes/abstracts/abstract-wc-correios-shipping.php:140
100
+ msgid "Optional Services"
101
  msgstr ""
102
 
103
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:114
104
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:163
105
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:113
106
+ #: includes/abstracts/abstract-wc-correios-shipping.php:142
107
+ msgid "Use these options to add the value of each service provided by the Correios."
108
  msgstr ""
109
 
110
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:118
111
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:167
112
+ #: includes/abstracts/abstract-wc-correios-shipping.php:146
113
+ msgid "Receipt Notice"
114
  msgstr ""
115
 
116
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:120
117
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:169
118
+ #: includes/abstracts/abstract-wc-correios-shipping.php:148
119
+ msgid "Enable receipt notice"
120
  msgstr ""
121
 
122
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:121
123
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:170
124
+ #: includes/abstracts/abstract-wc-correios-shipping.php:149
125
+ msgid "This controls whether to add costs of the receipt notice service."
 
126
  msgstr ""
127
 
128
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:126
129
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:175
130
+ #: includes/abstracts/abstract-wc-correios-shipping.php:154
131
+ msgid "Own Hands"
 
 
 
132
  msgstr ""
133
 
134
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:128
135
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:177
136
+ #: includes/abstracts/abstract-wc-correios-shipping.php:156
137
+ msgid "Enable own hands"
138
  msgstr ""
139
 
140
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:129
141
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:178
142
+ #: includes/abstracts/abstract-wc-correios-shipping.php:157
143
+ msgid "This controls whether to add costs of the own hands service"
144
  msgstr ""
145
 
146
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:134
147
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:183
148
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:117
149
+ #: includes/abstracts/abstract-wc-correios-shipping.php:236
150
  #: includes/shipping/class-wc-correios-shipping-legacy.php:224
151
  msgid "Testing"
152
  msgstr ""
153
 
154
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:139
155
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:188
156
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:122
157
+ #: includes/abstracts/abstract-wc-correios-shipping.php:241
158
  #: includes/integrations/class-wc-correios-integration.php:84
159
  #: includes/integrations/class-wc-correios-integration.php:137
 
160
  #: includes/shipping/class-wc-correios-shipping-legacy.php:228
161
  msgid "Debug Log"
162
  msgstr ""
163
 
164
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:141
165
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:190
166
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:124
167
+ #: includes/abstracts/abstract-wc-correios-shipping.php:243
168
  #: includes/shipping/class-wc-correios-shipping-legacy.php:230
169
  msgid "Enable logging"
170
  msgstr ""
171
 
172
+ #: includes/abstracts/abstract-wc-correios-shipping-carta.php:143
173
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:192
174
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:126
175
+ #: includes/abstracts/abstract-wc-correios-shipping.php:245
176
  #: includes/integrations/class-wc-correios-integration.php:88
177
  #: includes/integrations/class-wc-correios-integration.php:141
 
178
  msgid "Log %s events, such as WebServices requests."
179
  msgstr ""
180
 
181
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:139
182
+ msgid "Registry Type"
 
183
  msgstr ""
184
 
185
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:141
186
+ msgid "Select for which registry type this method will be applied."
 
187
  msgstr ""
188
 
189
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:146
190
+ msgid "-- Select a registry type --"
191
  msgstr ""
192
 
193
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:147
194
+ msgid "Registro Nacional"
195
  msgstr ""
196
 
197
+ #: includes/abstracts/abstract-wc-correios-shipping-impresso.php:148
198
+ msgid "Registro Módico"
199
  msgstr ""
200
 
201
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:28
202
+ msgid "%s is a international shipping method from Correios."
203
  msgstr ""
204
 
205
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:74
206
+ msgid "Origin State"
 
207
  msgstr ""
208
 
209
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:76
210
+ msgid "The UF of the location your packages are delivered from."
 
211
  msgstr ""
212
 
213
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:83
214
+ msgid "Origin Locale"
 
215
  msgstr ""
216
 
217
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:85
218
+ msgid "The location of your packages are delivered from."
 
219
  msgstr ""
220
 
221
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:90
222
+ msgid "Capital"
 
223
  msgstr ""
224
 
225
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:91
226
+ msgid "Interior"
227
+ msgstr ""
228
+
229
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:95
230
+ #: includes/abstracts/abstract-wc-correios-shipping.php:116
231
+ msgid "Delivery Time"
232
+ msgstr ""
233
+
234
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:97
235
+ #: includes/abstracts/abstract-wc-correios-shipping.php:118
236
+ msgid "Show estimated delivery time"
237
+ msgstr ""
238
+
239
+ #: includes/abstracts/abstract-wc-correios-shipping-international.php:98
240
+ #: includes/abstracts/abstract-wc-correios-shipping.php:119
241
+ msgid "Display the estimated delivery time in working days."
242
+ msgstr ""
243
+
244
+ #: includes/abstracts/abstract-wc-correios-shipping.php:80
245
+ #: includes/integrations/class-wc-correios-integration.php:63
246
+ msgid "View logs."
247
+ msgstr ""
248
+
249
+ #: includes/abstracts/abstract-wc-correios-shipping.php:108
250
+ msgid "Origin Postcode"
251
+ msgstr ""
252
+
253
+ #: includes/abstracts/abstract-wc-correios-shipping.php:110
254
+ msgid "The postcode of the location your packages are delivered from."
255
  msgstr ""
256
 
257
+ #: includes/abstracts/abstract-wc-correios-shipping.php:124
258
+ msgid "Additional Days"
259
+ msgstr ""
260
+
261
+ #: includes/abstracts/abstract-wc-correios-shipping.php:126
262
+ msgid "Additional working days to the estimated delivery."
263
+ msgstr ""
264
+
265
+ #: includes/abstracts/abstract-wc-correios-shipping.php:162
266
  msgid "Declare Value for Insurance"
267
  msgstr ""
268
 
269
+ #: includes/abstracts/abstract-wc-correios-shipping.php:164
270
  msgid "Enable declared value"
271
  msgstr ""
272
 
273
+ #: includes/abstracts/abstract-wc-correios-shipping.php:165
274
  msgid ""
275
  "This controls if the price of the package must be declared for insurance "
276
  "purposes."
277
  msgstr ""
278
 
279
+ #: includes/abstracts/abstract-wc-correios-shipping.php:170
280
  msgid "Service Options"
281
  msgstr ""
282
 
283
+ #: includes/abstracts/abstract-wc-correios-shipping.php:175
284
  msgid "Service Code"
285
  msgstr ""
286
 
287
+ #: includes/abstracts/abstract-wc-correios-shipping.php:177
288
  msgid "Service code, use this for custom codes."
289
  msgstr ""
290
 
291
+ #: includes/abstracts/abstract-wc-correios-shipping.php:183
292
  #: includes/shipping/class-wc-correios-shipping-esedex.php:40
293
  msgid "Service Type"
294
  msgstr ""
295
 
296
+ #: includes/abstracts/abstract-wc-correios-shipping.php:185
297
  #: includes/shipping/class-wc-correios-shipping-esedex.php:42
298
  #: includes/shipping/class-wc-correios-shipping-legacy.php:136
299
  msgid "Choose between conventional or corporate service."
300
  msgstr ""
301
 
302
+ #: includes/abstracts/abstract-wc-correios-shipping.php:190
303
  #: includes/shipping/class-wc-correios-shipping-legacy.php:140
304
  msgid "Conventional"
305
  msgstr ""
306
 
307
+ #: includes/abstracts/abstract-wc-correios-shipping.php:191
308
  #: includes/shipping/class-wc-correios-shipping-esedex.php:47
309
  #: includes/shipping/class-wc-correios-shipping-legacy.php:141
310
  msgid "Corporate"
311
  msgstr ""
312
 
313
+ #: includes/abstracts/abstract-wc-correios-shipping.php:195
314
  #: includes/shipping/class-wc-correios-shipping-legacy.php:145
315
  msgid "Administrative Code"
316
  msgstr ""
317
 
318
+ #: includes/abstracts/abstract-wc-correios-shipping.php:197
319
  msgid "Your Correios login. It's usually your CNPJ."
320
  msgstr ""
321
 
322
+ #: includes/abstracts/abstract-wc-correios-shipping.php:202
323
  #: includes/shipping/class-wc-correios-shipping-legacy.php:151
324
  msgid "Administrative Password"
325
  msgstr ""
326
 
327
+ #: includes/abstracts/abstract-wc-correios-shipping.php:204
328
  #: includes/shipping/class-wc-correios-shipping-legacy.php:153
329
  msgid "Your Correios password."
330
  msgstr ""
331
 
332
+ #: includes/abstracts/abstract-wc-correios-shipping.php:209
333
  #: includes/shipping/class-wc-correios-shipping-legacy.php:197
334
  msgid "Package Standard"
335
  msgstr ""
336
 
337
+ #: includes/abstracts/abstract-wc-correios-shipping.php:211
338
  msgid "Minimum measure for your shipping packages."
339
  msgstr ""
340
 
341
+ #: includes/abstracts/abstract-wc-correios-shipping.php:215
342
  #: includes/shipping/class-wc-correios-shipping-legacy.php:203
343
  msgid "Minimum Height"
344
  msgstr ""
345
 
346
+ #: includes/abstracts/abstract-wc-correios-shipping.php:217
347
  msgid "Minimum height of your shipping packages. Correios needs at least 2cm."
348
  msgstr ""
349
 
350
+ #: includes/abstracts/abstract-wc-correios-shipping.php:222
351
  #: includes/shipping/class-wc-correios-shipping-legacy.php:210
352
  msgid "Minimum Width"
353
  msgstr ""
354
 
355
+ #: includes/abstracts/abstract-wc-correios-shipping.php:224
356
  msgid "Minimum width of your shipping packages. Correios needs at least 11cm."
357
  msgstr ""
358
 
359
+ #: includes/abstracts/abstract-wc-correios-shipping.php:229
360
  #: includes/shipping/class-wc-correios-shipping-legacy.php:217
361
  msgid "Minimum Length"
362
  msgstr ""
363
 
364
+ #: includes/abstracts/abstract-wc-correios-shipping.php:231
365
  msgid "Minimum length of your shipping packages. Correios needs at least 16cm."
366
  msgstr ""
367
 
368
+ #: includes/admin/class-wc-correios-admin-orders.php:48
369
  msgid "Tracking code:"
370
  msgstr ""
371
 
403
  msgid "More about %s."
404
  msgstr ""
405
 
406
+ #: includes/class-wc-correios-autofill-addresses.php:257
407
  msgid "Missing postcode paramater."
408
  msgstr ""
409
 
410
+ #: includes/class-wc-correios-autofill-addresses.php:264
411
+ #: includes/class-wc-correios-autofill-addresses.php:271
412
  msgid "Invalid postcode."
413
  msgstr ""
414
 
626
  msgid "Postcode database emptied successfully!"
627
  msgstr ""
628
 
629
+ #: includes/shipping/class-wc-correios-shipping-carta-registrada.php:26
630
  msgid "Carta Registrada"
631
  msgstr ""
632
 
633
+ #: includes/shipping/class-wc-correios-shipping-esedex.php:34
634
+ #: includes/shipping/class-wc-correios-shipping-legacy.php:189
635
+ msgid "e-SEDEX"
 
 
 
636
  msgstr ""
637
 
638
+ #: includes/shipping/class-wc-correios-shipping-impresso-normal.php:46
639
+ msgid "Impresso Normal"
640
  msgstr ""
641
 
642
+ #: includes/shipping/class-wc-correios-shipping-impresso-urgente.php:36
643
+ msgid "Impresso Urgente"
 
644
  msgstr ""
645
 
646
  #: includes/shipping/class-wc-correios-shipping-legacy.php:18
781
  msgid "Leve Internacional"
782
  msgstr ""
783
 
 
 
 
 
 
 
784
  #: includes/shipping/class-wc-correios-shipping-mercadoria-economica.php:34
785
  msgid "Mercadoria Econ&ocirc;mica"
786
  msgstr ""
816
  msgstr ""
817
 
818
  #: includes/wc-correios-functions.php:108
819
+ msgid "Service unavailable to the informed route."
820
+ msgstr ""
821
+
822
+ #: includes/wc-correios-functions.php:109
823
  msgid "Area with delivery temporarily subjected to different periods."
824
  msgstr ""
825
 
826
+ #: includes/wc-correios-functions.php:148
827
  msgid "Added a Correios tracking code: %s"
828
  msgstr ""
829
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://claudiosmweb.com/doacoes/
4
  Tags: shipping, delivery, woocommerce, correios
5
  Requires at least: 4.0
6
  Tested up to: 4.6
7
- Stable tag: 3.0.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -31,6 +31,8 @@ Estão integrados os seguintes serviços:
31
  - SEDEX Hoje
32
  - e-SEDEX (necessário conta administrativa nos Correios)
33
  - Carta Registrada
 
 
34
  - Entrega internacional:
35
  - Mercadoria Expressa
36
  - Mercadoria Econômica
@@ -102,6 +104,8 @@ São aceitos os seguintes métodos de entrega nacionais:
102
  - SEDEX Hoje
103
  - e-SEDEX (necessário conta administrativa nos Correios)
104
  - Carta Registrada
 
 
105
 
106
  E os seguintes métodos de entrega internacionais:
107
 
@@ -199,6 +203,12 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
199
 
200
  == Changelog ==
201
 
 
 
 
 
 
 
202
  = 3.0.6 - 2016/08/20 =
203
 
204
  - Introduzida a função `wc_correios_get_address_by_postcode()`.
@@ -239,13 +249,9 @@ Em caso de dúvidas, basta abrir um tópico no [fórum de suporte do plugin](htt
239
 
240
  == Upgrade Notice ==
241
 
242
- = 3.0.6 =
243
 
244
- - Reformulação geral de todos o código do plugin.
245
- - Adicionado suporte as áreas de entrega do WooCommerce 2.6.
246
- - Adicionado os métodos de SEDEX 10 Envelope, SEDEX 12, Carta Registrada, Mercadoria Expressa, Mercadoria Econômica e Leve Internacional.
247
- - Adicionado novo menu de "integrações".
248
- - Adicionada integração com o serviço de consulta de CEP e assim adicionando uma opção para autopreencher endereços com base no CEP.
249
- - Atualizada a integração com o sistema que gera o histórico de rastreamento do pedido.
250
- - Removida a opção de simulador de frete na página do produto.
251
  - E mais outras várias alterações que podem ser verificadas pelo [GitHub](https://github.com/claudiosmweb/woocommerce-correios/compare/2.3.0...3.0.0).
4
  Tags: shipping, delivery, woocommerce, correios
5
  Requires at least: 4.0
6
  Tested up to: 4.6
7
+ Stable tag: 3.1.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
31
  - SEDEX Hoje
32
  - e-SEDEX (necessário conta administrativa nos Correios)
33
  - Carta Registrada
34
+ - Impresso Normal
35
+ - Impresso Urgente
36
  - Entrega internacional:
37
  - Mercadoria Expressa
38
  - Mercadoria Econômica
104
  - SEDEX Hoje
105
  - e-SEDEX (necessário conta administrativa nos Correios)
106
  - Carta Registrada
107
+ - Impresso Normal
108
+ - Impresso Urgente
109
 
110
  E os seguintes métodos de entrega internacionais:
111
 
203
 
204
  == Changelog ==
205
 
206
+ = 3.1.0 - 2016/09/13 =
207
+
208
+ - Adicionado os métodos Impresso Normal e Impresso Urgente (obrigado a [@jckronbauer](https://github.com/jckronbauer)).
209
+ - Adicionada opção para enviar novamente e-mail do código de rastreio.
210
+ - Adicionada mensagem de erro quando serviço é indisponível no trecho informado.
211
+
212
  = 3.0.6 - 2016/08/20 =
213
 
214
  - Introduzida a função `wc_correios_get_address_by_postcode()`.
249
 
250
  == Upgrade Notice ==
251
 
252
+ = 3.1.0 =
253
 
254
+ - Adicionado os métodos Impresso Normal e Impresso Urgente (obrigado a [@jckronbauer](https://github.com/jckronbauer)).
255
+ - Adicionada opção para enviar novamente e-mail do código de rastreio.
256
+ - Adicionada mensagem de erro quando serviço é indisponível no trecho informado.
 
 
 
 
257
  - E mais outras várias alterações que podem ser verificadas pelo [GitHub](https://github.com/claudiosmweb/woocommerce-correios/compare/2.3.0...3.0.0).
woocommerce-correios.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Correios para WooCommerce
6
  * Author: Claudio Sanches
7
  * Author URI: http://claudiosmweb.com/
8
- * Version: 3.0.6
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-correios
11
  * Domain Path: languages/
@@ -29,7 +29,7 @@ if ( ! class_exists( 'WC_Correios' ) ) :
29
  *
30
  * @var string
31
  */
32
- const VERSION = '3.0.6';
33
 
34
  /**
35
  * Instance of this class.
@@ -67,7 +67,7 @@ if ( ! class_exists( 'WC_Correios' ) ) :
67
  */
68
  public static function get_instance() {
69
  // If the single instance hasn't been set, set it now.
70
- if ( null == self::$instance ) {
71
  self::$instance = new self;
72
  }
73
 
@@ -100,7 +100,9 @@ if ( ! class_exists( 'WC_Correios' ) ) :
100
  // Shipping methods.
101
  if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.6.0', '>=' ) ) {
102
  include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping.php';
103
- include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-international-shipping.php';
 
 
104
  foreach ( glob( plugin_dir_path( __FILE__ ) . '/includes/shipping/*.php' ) as $filename ) {
105
  include_once $filename;
106
  }
@@ -156,6 +158,8 @@ if ( ! class_exists( 'WC_Correios' ) ) :
156
  $methods['correios-sedex-hoje'] = 'WC_Correios_Shipping_SEDEX_Hoje';
157
  $methods['correios-esedex'] = 'WC_Correios_Shipping_ESEDEX';
158
  $methods['correios-carta-registrada'] = 'WC_Correios_Shipping_Carta_Registrada';
 
 
159
  $methods['correios-mercadoria-expressa'] = 'WC_Correios_Shipping_Mercadoria_Expressa';
160
  $methods['correios-mercadoria-economica'] = 'WC_Correios_Shipping_Mercadoria_Economica';
161
  $methods['correios-leve-internacional'] = 'WC_Correios_Shipping_Leve_Internacional';
5
  * Description: Correios para WooCommerce
6
  * Author: Claudio Sanches
7
  * Author URI: http://claudiosmweb.com/
8
+ * Version: 3.1.0
9
  * License: GPLv2 or later
10
  * Text Domain: woocommerce-correios
11
  * Domain Path: languages/
29
  *
30
  * @var string
31
  */
32
+ const VERSION = '3.1.0';
33
 
34
  /**
35
  * Instance of this class.
67
  */
68
  public static function get_instance() {
69
  // If the single instance hasn't been set, set it now.
70
+ if ( null === self::$instance ) {
71
  self::$instance = new self;
72
  }
73
 
100
  // Shipping methods.
101
  if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.6.0', '>=' ) ) {
102
  include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping.php';
103
+ include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping-carta.php';
104
+ include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping-impresso.php';
105
+ include_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-correios-shipping-international.php';
106
  foreach ( glob( plugin_dir_path( __FILE__ ) . '/includes/shipping/*.php' ) as $filename ) {
107
  include_once $filename;
108
  }
158
  $methods['correios-sedex-hoje'] = 'WC_Correios_Shipping_SEDEX_Hoje';
159
  $methods['correios-esedex'] = 'WC_Correios_Shipping_ESEDEX';
160
  $methods['correios-carta-registrada'] = 'WC_Correios_Shipping_Carta_Registrada';
161
+ $methods['correios-impresso-normal'] = 'WC_Correios_Shipping_Impresso_Normal';
162
+ $methods['correios-impresso-urgente'] = 'WC_Correios_Shipping_Impresso_Urgente';
163
  $methods['correios-mercadoria-expressa'] = 'WC_Correios_Shipping_Mercadoria_Expressa';
164
  $methods['correios-mercadoria-economica'] = 'WC_Correios_Shipping_Mercadoria_Economica';
165
  $methods['correios-leve-internacional'] = 'WC_Correios_Shipping_Leve_Internacional';