Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add extra insurance options for be #212

Merged
merged 7 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"require": {
"php": ">=7.2.0",
"myparcelnl/pdk": "~1.34.0",
"myparcelnl/sdk": "~7.6.1"
"myparcelnl/sdk": "~7.7.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0"
Expand All @@ -27,4 +27,4 @@
"config": {
"prepend-autoloader": false
}
}
}
144 changes: 73 additions & 71 deletions src/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

class Constant
{
public const AGE_CHECK_CONFIGURATION_NAME = 'MYPARCELBE_AGE_CHECK';
public const API_KEY_CONFIGURATION_NAME = 'MYPARCELBE_API_KEY';
public const AGE_CHECK_CONFIGURATION_NAME = 'MYPARCELBE_AGE_CHECK';
public const API_KEY_CONFIGURATION_NAME = 'MYPARCELBE_API_KEY';
public const API_LOGGING_CONFIGURATION_NAME = 'MYPARCELBE_API_LOGGING';
/** @deprecated use CarrierBpost::NAME */
public const BPOST_CARRIER_NAME = CarrierBpost::NAME;
public const BPOST_CONFIGURATION_NAME = 'MYPARCELBE_BPOST';
public const CARRIER_CONFIGURATION_FIELDS = [
public const BPOST_CARRIER_NAME = CarrierBpost::NAME;
public const BPOST_CONFIGURATION_NAME = 'MYPARCELBE_BPOST';
public const CARRIER_CONFIGURATION_FIELDS = [
self::CARRIER_CONFIGURATION_FIELD_CARRIER_TYPE,
'dropOffDays',
self::CUTOFF_EXCEPTIONS,
Expand Down Expand Up @@ -51,8 +51,8 @@ class Constant
self::INSURANCE_CONFIGURATION_NAME,
self::INSURANCE_CONFIGURATION_FROM_PRICE,
self::INSURANCE_CONFIGURATION_MAX_AMOUNT,
self::INSURANCE_CONFIGURATION_MAX_AMOUNT_BE,
self::INSURANCE_CONFIGURATION_MAX_AMOUNT_EU,
self::INSURANCE_CONFIGURATION_BELGIUM,
self::ONLY_RECIPIENT_CONFIGURATION_NAME,
'return_' . self::PACKAGE_TYPE_CONFIGURATION_NAME,
'return_' . self::ONLY_RECIPIENT_CONFIGURATION_NAME,
Expand All @@ -63,16 +63,17 @@ class Constant
'return_' . self::INSURANCE_CONFIGURATION_NAME,
'return_' . self::INSURANCE_CONFIGURATION_FROM_PRICE,
'return_' . self::INSURANCE_CONFIGURATION_MAX_AMOUNT,
'return_' . self::INSURANCE_CONFIGURATION_MAX_AMOUNT_BE,
'return_' . self::INSURANCE_CONFIGURATION_MAX_AMOUNT_EU,
'return_label_description',
];
public const CARRIER_CONFIGURATION_FIELD_CARRIER_TYPE = 'carrierType';
public const CARRIER_CONFIGURATION_MAP = [
public const CARRIER_CONFIGURATION_FIELD_CARRIER_TYPE = 'carrierType';
public const CARRIER_CONFIGURATION_MAP = [
CarrierPostNL::class => Constant::POSTNL_CONFIGURATION_NAME,
CarrierBpost::class => Constant::BPOST_CONFIGURATION_NAME,
CarrierDPD::class => Constant::DPD_CONFIGURATION_NAME,
];
public const CARRIER_EXCLUSIVE = [
public const CARRIER_EXCLUSIVE = [
'POSTNL' => [
'ALLOW_STANDARD_FORM' => ['BE' => true, 'NL' => true],
'dropOffDays' => ['BE' => true, 'NL' => true],
Expand Down Expand Up @@ -208,51 +209,52 @@ class Constant
'return_' . self::RETURN_PACKAGE_CONFIGURATION_NAME => ['BE' => false, 'NL' => false],
],
];
public const CONCEPT_FIRST = 'MYPARCELBE_CONCEPT_FIRST';
public const CONSIGNMENT_INIT_PARAMS_FOR_CHECKING_ONLY = [self::LABEL_CHECK_ONLY => true];
public const CUSTOMS_CODE_CONFIGURATION_NAME = 'MYPARCELBE_CUSTOMS_CODE';
public const CUSTOMS_FORM_CONFIGURATION_NAME = 'MYPARCELBE_CUSTOMS_FORM';
public const CUSTOMS_FORM_CONFIGURATION_OPTION_ADD = 'Add';
public const CUSTOMS_FORM_CONFIGURATION_OPTION_SKIP = 'Skip';
public const CUSTOMS_ORIGIN_CONFIGURATION_NAME = 'MYPARCELBE_CUSTOMS_ORIGIN';
public const CUTOFF_EXCEPTIONS = 'cutoff_exceptions';
public const DEFAULT_CUSTOMS_CODE_CONFIGURATION_NAME = 'MYPARCELBE_DEFAULT_CUSTOMS_CODE';
public const DEFAULT_CUSTOMS_ORIGIN_CONFIGURATION_NAME = 'MYPARCELBE_DEFAULT_CUSTOMS_ORIGIN';
public const DEFAULT_CUTOFF_TIME = '17:00';
public const DEFAULT_INSURANCE_POSSIBILITIES = [self::INSURANCE_CONFIGURATION_NONE];
public const DELIVERED_ORDER_STATUS_CONFIGURATION_NAME = 'MYPARCELBE_DELIVERED_ORDER_STATUS';
public const CONCEPT_FIRST = 'MYPARCELBE_CONCEPT_FIRST';
public const CONSIGNMENT_INIT_PARAMS_FOR_CHECKING_ONLY = [self::LABEL_CHECK_ONLY => true];
public const CUSTOMS_CODE_CONFIGURATION_NAME = 'MYPARCELBE_CUSTOMS_CODE';
public const CUSTOMS_FORM_CONFIGURATION_NAME = 'MYPARCELBE_CUSTOMS_FORM';
public const CUSTOMS_FORM_CONFIGURATION_OPTION_ADD = 'Add';
public const CUSTOMS_FORM_CONFIGURATION_OPTION_SKIP = 'Skip';
public const CUSTOMS_ORIGIN_CONFIGURATION_NAME = 'MYPARCELBE_CUSTOMS_ORIGIN';
public const CUTOFF_EXCEPTIONS = 'cutoff_exceptions';
public const DEFAULT_CUSTOMS_CODE_CONFIGURATION_NAME = 'MYPARCELBE_DEFAULT_CUSTOMS_CODE';
public const DEFAULT_CUSTOMS_ORIGIN_CONFIGURATION_NAME = 'MYPARCELBE_DEFAULT_CUSTOMS_ORIGIN';
public const DEFAULT_CUTOFF_TIME = '17:00';
public const DEFAULT_INSURANCE_POSSIBILITIES = [self::INSURANCE_CONFIGURATION_NONE];
public const DELIVERED_ORDER_STATUS_CONFIGURATION_NAME = 'MYPARCELBE_DELIVERED_ORDER_STATUS';
public const DELIVERY_OPTIONS_PRICE_FORMAT_CONFIGURATION_NAME = 'MYPARCELBE_DELIVERY_OPTIONS_PRICE_FORMAT';
public const DELIVERY_OPTIONS_PRICE_FORMAT_SURCHARGE = 'surcharge';
public const DELIVERY_OPTIONS_PRICE_FORMAT_TOTAL_PRICE = 'total_price';
public const DELIVERY_OPTIONS_PRICE_FORMAT_SURCHARGE = 'surcharge';
public const DELIVERY_OPTIONS_PRICE_FORMAT_TOTAL_PRICE = 'total_price';
/** @deprecated use CarrierDPD::NAME */
public const DPD_CARRIER_NAME = CarrierDPD::NAME;
public const DPD_CONFIGURATION_NAME = 'MYPARCELBE_DPD';
public const EXCLUSIVE_FIELDS_NL = [
public const DPD_CARRIER_NAME = CarrierDPD::NAME;
public const DPD_CONFIGURATION_NAME = 'MYPARCELBE_DPD';
public const EXCLUSIVE_FIELDS_NL = [
self::SENT_ORDER_STATE_FOR_DIGITAL_STAMPS_CONFIGURATION_NAME,
self::SHARE_CUSTOMER_EMAIL_CONFIGURATION_NAME,
];
public const IGNORE_ORDER_STATUS_CONFIGURATION_NAME = 'MYPARCELBE_IGNORE_ORDER_STATUS';
public const INSURANCE_CONFIGURATION_BELGIUM = 'MYPARCELBE_INSURANCE_BELGIUM';
public const INSURANCE_CONFIGURATION_BELGIUM = 'MYPARCELBE_INSURANCE_BELGIUM';
public const INSURANCE_CONFIGURATION_BELGIUM_AMOUNT = 500;
public const INSURANCE_CONFIGURATION_FROM_PRICE = 'MYPARCELBE_INSURANCE_FROM_PRICE';
public const INSURANCE_CONFIGURATION_MAX_AMOUNT = 'MYPARCELBE_INSURANCE_MAX_AMOUNT';
public const INSURANCE_CONFIGURATION_MAX_AMOUNT_EU = 'MYPARCELBE_INSURANCE_MAX_AMOUNT_EU'; // Kg
public const INSURANCE_CONFIGURATION_NAME = 'MYPARCELBE_INSURANCE';
public const INSURANCE_CONFIGURATION_NONE = 0;
public const INSURANCE_CONFIGURATION_FROM_PRICE = 'MYPARCELBE_INSURANCE_FROM_PRICE';
public const INSURANCE_CONFIGURATION_MAX_AMOUNT = 'MYPARCELBE_INSURANCE_MAX_AMOUNT';
public const INSURANCE_CONFIGURATION_MAX_AMOUNT_BE = 'MYPARCELBE_INSURANCE_MAX_AMOUNT_BE';
public const INSURANCE_CONFIGURATION_MAX_AMOUNT_EU = 'MYPARCELBE_INSURANCE_MAX_AMOUNT_EU'; // Kg
public const INSURANCE_CONFIGURATION_NAME = 'MYPARCELBE_INSURANCE';
public const INSURANCE_CONFIGURATION_NONE = 0;
/**
* Maximum characters length of item description.
*/
public const ITEM_DESCRIPTION_MAX_LENGTH = 50;
public const LABEL_CHECK_ONLY = 'labelCheckOnly';
public const ITEM_DESCRIPTION_MAX_LENGTH = 50;
public const LABEL_CHECK_ONLY = 'labelCheckOnly';
public const LABEL_CREATED_ORDER_STATUS_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_CREATED_ORDER_STATUS';
public const LABEL_DESCRIPTION_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_DESCRIPTION';
public const LABEL_OPEN_DOWNLOAD_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_OPEN_DOWNLOAD';
public const LABEL_POSITION_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_POSITION';
public const LABEL_PROMPT_POSITION_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_PROMPT_POSITION';
public const LABEL_DESCRIPTION_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_DESCRIPTION';
public const LABEL_OPEN_DOWNLOAD_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_OPEN_DOWNLOAD';
public const LABEL_POSITION_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_POSITION';
public const LABEL_PROMPT_POSITION_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_PROMPT_POSITION';
public const LABEL_SCANNED_ORDER_STATUS_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_SCANNED_ORDER_STATUS';
public const LABEL_SIZE_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_SIZE';
public const MAIL_FALLBACK_LANGUAGE = 'en';
public const NL_DAYS = [
public const LABEL_SIZE_CONFIGURATION_NAME = 'MYPARCELBE_LABEL_SIZE';
public const MAIL_FALLBACK_LANGUAGE = 'en';
public const NL_DAYS = [
1 => 'maandag',
2 => 'dinsdag',
3 => 'woensdag',
Expand All @@ -261,7 +263,7 @@ class Constant
6 => 'zaterdag',
0 => 'zondag',
];
public const NL_MONTHS = [
public const NL_MONTHS = [
1 => 'januari',
2 => 'februari',
3 => 'maart',
Expand All @@ -275,32 +277,32 @@ class Constant
11 => 'november',
12 => 'december',
];
public const ONLY_RECIPIENT_CONFIGURATION_NAME = 'MYPARCELBE_RECIPIENT_ONLY';
public const ORDER_DESCRIPTION_MAX_LENGTH = 45;
public const ORDER_NOTIFICATION_AFTER_CONFIGURATION_NAME = 'MYPARCELBE_ORDER_NOTIFICATION_AFTER';
public const PACKAGE_FORMAT_AUTOMATIC = 3;
public const PACKAGE_FORMAT_CONFIGURATION_NAME = 'MYPARCELBE_PACKAGE_FORMAT';
public const ONLY_RECIPIENT_CONFIGURATION_NAME = 'MYPARCELBE_RECIPIENT_ONLY';
public const ORDER_DESCRIPTION_MAX_LENGTH = 45;
public const ORDER_NOTIFICATION_AFTER_CONFIGURATION_NAME = 'MYPARCELBE_ORDER_NOTIFICATION_AFTER';
public const PACKAGE_FORMAT_AUTOMATIC = 3;
public const PACKAGE_FORMAT_CONFIGURATION_NAME = 'MYPARCELBE_PACKAGE_FORMAT';
// Field used in <platform>_carrier_configuration to link myparcel carrier to prestashop carrier.

public const PACKAGE_FORMAT_LARGE = 2;
public const PACKAGE_FORMAT_LARGE_INDEX = 2;
public const PACKAGE_FORMAT_NORMAL = 1;
public const PACKAGE_TYPES = [
public const PACKAGE_FORMAT_LARGE = 2;
public const PACKAGE_FORMAT_LARGE_INDEX = 2;
public const PACKAGE_FORMAT_NORMAL = 1;
public const PACKAGE_TYPES = [
AbstractConsignment::PACKAGE_TYPE_PACKAGE => AbstractConsignment::PACKAGE_TYPE_PACKAGE_NAME,
AbstractConsignment::PACKAGE_TYPE_MAILBOX => AbstractConsignment::PACKAGE_TYPE_MAILBOX_NAME,
AbstractConsignment::PACKAGE_TYPE_LETTER => AbstractConsignment::PACKAGE_TYPE_LETTER_NAME,
AbstractConsignment::PACKAGE_TYPE_DIGITAL_STAMP => AbstractConsignment::PACKAGE_TYPE_DIGITAL_STAMP_NAME,
];
public const PACKAGE_TYPE_CONFIGURATION_NAME = 'MYPARCELBE_PACKAGE_TYPE';
public const PACKAGE_TYPE_DIGITAL_STAMP = AbstractConsignment::PACKAGE_TYPE_DIGITAL_STAMP;
public const PACKAGE_TYPE_LETTER = AbstractConsignment::PACKAGE_TYPE_LETTER;
public const PACKAGE_TYPE_MAILBOX = AbstractConsignment::PACKAGE_TYPE_MAILBOX;
public const PACKAGE_TYPE_PACKAGE = AbstractConsignment::PACKAGE_TYPE_PACKAGE;
public const PACKAGE_TYPE_WEIGHT_LIMIT = 2;
public const PACKAGE_TYPE_DIGITAL_STAMP = AbstractConsignment::PACKAGE_TYPE_DIGITAL_STAMP;
public const PACKAGE_TYPE_LETTER = AbstractConsignment::PACKAGE_TYPE_LETTER;
public const PACKAGE_TYPE_MAILBOX = AbstractConsignment::PACKAGE_TYPE_MAILBOX;
public const PACKAGE_TYPE_PACKAGE = AbstractConsignment::PACKAGE_TYPE_PACKAGE;
public const PACKAGE_TYPE_WEIGHT_LIMIT = 2;
/** @deprecated use CarrierPostNL::NAME */
public const POSTNL_CARRIER_NAME = CarrierPostNL::NAME;
public const POSTNL_CONFIGURATION_NAME = 'MYPARCELBE_POSTNL';
public const REQUIRED_LABEL_KEYS = [
public const POSTNL_CARRIER_NAME = CarrierPostNL::NAME;
public const POSTNL_CONFIGURATION_NAME = 'MYPARCELBE_POSTNL';
public const REQUIRED_LABEL_KEYS = [
'person',
'iso_code',
'full_street',
Expand All @@ -312,12 +314,12 @@ class Constant
'id_country',
'reference',
];
public const RETURN_PACKAGE_CONFIGURATION_NAME = 'MYPARCELBE_RETURN_PACKAGE';
public const RETURN_PACKAGE_CONFIGURATION_NAME = 'MYPARCELBE_RETURN_PACKAGE';
public const SENT_ORDER_STATE_FOR_DIGITAL_STAMPS_CONFIGURATION_NAME = 'MYPARCELBE_SENT_ORDER_STATE_FOR_DIGITAL_STAMPS';
public const SHARE_CUSTOMER_EMAIL_CONFIGURATION_NAME = 'MYPARCELBE_SHARE_CUSTOMER_EMAIL';
public const SHARE_CUSTOMER_PHONE_CONFIGURATION_NAME = 'MYPARCELBE_SHARE_CUSTOMER_PHONE';
public const SIGNATURE_REQUIRED_CONFIGURATION_NAME = 'MYPARCELBE_SIGNATURE_REQUIRED';
public const SINGLE_LABEL_CREATION_OPTIONS = [
public const SHARE_CUSTOMER_EMAIL_CONFIGURATION_NAME = 'MYPARCELBE_SHARE_CUSTOMER_EMAIL';
public const SHARE_CUSTOMER_PHONE_CONFIGURATION_NAME = 'MYPARCELBE_SHARE_CUSTOMER_PHONE';
public const SIGNATURE_REQUIRED_CONFIGURATION_NAME = 'MYPARCELBE_SIGNATURE_REQUIRED';
public const SINGLE_LABEL_CREATION_OPTIONS = [
'packageType' => self::PACKAGE_TYPE_CONFIGURATION_NAME,
'packageFormat' => self::PACKAGE_FORMAT_CONFIGURATION_NAME,
'onlyRecipient' => self::ONLY_RECIPIENT_CONFIGURATION_NAME,
Expand All @@ -326,7 +328,7 @@ class Constant
'signatureRequired' => self::SIGNATURE_REQUIRED_CONFIGURATION_NAME,
'insurance' => self::INSURANCE_CONFIGURATION_NAME,
];
public const SINGLE_LABEL_RETURN_OPTIONS = [
public const SINGLE_LABEL_RETURN_OPTIONS = [
'packageType' => 'return_' . self::PACKAGE_TYPE_CONFIGURATION_NAME,
'packageFormat' => 'return_' . self::PACKAGE_FORMAT_CONFIGURATION_NAME,
'onlyRecipient' => 'return_' . self::ONLY_RECIPIENT_CONFIGURATION_NAME,
Expand All @@ -336,11 +338,11 @@ class Constant
'insurance' => 'return_' . self::INSURANCE_CONFIGURATION_NAME,
'labelDescription' => 'return_label_description',
];
public const STATUS_CHANGE_MAIL_CONFIGURATION_NAME = 'MYPARCELBE_STATUS_CHANGE_MAIL';
public const USE_ADDRESS2_AS_STREET_NUMBER_CONFIGURATION_NAME = 'MYPARCELBE_USE_ADDRESS2_AS_STREET_NUMBER';
public const WEBHOOK_HASH_CONFIGURATION_NAME = 'MYPARCELBE_WEBHOOK_HASH';
public const WEBHOOK_ID_CONFIGURATION_NAME = 'MYPARCELBE_WEBHOOK_ID';
public const WEEK_DAYS = [
public const STATUS_CHANGE_MAIL_CONFIGURATION_NAME = 'MYPARCELBE_STATUS_CHANGE_MAIL';
public const USE_ADDRESS2_AS_STREET_NUMBER_CONFIGURATION_NAME = 'MYPARCELBE_USE_ADDRESS2_AS_STREET_NUMBER';
public const WEBHOOK_HASH_CONFIGURATION_NAME = 'MYPARCELBE_WEBHOOK_HASH';
public const WEBHOOK_ID_CONFIGURATION_NAME = 'MYPARCELBE_WEBHOOK_ID';
public const WEEK_DAYS = [
1 => 'monday',
2 => 'tuesday',
3 => 'wednesday',
Expand Down
Loading