| 1 |
<?php |
| 2 |
|
| 3 |
declare( strict_types=1 ); |
| 4 |
|
| 5 |
namespace Tests\Module; |
| 6 |
|
| 7 |
use Packetery\Module\Carrier\Options; |
| 8 |
|
| 9 |
class CarrierOptionsDummyFactory { |
| 10 |
private static function getDefaultOptionsArray(): array { |
| 11 |
return [ |
| 12 |
'id' => '106', |
| 13 |
'free_shipping_limit' => 10000.0, |
| 14 |
'pricing_type' => Options::PRICING_TYPE_BY_WEIGHT, |
| 15 |
'weight_limits' => [ |
| 16 |
[ |
| 17 |
'weight' => 10, |
| 18 |
'price' => 11, |
| 19 |
], |
| 20 |
[ |
| 21 |
'weight' => 20, |
| 22 |
'price' => 22, |
| 23 |
], |
| 24 |
[ |
| 25 |
'weight' => 30, |
| 26 |
'price' => 33, |
| 27 |
], |
| 28 |
], |
| 29 |
'product_value_limits' => [ |
| 30 |
[ |
| 31 |
'value' => 100, |
| 32 |
'price' => 111, |
| 33 |
], |
| 34 |
[ |
| 35 |
'value' => 200, |
| 36 |
'price' => 222, |
| 37 |
], |
| 38 |
[ |
| 39 |
'value' => 300, |
| 40 |
'price' => 333, |
| 41 |
], |
| 42 |
], |
| 43 |
'coupon_free_shipping' => [ |
| 44 |
'active' => true, |
| 45 |
'allow_for_fees' => false, |
| 46 |
], |
| 47 |
]; |
| 48 |
} |
| 49 |
|
| 50 |
public static function getDefaultCarrier(): Options { |
| 51 |
return new Options( 'any', self::getDefaultOptionsArray() ); |
| 52 |
} |
| 53 |
|
| 54 |
public static function getNoCouponCarrier(): Options { |
| 55 |
return new Options( |
| 56 |
'any', |
| 57 |
array_merge( |
| 58 |
self::getDefaultOptionsArray(), |
| 59 |
[ |
| 60 |
'coupon_free_shipping' => [ |
| 61 |
'active' => false, |
| 62 |
], |
| 63 |
] |
| 64 |
) |
| 65 |
); |
| 66 |
} |
| 67 |
|
| 68 |
public static function getProductValuePricingCarrier(): Options { |
| 69 |
return new Options( |
| 70 |
'any', |
| 71 |
array_merge( |
| 72 |
self::getDefaultOptionsArray(), |
| 73 |
[ |
| 74 |
'pricing_type' => Options::PRICING_TYPE_BY_PRODUCT_VALUE, |
| 75 |
] |
| 76 |
) |
| 77 |
); |
| 78 |
} |
| 79 |
|
| 80 |
public static function getNoFreeShippingLimitCarrier(): Options { |
| 81 |
return new Options( |
| 82 |
'any', |
| 83 |
array_merge( |
| 84 |
self::getDefaultOptionsArray(), |
| 85 |
[ |
| 86 |
'free_shipping_limit' => null, |
| 87 |
] |
| 88 |
) |
| 89 |
); |
| 90 |
} |
| 91 |
} |
| 92 |
|