@@ -76,6 +76,16 @@ moduleIntegrationTestRunner<IPricingModuleService>({
7676 max_quantity : 10 ,
7777 rules_count : 0 ,
7878 } ,
79+ {
80+ id : "price-PLN-min-quantity-only" ,
81+ title : "price PLN - min quantity only" ,
82+ price_set_id : "price-set-PLN" ,
83+ currency_code : "PLN" ,
84+ amount : 1250 ,
85+ min_quantity : 20 ,
86+ max_quantity : null ,
87+ rules_count : 0 ,
88+ } ,
7989 {
8090 id : "price-ETH" ,
8191 title : "price ETH" ,
@@ -451,6 +461,59 @@ moduleIntegrationTestRunner<IPricingModuleService>({
451461 ] )
452462 } )
453463
464+ it ( "should successfully calculate prices where only min quantity is set" , async ( ) => {
465+ const context = {
466+ currency_code : "PLN" ,
467+ region_id : "PL" ,
468+ quantity : 255 ,
469+ }
470+
471+ const calculatedPrice = await service . calculatePrices (
472+ { id : [ "price-set-EUR" , "price-set-PLN" ] } ,
473+ { context }
474+ )
475+
476+ console . log (
477+ "calculatedPrice - " ,
478+ JSON . stringify ( calculatedPrice , null , 2 )
479+ )
480+
481+ expect ( calculatedPrice ) . toEqual ( [
482+ {
483+ id : "price-set-PLN" ,
484+ is_calculated_price_price_list : false ,
485+ is_calculated_price_tax_inclusive : false ,
486+ calculated_amount : 1250 ,
487+ raw_calculated_amount : {
488+ value : "1250" ,
489+ precision : 20 ,
490+ } ,
491+ is_original_price_price_list : false ,
492+ is_original_price_tax_inclusive : false ,
493+ original_amount : 1250 ,
494+ raw_original_amount : {
495+ value : "1250" ,
496+ precision : 20 ,
497+ } ,
498+ currency_code : "PLN" ,
499+ calculated_price : {
500+ id : "price-PLN-min-quantity-only" ,
501+ price_list_id : null ,
502+ price_list_type : null ,
503+ min_quantity : 20 ,
504+ max_quantity : null ,
505+ } ,
506+ original_price : {
507+ id : "price-PLN-min-quantity-only" ,
508+ price_list_id : null ,
509+ price_list_type : null ,
510+ min_quantity : 20 ,
511+ max_quantity : null ,
512+ } ,
513+ } ,
514+ ] )
515+ } )
516+
454517 it ( "should throw an error when currency code is not set" , async ( ) => {
455518 let result = service . calculatePrices (
456519 { id : [ "price-set-EUR" , "price-set-PLN" ] } ,
0 commit comments