| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class Mapping file. |
| 4 |
* |
| 5 |
* @package PostNLWooCommerce\Helper |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace PostNLWooCommerce\Helper; |
| 9 |
|
| 10 |
use PostNLWooCommerce\Helper\Product_Mapper\V1_Mapper; |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Class Mapping |
| 18 |
* |
| 19 |
* @package PostNLWooCommerce\Mapping |
| 20 |
*/ |
| 21 |
class Mapping { |
| 22 |
/** |
| 23 |
* Delivery type mapping. |
| 24 |
* |
| 25 |
* @return array. |
| 26 |
*/ |
| 27 |
public static function delivery_type() { |
| 28 |
return array( |
| 29 |
'NL' => array( |
| 30 |
'NL' => array( |
| 31 |
'delivery_day_type' => array( |
| 32 |
'08:00-12:00' => esc_html__( 'Morning Delivery', 'postnl-for-woocommerce' ), |
| 33 |
'Daytime' => esc_html__( 'Standard Shipment', 'postnl-for-woocommerce' ), |
| 34 |
'Evening' => esc_html__( 'Evening Delivery', 'postnl-for-woocommerce' ), |
| 35 |
), |
| 36 |
'dropoff_points_type' => array( |
| 37 |
'Pickup' => esc_html__( 'Pickup at PostNL Point', 'postnl-for-woocommerce' ), |
| 38 |
), |
| 39 |
), |
| 40 |
'BE' => array( |
| 41 |
'delivery_day_type' => array( |
| 42 |
'Daytime' => esc_html__( 'Standard Shipment Belgium', 'postnl-for-woocommerce' ), |
| 43 |
), |
| 44 |
'dropoff_points_type' => array( |
| 45 |
'Pickup' => esc_html__( 'Pickup at PostNL Point Belgium', 'postnl-for-woocommerce' ), |
| 46 |
), |
| 47 |
), |
| 48 |
'EU' => esc_html__( 'EU Parcel', 'postnl-for-woocommerce' ), |
| 49 |
'ROW' => esc_html__( 'Non-EU Shipment', 'postnl-for-woocommerce' ), |
| 50 |
), |
| 51 |
'BE' => array( |
| 52 |
'BE' => esc_html__( 'Belgium Domestic', 'postnl-for-woocommerce' ), |
| 53 |
'NL' => esc_html__( 'EU Parcel', 'postnl-for-woocommerce' ), |
| 54 |
'EU' => esc_html__( 'EU Parcel', 'postnl-for-woocommerce' ), |
| 55 |
'ROW' => esc_html__( 'Non-EU Shipment', 'postnl-for-woocommerce' ), |
| 56 |
), |
| 57 |
); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* Products code & required options mapping. |
| 62 |
* |
| 63 |
* @return array[]. |
| 64 |
*/ |
| 65 |
public static function products_data() { |
| 66 |
return V1_Mapper::products_data(); |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* Products code & options available for European and GlobalPack Shipments. |
| 71 |
* |
| 72 |
* @return array[]. |
| 73 |
*/ |
| 74 |
public static function EU_ROW_products() { |
| 75 |
return V1_Mapper::EU_ROW_products(); |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Products code & options available for European Shipments. |
| 80 |
* |
| 81 |
* @return array[]. |
| 82 |
*/ |
| 83 |
public static function european_shipment_products() { |
| 84 |
return V1_Mapper::european_shipment_products(); |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Products code & options available for GlobalPack Shipments. |
| 89 |
* |
| 90 |
* @return array[]. |
| 91 |
*/ |
| 92 |
public static function globalpack_products() { |
| 93 |
return V1_Mapper::globalpack_products(); |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* Label type mapping. |
| 98 |
* |
| 99 |
* @return array. |
| 100 |
*/ |
| 101 |
public static function label_type_list() { |
| 102 |
return array( |
| 103 |
'NL' => array( |
| 104 |
// Return label is added here since smart return is not implemented yet. |
| 105 |
// If smart return is implemented, we might need to remove return-label from this list. |
| 106 |
'NL' => array( 'label', 'return-label', 'buspakjeextra', 'printcodelabel' ), |
| 107 |
'BE' => array( 'label', 'return-label' ), |
| 108 |
'EU' => array( 'label' ), |
| 109 |
'ROW' => array( 'cn23', 'cp71', 'label', 'commercialinvoice' ), |
| 110 |
), |
| 111 |
'BE' => array( |
| 112 |
'BE' => array( 'label' ), |
| 113 |
'NL' => array( 'label' ), |
| 114 |
'EU' => array( 'label' ), |
| 115 |
'ROW' => array( 'cn23', 'cp71', 'label', 'commercialinvoice' ), |
| 116 |
), |
| 117 |
); |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* Product code mapping. |
| 122 |
* |
| 123 |
* @return array. |
| 124 |
*/ |
| 125 |
public static function option_available_list() { |
| 126 |
return array( |
| 127 |
'NL' => array( |
| 128 |
'NL' => array( 'create_return_label', 'num_labels' ), |
| 129 |
'BE' => array( 'create_return_label', 'num_labels' ), |
| 130 |
'EU' => array( 'num_labels' ), |
| 131 |
'ROW' => array( 'num_labels' ), |
| 132 |
), |
| 133 |
'BE' => array( |
| 134 |
'BE' => array( 'num_labels' ), |
| 135 |
'NL' => array( 'num_labels' ), |
| 136 |
'EU' => array( 'num_labels' ), |
| 137 |
'ROW' => array( 'num_labels' ), |
| 138 |
), |
| 139 |
); |
| 140 |
} |
| 141 |
|
| 142 |
/** |
| 143 |
* Additional Product options mapping. |
| 144 |
* |
| 145 |
* @return array. |
| 146 |
*/ |
| 147 |
public static function additional_product_options() { |
| 148 |
return V1_Mapper::additional_product_options(); |
| 149 |
} |
| 150 |
|
| 151 |
/** |
| 152 |
* List of countries that available for checkout feature. |
| 153 |
* |
| 154 |
* @return array. |
| 155 |
*/ |
| 156 |
public static function available_country_for_checkout_feature() { |
| 157 |
return array( |
| 158 |
'NL' => array( |
| 159 |
'NL' => array( 'pickup_points', 'delivery_day', 'evening_delivery', '08:00-12:00' ), |
| 160 |
'BE' => array( 'pickup_points', 'delivery_day' ), |
| 161 |
), |
| 162 |
'BE' => array( |
| 163 |
'BE' => array( 'pickup_points' ), |
| 164 |
'NL' => array( 'pickup_points' ), |
| 165 |
), |
| 166 |
); |
| 167 |
} |
| 168 |
|
| 169 |
/** |
| 170 |
* List of barcodes types used for specific products. |
| 171 |
* |
| 172 |
* @return array. |
| 173 |
*/ |
| 174 |
public static function products_custom_barcode_types() { |
| 175 |
return array( |
| 176 |
'UE' => array( |
| 177 |
array( 'mailboxpacket' ), |
| 178 |
array( 'packets' ), |
| 179 |
), |
| 180 |
'LA' => array( |
| 181 |
array( 'track_and_trace', 'mailboxpacket' ), |
| 182 |
array( 'track_and_trace', 'packets' ), |
| 183 |
array( 'track_and_trace', 'packets', 'insured_shipping' ), |
| 184 |
), |
| 185 |
); |
| 186 |
} |
| 187 |
|
| 188 |
/** |
| 189 |
* Shipment & Return labels options mapping. |
| 190 |
* |
| 191 |
* @return array[]. |
| 192 |
*/ |
| 193 |
public static function shipping_return_labels_options() { |
| 194 |
return V1_Mapper::shipping_return_labels_options(); |
| 195 |
} |
| 196 |
} |
| 197 |
|