File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
VirtoCommerce.ExperienceApiModule.XOrder/Commands Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,19 @@ public virtual async Task<CustomerOrderAggregate> Handle(CreateOrderFromCartComm
4646 unselectedGifts . ForEach ( x => cartAggregate . Cart . Items . Remove ( x ) ) ;
4747 }
4848
49+ cartAggregate . Cart . OrganizationName = null ;
50+ await cartAggregate . UpdateOrganizationName ( ) ;
51+
4952 await ValidateCart ( cartAggregate ) ;
5053
51- // need to check for unsaved gift items before createing an order and resave the cart, otherwise an exception will be thrown on order create
54+ // need to check for unsaved gift items before creating an order and resave the cart, otherwise an exception will be thrown on order create
5255 var hasUnsavedGifts = cartAggregate . GiftItems . Any ( x => x . Id == null ) ;
5356 if ( hasUnsavedGifts )
5457 {
5558 await _cartRepository . SaveAsync ( cartAggregate ) ;
5659 }
5760
58- var result = await _customerOrderAggregateRepository . CreateOrderFromCart ( cart ) ;
61+ var result = await _customerOrderAggregateRepository . CreateOrderFromCart ( cartAggregate . Cart ) ;
5962
6063 // remove selected items after order create
6164 var selectedLineItemIds = cartAggregate . SelectedLineItems . Select ( x => x . Id ) . ToArray ( ) ;
Original file line number Diff line number Diff line change @@ -844,7 +844,7 @@ public virtual async Task<CartAggregate> UpdateOrganizationName()
844844 else if ( string . IsNullOrEmpty ( Cart . OrganizationName ) )
845845 {
846846 var organization = await _memberService . GetByIdAsync ( Cart . OrganizationId ) ;
847- Cart . OrganizationName = organization . Name ;
847+ Cart . OrganizationName = organization ? . Name ;
848848 }
849849
850850 return this ;
You can’t perform that action at this time.
0 commit comments