PluginProbe
PostNL for WooCommerce / trunk
PostNL for WooCommerce vtrunk
5.9.12 5.9.11 5.9.10 5.9.9 5.9.8 5.9.7 5.9.6 trunk 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.1.4 3.1.5 3.1.6 3.1.7 4.0.0 4.0.1 4.0.2 4.3.2 4.3.3 4.4.0 4.4.1 All 72 releases
woo-postnl / src / Helper / Product_Mapper / V1_Mapper.php

V1_Mapper.php in PostNL for WooCommerce trunk, at src/Helper/Product_Mapper/V1_Mapper.php

707 lines 17.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class V1_Mapper file.
4 *
5 * @package PostNLWooCommerce\Helper\Product_Mapper
6 */
7
8 namespace PostNLWooCommerce\Helper\Product_Mapper;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit;
12 }
13
14 /**
15 * Pure data class: the V1 combination → product-code mapping.
16 */
17 class V1_Mapper {
18
19 /**
20 * Products code & required options mapping.
21 *
22 * @return array[]
23 */
24 public static function products_data(): array {
25 return array(
26 'NL' => array(
27 'NL' => array(
28 'delivery_day' => array(
29 array(
30 'combination' => array(),
31 'code' => '3085',
32 'options' => array(),
33 ),
34 array(
35 'combination' => array( 'delivery_code_at_door', 'insured_shipping' ),
36 'code' => '3085',
37 'options' => array(
38 array(
39 'characteristic' => '004',
40 'option' => '020',
41 ),
42 ),
43 ),
44 array(
45 'combination' => array( 'only_home_address' ),
46 'code' => '3385',
47 'options' => array(),
48 ),
49 array(
50 'combination' => array( 'return_no_answer' ),
51 'code' => '3090',
52 'options' => array(),
53 ),
54 array(
55 'combination' => array( 'signature_on_delivery' ),
56 'code' => '3189',
57 'options' => array(),
58 ),
59 array(
60 'combination' => array( 'return_no_answer', 'only_home_address' ),
61 'code' => '3390',
62 'options' => array(),
63 ),
64 array(
65 'combination' => array( 'signature_on_delivery', 'insured_shipping', 'return_no_answer' ),
66 'code' => '3094',
67 'options' => array(),
68 ),
69 array(
70 'combination' => array( 'signature_on_delivery', 'only_home_address' ),
71 'code' => '3089',
72 'options' => array(),
73 ),
74 array(
75 'combination' => array( 'insured_shipping', 'signature_on_delivery' ),
76 'code' => '3087',
77 'options' => array(),
78 ),
79 array(
80 'combination' => array( 'signature_on_delivery', 'return_no_answer' ),
81 'code' => '3389',
82 'options' => array(),
83 ),
84 array(
85 'combination' => array( 'signature_on_delivery', 'only_home_address', 'return_no_answer' ),
86 'code' => '3096',
87 'options' => array(),
88 ),
89 array(
90 'combination' => array( 'letterbox' ),
91 'code' => '2928',
92 'options' => array(),
93 ),
94 array(
95 'combination' => array( 'letterbox_48' ),
96 'code' => '2948',
97 'options' => array(),
98 ),
99 array(
100 'combination' => array( 'id_check' ),
101 'code' => '3438',
102 'options' => array(
103 array(
104 'characteristic' => '002',
105 'option' => '014',
106 ),
107 ),
108 ),
109 array(
110 'combination' => array( 'id_check', 'signature_on_delivery' ),
111 'code' => '3438',
112 'options' => array(
113 array(
114 'characteristic' => '002',
115 'option' => '014',
116 ),
117 ),
118 ),
119 array(
120 'combination' => array( 'id_check', 'only_home_address' ),
121 'code' => '3438',
122 'options' => array(
123 array(
124 'characteristic' => '002',
125 'option' => '014',
126 ),
127 ),
128 ),
129 array(
130 'combination' => array( 'id_check', 'only_home_address', 'signature_on_delivery' ),
131 'code' => '3438',
132 'options' => array(
133 array(
134 'characteristic' => '002',
135 'option' => '014',
136 ),
137 ),
138 ),
139 array(
140 'combination' => array( 'id_check', 'insured_shipping' ),
141 'code' => '3443',
142 'options' => array(
143 array(
144 'characteristic' => '002',
145 'option' => '014',
146 ),
147 ),
148 ),
149 array(
150 'combination' => array( 'id_check', 'insured_shipping', 'signature_on_delivery' ),
151 'code' => '3443',
152 'options' => array(
153 array(
154 'characteristic' => '002',
155 'option' => '014',
156 ),
157 ),
158 ),
159 array(
160 'combination' => array( 'id_check', 'insured_shipping', 'only_home_address' ),
161 'code' => '3443',
162 'options' => array(
163 array(
164 'characteristic' => '002',
165 'option' => '014',
166 ),
167 ),
168 ),
169 array(
170 'combination' => array( 'id_check', 'insured_shipping', 'only_home_address', 'signature_on_delivery' ),
171 'code' => '3443',
172 'options' => array(
173 array(
174 'characteristic' => '002',
175 'option' => '014',
176 ),
177 ),
178 ),
179 ),
180 'pickup_points' => array(
181 array(
182 'combination' => array(),
183 'code' => '3533',
184 'options' => array(),
185 ),
186 array(
187 'combination' => array( 'insured_shipping' ),
188 'code' => '3534',
189 'options' => array(),
190 ),
191 array(
192 'combination' => array( 'id_check' ),
193 'code' => '3571',
194 'options' => array(
195 array(
196 'characteristic' => '002',
197 'option' => '014',
198 ),
199 ),
200 ),
201 array(
202 'combination' => array( 'id_check', 'insured_shipping' ),
203 'code' => '3581',
204 'options' => array(
205 array(
206 'characteristic' => '002',
207 'option' => '014',
208 ),
209 ),
210 ),
211 ),
212 ),
213 'BE' => array(
214 'delivery_day' => array(
215 array(
216 'combination' => array(),
217 'code' => '4946',
218 'options' => array(),
219 ),
220 array(
221 'combination' => array( 'only_home_address' ),
222 'code' => '4941',
223 'options' => array(),
224 ),
225 array(
226 'combination' => array( 'signature_on_delivery' ),
227 'code' => '4912',
228 'options' => array(),
229 ),
230 array(
231 'combination' => array( 'insured_shipping' ),
232 'code' => '4914',
233 'options' => array(),
234 ),
235 array(
236 'combination' => array( 'insured_shipping', 'track_and_trace' ),
237 'code' => '4914',
238 'options' => array(),
239 ),
240 array(
241 'combination' => array( 'insured_shipping', 'signature_on_delivery' ),
242 'code' => '4914',
243 'options' => array(),
244 ),
245 array(
246 'combination' => array( 'insured_shipping', 'only_home_address' ),
247 'code' => '4914',
248 'options' => array(),
249 ),
250 array(
251 'combination' => array( 'insured_shipping', 'signature_on_delivery', 'only_home_address' ),
252 'code' => '4914',
253 'options' => array(),
254 ),
255 array(
256 'combination' => array( 'insured_shipping', 'track_and_trace', 'signature_on_delivery' ),
257 'code' => '4914',
258 'options' => array(),
259 ),
260 array(
261 'combination' => array( 'insured_shipping', 'track_and_trace', 'only_home_address' ),
262 'code' => '4914',
263 'options' => array(),
264 ),
265 array(
266 'combination' => array( 'insured_shipping', 'track_and_trace', 'signature_on_delivery', 'only_home_address' ),
267 'code' => '4914',
268 'options' => array(),
269 ),
270 array(
271 'combination' => array( 'mailboxpacket' ),
272 'code' => '6440',
273 'options' => array(),
274 ),
275 array(
276 'combination' => array( 'mailboxpacket', 'track_and_trace' ),
277 'code' => '6972',
278 'options' => array(),
279 ),
280 array(
281 'combination' => array( 'packets' ),
282 'code' => '6405',
283 'options' => array(),
284 ),
285 array(
286 'combination' => array( 'packets', 'track_and_trace' ),
287 'code' => '6350',
288 'options' => array(),
289 ),
290 array(
291 'combination' => array( 'packets', 'track_and_trace', 'insured_shipping' ),
292 'code' => '6906',
293 'options' => array(),
294 ),
295 ),
296 'pickup_points' => array(
297 array(
298 'combination' => array(),
299 'code' => '4936',
300 'options' => array(),
301 ),
302 ),
303 ),
304 'EU' => array(
305 'delivery_day' => self::european_shipment_products(),
306 'pickup_points' => array(
307 array(
308 'combination' => array(),
309 'code' => '4907',
310 'options' => array(
311 array(
312 'characteristic' => '005',
313 'option' => '025',
314 ),
315 array(
316 'characteristic' => '101',
317 'option' => '012',
318 ),
319 ),
320 ),
321 ),
322 ),
323 'ROW' => array(
324 'delivery_day' => array_merge( self::globalpack_products(), self::EU_ROW_products() ),
325 'pickup_points' => array(
326 array(
327 'combination' => array(),
328 'code' => '4909',
329 'options' => array(
330 array(
331 'characteristic' => '005',
332 'option' => '025',
333 ),
334 ),
335 ),
336 ),
337 ),
338 ),
339 'BE' => array(
340 'BE' => array(
341 'delivery_day' => array(
342 array(
343 'combination' => array(),
344 'code' => '4961',
345 'options' => array(),
346 ),
347 array(
348 'combination' => array( 'only_home_address' ),
349 'code' => '4960',
350 'options' => array(),
351 ),
352 array(
353 'combination' => array( 'signature_on_delivery' ),
354 'code' => '4963',
355 'options' => array(),
356 ),
357 array(
358 'combination' => array( 'signature_on_delivery', 'only_home_address' ),
359 'code' => '4962',
360 'options' => array(),
361 ),
362 array(
363 'combination' => array( 'insured_shipping', 'only_home_address' ),
364 'code' => '4965',
365 'options' => array(),
366 ),
367 ),
368 'pickup_points' => array(
369 array(
370 'combination' => array(),
371 'code' => '4880',
372 'options' => array(),
373 ),
374 array(
375 'combination' => array( 'insured_shipping' ),
376 'code' => '4878',
377 'options' => array(),
378 ),
379 ),
380 ),
381 'NL' => array(
382 'delivery_day' => array(
383 array(
384 'combination' => array(),
385 'code' => '4890',
386 'options' => array(),
387 ),
388 array(
389 'combination' => array( 'signature_on_delivery' ),
390 'code' => '4891',
391 'options' => array(),
392 ),
393 array(
394 'combination' => array( 'only_home_address' ),
395 'code' => '4893',
396 'options' => array(),
397 ),
398 array(
399 'combination' => array( 'signature_on_delivery', 'only_home_address' ),
400 'code' => '4894',
401 'options' => array(),
402 ),
403 array(
404 'combination' => array( 'id_check', 'signature_on_delivery', 'only_home_address' ),
405 'code' => '4895',
406 'options' => array(
407 array(
408 'characteristic' => '002',
409 'option' => '014',
410 ),
411 ),
412 ),
413 array(
414 'combination' => array( 'signature_on_delivery', 'only_home_address', 'return_no_answer' ),
415 'code' => '4896',
416 'options' => array(),
417 ),
418 array(
419 'combination' => array( 'signature_on_delivery', 'only_home_address', 'insured_shipping' ),
420 'code' => '4897',
421 'options' => array(),
422 ),
423 ),
424 'pickup_points' => array(
425 array(
426 'combination' => array( 'signature_on_delivery' ),
427 'code' => '4898',
428 'options' => array(),
429 ),
430 array(
431 'combination' => array(),
432 'code' => '4898',
433 'options' => array(),
434 ),
435 ),
436 ),
437 'EU' => array(
438 'delivery_day' => self::european_shipment_products(),
439 ),
440 'ROW' => array(
441 'delivery_day' => self::globalpack_products(),
442 ),
443 ),
444 );
445 }
446
447 /**
448 * Products code & options available for European Shipments.
449 *
450 * @return array[]
451 */
452 public static function european_shipment_products(): array {
453 return array_merge(
454 array(
455 array(
456 'combination' => array(),
457 'code' => '4907',
458 'options' => array(
459 array(
460 'characteristic' => '005',
461 'option' => '025',
462 ),
463 array(
464 'characteristic' => '101',
465 'option' => '012',
466 ),
467 ),
468 ),
469 array(
470 'combination' => array( 'track_and_trace' ),
471 'code' => '4907',
472 'options' => array(
473 array(
474 'characteristic' => '005',
475 'option' => '025',
476 ),
477 array(
478 'characteristic' => '101',
479 'option' => '012',
480 ),
481 ),
482 ),
483 array(
484 'combination' => array( 'track_and_trace', 'insured_shipping' ),
485 'code' => '4907',
486 'options' => array(
487 array(
488 'characteristic' => '004',
489 'option' => '015',
490 ),
491 array(
492 'characteristic' => '101',
493 'option' => '012',
494 ),
495 ),
496 ),
497 array(
498 'combination' => array( 'track_and_trace', 'insured_plus' ),
499 'code' => '4907',
500 'options' => array(
501 array(
502 'characteristic' => '004',
503 'option' => '016',
504 ),
505 array(
506 'characteristic' => '101',
507 'option' => '012',
508 ),
509 ),
510 ),
511 ),
512 self::EU_ROW_products()
513 );
514 }
515
516 /**
517 * Products code & options available for GlobalPack Shipments.
518 *
519 * @return array[]
520 */
521 public static function globalpack_products(): array {
522 return array(
523 array(
524 'combination' => array(),
525 'code' => '4909',
526 'options' => array(
527 array(
528 'characteristic' => '004',
529 'option' => '015',
530 ),
531 ),
532 ),
533 array(
534 'combination' => array( 'track_and_trace' ),
535 'code' => '4909',
536 'options' => array(
537 array(
538 'characteristic' => '005',
539 'option' => '025',
540 ),
541 ),
542 ),
543 array(
544 'combination' => array( 'track_and_trace', 'insured_plus' ),
545 'code' => '4909',
546 'options' => array(
547 array(
548 'characteristic' => '004',
549 'option' => '016',
550 ),
551 ),
552 ),
553 );
554 }
555
556 /**
557 * Products code & options available for European and GlobalPack Shipments.
558 *
559 * @return array[]
560 */
561 public static function EU_ROW_products(): array {
562 return array(
563 array(
564 'combination' => array( 'mailboxpacket' ),
565 'code' => '6440',
566 'options' => array(),
567 ),
568 array(
569 'combination' => array( 'track_and_trace', 'mailboxpacket' ),
570 'code' => '6972',
571 'options' => array(),
572 ),
573 array(
574 'combination' => array( 'packets' ),
575 'code' => '6405',
576 'options' => array(),
577 ),
578 array(
579 'combination' => array( 'track_and_trace', 'packets' ),
580 'code' => '6350',
581 'options' => array(),
582 ),
583 array(
584 'combination' => array( 'track_and_trace', 'packets', 'insured_shipping' ),
585 'code' => '6906',
586 'options' => array(),
587 ),
588 );
589 }
590
591 /**
592 * Shipment & Return labels options mapping.
593 *
594 * @return array[]
595 */
596 public static function shipping_return_labels_options(): array {
597 return array(
598 'NL' => array(
599 'NL' => array(
600 'in_box' => array(
601 'products' => array(), // Empty mean it can be combined with all products.
602 'options' => array(
603 array(
604 'characteristic' => '152',
605 'option' => '028',
606 ),
607 ),
608 ),
609 'shipping_return' => array(
610 'products' => array(
611 '3085',
612 '3438',
613 '3090',
614 '3189',
615 '3385',
616 '3087',
617 '3389',
618 '3094',
619 '3390',
620 '3096',
621 '3089',
622 '3533',
623 '3534',
624 '3443',
625 '3571',
626 ),
627 'options' => array(
628 array(
629 'characteristic' => '152',
630 'option' => '026',
631 ),
632 ),
633 ),
634 'return_all_labels_not_active' => array(
635 'products' => array(
636 '3085',
637 '3438',
638 '3090',
639 '3189',
640 '3385',
641 '3087',
642 '3389',
643 '3094',
644 '3390',
645 '3096',
646 '3089',
647 '3533',
648 '3534',
649 '3443',
650 '3571',
651 ),
652 'options' => array(
653 array(
654 'characteristic' => '152',
655 'option' => '026',
656 ),
657 array(
658 'characteristic' => '191',
659 'option' => '004',
660 ),
661 ),
662 ),
663 ),
664 'BE' => array(
665 'in_box' => array(
666 'products' => array( '4946', '4941', '4912', '4914', '4936' ),
667 'options' => array(
668 array(
669 'characteristic' => '152',
670 'option' => '028',
671 ),
672 ),
673 ),
674 ),
675 ),
676 );
677 }
678
679 /**
680 * Additional Product options mapping.
681 *
682 * @return array
683 */
684 public static function additional_product_options(): array {
685 return array(
686 'NL' => array(
687 'NL' => array(
688 'frontend_data' => array(
689 'delivery_day' => array(
690 'type' => array(
691 'Evening' => array(
692 'characteristic' => '118',
693 'option' => '006',
694 ),
695 '08:00-12:00' => array(
696 'characteristic' => '118',
697 'option' => '008',
698 ),
699 ),
700 ),
701 ),
702 ),
703 ),
704 );
705 }
706 }
707