@@ -58,6 +58,7 @@ pub struct BusinessProfile {
58
58
pub always_collect_shipping_details_from_wallet_connector : Option < bool > ,
59
59
pub tax_connector_id : Option < String > ,
60
60
pub is_tax_connector_enabled : Option < bool > ,
61
+ pub api_version : common_enums:: ApiVersion ,
61
62
}
62
63
63
64
#[ cfg( all(
@@ -100,6 +101,7 @@ pub struct BusinessProfileNew {
100
101
pub always_collect_shipping_details_from_wallet_connector : Option < bool > ,
101
102
pub tax_connector_id : Option < String > ,
102
103
pub is_tax_connector_enabled : Option < bool > ,
104
+ pub api_version : common_enums:: ApiVersion ,
103
105
}
104
106
105
107
#[ cfg( all(
@@ -229,6 +231,7 @@ impl BusinessProfileUpdateInternal {
229
231
. or ( source. always_collect_shipping_details_from_wallet_connector ) ,
230
232
tax_connector_id : tax_connector_id. or ( source. tax_connector_id ) ,
231
233
is_tax_connector_enabled : is_tax_connector_enabled. or ( source. is_tax_connector_enabled ) ,
234
+ api_version : source. api_version ,
232
235
}
233
236
}
234
237
}
@@ -240,9 +243,8 @@ impl BusinessProfileUpdateInternal {
240
243
/// fields read / written will be interchanged
241
244
#[ cfg( all( feature = "v2" , feature = "business_profile_v2" ) ) ]
242
245
#[ derive( Clone , Debug , Identifiable , Queryable , Selectable , router_derive:: DebugAsDisplay ) ]
243
- #[ diesel( table_name = business_profile, primary_key( profile_id ) , check_for_backend( diesel:: pg:: Pg ) ) ]
246
+ #[ diesel( table_name = business_profile, primary_key( id ) , check_for_backend( diesel:: pg:: Pg ) ) ]
244
247
pub struct BusinessProfile {
245
- pub profile_id : common_utils:: id_type:: ProfileId ,
246
248
pub merchant_id : common_utils:: id_type:: MerchantId ,
247
249
pub profile_name : String ,
248
250
pub created_at : time:: PrimitiveDateTime ,
@@ -275,15 +277,31 @@ pub struct BusinessProfile {
275
277
pub frm_routing_algorithm_id : Option < String > ,
276
278
pub payout_routing_algorithm_id : Option < common_utils:: id_type:: RoutingId > ,
277
279
pub default_fallback_routing : Option < pii:: SecretSerdeValue > ,
280
+ pub id : common_utils:: id_type:: ProfileId ,
278
281
pub tax_connector_id : Option < String > ,
279
282
pub is_tax_connector_enabled : Option < bool > ,
283
+ pub api_version : common_enums:: ApiVersion ,
284
+ }
285
+
286
+ impl BusinessProfile {
287
+ #[ cfg( all(
288
+ any( feature = "v1" , feature = "v2" ) ,
289
+ not( feature = "business_profile_v2" )
290
+ ) ) ]
291
+ pub fn get_id ( & self ) -> & common_utils:: id_type:: ProfileId {
292
+ & self . profile_id
293
+ }
294
+
295
+ #[ cfg( all( feature = "v2" , feature = "business_profile_v2" ) ) ]
296
+ pub fn get_id ( & self ) -> & common_utils:: id_type:: ProfileId {
297
+ & self . id
298
+ }
280
299
}
281
300
282
301
#[ cfg( all( feature = "v2" , feature = "business_profile_v2" ) ) ]
283
302
#[ derive( Clone , Debug , Insertable , router_derive:: DebugAsDisplay ) ]
284
303
#[ diesel( table_name = business_profile, primary_key( profile_id) ) ]
285
304
pub struct BusinessProfileNew {
286
- pub profile_id : common_utils:: id_type:: ProfileId ,
287
305
pub merchant_id : common_utils:: id_type:: MerchantId ,
288
306
pub profile_name : String ,
289
307
pub created_at : time:: PrimitiveDateTime ,
@@ -316,8 +334,10 @@ pub struct BusinessProfileNew {
316
334
pub frm_routing_algorithm_id : Option < String > ,
317
335
pub payout_routing_algorithm_id : Option < common_utils:: id_type:: RoutingId > ,
318
336
pub default_fallback_routing : Option < pii:: SecretSerdeValue > ,
337
+ pub id : common_utils:: id_type:: ProfileId ,
319
338
pub tax_connector_id : Option < String > ,
320
339
pub is_tax_connector_enabled : Option < bool > ,
340
+ pub api_version : common_enums:: ApiVersion ,
321
341
}
322
342
323
343
#[ cfg( all( feature = "v2" , feature = "business_profile_v2" ) ) ]
@@ -395,7 +415,7 @@ impl BusinessProfileUpdateInternal {
395
415
is_tax_connector_enabled,
396
416
} = self ;
397
417
BusinessProfile {
398
- profile_id : source. profile_id ,
418
+ id : source. id ,
399
419
merchant_id : source. merchant_id ,
400
420
profile_name : profile_name. unwrap_or ( source. profile_name ) ,
401
421
created_at : source. created_at ,
@@ -449,6 +469,7 @@ impl BusinessProfileUpdateInternal {
449
469
default_fallback_routing : default_fallback_routing. or ( source. default_fallback_routing ) ,
450
470
tax_connector_id : tax_connector_id. or ( source. tax_connector_id ) ,
451
471
is_tax_connector_enabled : is_tax_connector_enabled. or ( source. is_tax_connector_enabled ) ,
472
+ api_version : source. api_version ,
452
473
}
453
474
}
454
475
}
@@ -460,7 +481,7 @@ impl BusinessProfileUpdateInternal {
460
481
impl From < BusinessProfileNew > for BusinessProfile {
461
482
fn from ( new : BusinessProfileNew ) -> Self {
462
483
Self {
463
- profile_id : new. profile_id ,
484
+ id : new. id ,
464
485
merchant_id : new. merchant_id ,
465
486
profile_name : new. profile_name ,
466
487
created_at : new. created_at ,
@@ -498,6 +519,7 @@ impl From<BusinessProfileNew> for BusinessProfile {
498
519
default_fallback_routing : new. default_fallback_routing ,
499
520
tax_connector_id : new. tax_connector_id ,
500
521
is_tax_connector_enabled : new. is_tax_connector_enabled ,
522
+ api_version : new. api_version ,
501
523
}
502
524
}
503
525
}
0 commit comments