@@ -442,6 +442,11 @@ class OndcService {
442
442
const initMessageId = payload . context . message_id ;
443
443
const logisticsMessageId = uuidv4 ( ) ; //TODO: in future this is going to be array as packaging for single select request can be more than one
444
444
const contextTimeStamp = new Date ( )
445
+
446
+
447
+ let deliveryType = logistics . message . catalog [ "bpp/providers" ] [ 0 ] . items . find ( ( element ) => { return element . category_id === 'Next Day Delivery' } ) ;
448
+
449
+
445
450
const initRequest = {
446
451
"context" : {
447
452
"domain" : "nic2004:60232" ,
@@ -463,7 +468,7 @@ class OndcService {
463
468
"provider" : {
464
469
"id" : logistics . message . catalog [ "bpp/providers" ] [ 0 ] . id
465
470
} ,
466
- "items" : [ logistics . message . catalog [ "bpp/providers" ] [ 0 ] . items [ 0 ] ] ,
471
+ "items" : [ deliveryType ] ,
467
472
"fulfillments" : [ {
468
473
"id" : logistics . message . catalog [ "bpp/fulfillments" ] [ 0 ] . id ,
469
474
"type" : logistics . message . catalog [ "bpp/fulfillments" ] [ 0 ] . type ,
@@ -810,6 +815,9 @@ class OndcService {
810
815
itemDetails . push ( details )
811
816
}
812
817
818
+
819
+ let deliveryType = selectRequest . selectedLogistics . message . catalog [ 'bpp/providers' ] [ 0 ] . items . find ( ( element ) => { return element . category_id === 'Next Day Delivery' } ) ;
820
+
813
821
const contextTimestamp = new Date ( )
814
822
const confirmRequest = {
815
823
"context" : {
@@ -832,16 +840,16 @@ class OndcService {
832
840
"items" : itemDetails ,
833
841
"provider" : {
834
842
"descriptor" : {
835
- " name" : "Spice 9" //TODO: take details from seller service
843
+ name : org . providerDetail . name
836
844
} ,
837
845
"address" : {
838
- "name" : "Spice 9" ,
839
- "building" : "12" ,
840
- "locality" : "prashanth nagar" ,
841
- "city" : "Bangalore" ,
842
- "state" : "Karnataka" ,
843
- "country" : "IND" ,
844
- "area_code" : "560036"
846
+ area_code : org . providerDetail . storeDetails . address . area_code ,
847
+ name : org . providerDetail . name ,
848
+ building : org . providerDetail . storeDetails . address . building ,
849
+ locality : org . providerDetail . storeDetails . address . locality ,
850
+ city : org . providerDetail . storeDetails . address . city ,
851
+ state : org . providerDetail . storeDetails . address . state ,
852
+ country : org . providerDetail . storeDetails . address . country
845
853
}
846
854
} ,
847
855
"order" : {
@@ -853,7 +861,7 @@ class OndcService {
853
861
}
854
862
} ,
855
863
"id" : order . id ,
856
- "items" : [ selectRequest . selectedLogistics . message . catalog [ 'bpp/providers' ] [ 0 ] . items [ 0 ] ] , //TODO: fix this map to right item id from select request
864
+ "items" : [ deliveryType ] , //TODO: fix this map to right item id from select request
857
865
"provider" :initRequest . selectedLogistics . message . order . provider ,
858
866
"fulfillments" : [ {
859
867
"id" : order . fulfillments [ 0 ] . id ,
@@ -870,23 +878,7 @@ class OndcService {
870
878
"collected_by" : "BAP" ,
871
879
"@ondc/org/settlement_details" : [ ]
872
880
} ,
873
- "billing" : { //TODO: hard coded
874
- "name" : "Ek Second Technologies" ,
875
-
876
- "phone" : "9000111111" ,
877
- "created_at" : contextTimestamp ,
878
- "updated_at" : contextTimestamp ,
879
- "address" : {
880
- "name" : "ONDC" ,
881
- "building" : "8-7-171/10/14/B" ,
882
- "locality" : "Old Bowenpally" ,
883
- "city" : "secunderabad" ,
884
- "state" : "Telangana" ,
885
- "country" : "India" ,
886
- "area_code" : "500011"
887
- } ,
888
- "tax_number" : "ADFSDF34343"
889
- } ,
881
+ "billing" : { ...payload . message . order . billing , "tax_number" : "NA" } ,
890
882
state : "Created" ,
891
883
created_at :contextTimestamp ,
892
884
updated_at :contextTimestamp
0 commit comments