Browse Source
			
			
			Enable account balance update for fee and interest activities (#3145)
			
				* Enable account balance update for fee and interest activities
* Update changelog
			
			
				pull/3153/head
			
			
		 
		
			
				
					
						 rodriguestiago0
					
					2 years ago
						rodriguestiago0
					
					2 years ago
					
						
							committed by
							
								 GitHub
								GitHub
							
						 
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: B5690EEEBB952194
						
					
				
			
		
		
		
	
		
			
				 3 changed files with 
23 additions and 
3 deletions
			 
			
		 
		
			
				- 
					
					
					 
					CHANGELOG.md
				
- 
					
					
					 
					apps/api/src/app/order/order.service.ts
				
- 
					
					
					 
					apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ### Added | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | - Added support to update the cash balance of an account when adding a fee activity | 
			
		
	
		
			
				
					|  |  |  | - Added support to update the cash balance of an account when adding an interest activity | 
			
		
	
		
			
				
					|  |  |  | - Extended the content of the _General_ section by the product roadmap on the Frequently Asked Questions (FAQ) page | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | ### Changed | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -148,7 +148,7 @@ export class OrderService { | 
			
		
	
		
			
				
					|  |  |  |         .plus(data.fee) | 
			
		
	
		
			
				
					|  |  |  |         .toNumber(); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |       if (data.type === 'BUY') { | 
			
		
	
		
			
				
					|  |  |  |       if (['BUY', 'FEE'].includes(data.type)) { | 
			
		
	
		
			
				
					|  |  |  |         amount = new Big(amount).mul(-1).toNumber(); | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -260,6 +260,17 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { | 
			
		
	
		
			
				
					|  |  |  |           this.activityForm.controls['currency'].setValue(currency); | 
			
		
	
		
			
				
					|  |  |  |           this.activityForm.controls['currencyOfFee'].setValue(currency); | 
			
		
	
		
			
				
					|  |  |  |           this.activityForm.controls['currencyOfUnitPrice'].setValue(currency); | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |           if (['FEE', 'INTEREST'].includes(type)) { | 
			
		
	
		
			
				
					|  |  |  |             if (this.activityForm.controls['accountId'].value) { | 
			
		
	
		
			
				
					|  |  |  |               this.activityForm.controls['updateAccountBalance'].enable(); | 
			
		
	
		
			
				
					|  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |               this.activityForm.controls['updateAccountBalance'].disable(); | 
			
		
	
		
			
				
					|  |  |  |               this.activityForm.controls['updateAccountBalance'].setValue( | 
			
		
	
		
			
				
					|  |  |  |                 false | 
			
		
	
		
			
				
					|  |  |  |               ); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |           } | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |       } | 
			
		
	
		
			
				
					|  |  |  |     ); | 
			
		
	
	
		
			
				
					|  |  | @ -374,8 +385,15 @@ export class CreateOrUpdateActivityDialog implements OnDestroy { | 
			
		
	
		
			
				
					|  |  |  |             this.activityForm.controls['unitPriceInCustomCurrency'].setValue(0); | 
			
		
	
		
			
				
					|  |  |  |           } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |           this.activityForm.controls['updateAccountBalance'].disable(); | 
			
		
	
		
			
				
					|  |  |  |           this.activityForm.controls['updateAccountBalance'].setValue(false); | 
			
		
	
		
			
				
					|  |  |  |           if ( | 
			
		
	
		
			
				
					|  |  |  |             ['FEE', 'INTEREST'].includes(type) && | 
			
		
	
		
			
				
					|  |  |  |             this.activityForm.controls['accountId'].value | 
			
		
	
		
			
				
					|  |  |  |           ) { | 
			
		
	
		
			
				
					|  |  |  |             this.activityForm.controls['updateAccountBalance'].enable(); | 
			
		
	
		
			
				
					|  |  |  |           } else { | 
			
		
	
		
			
				
					|  |  |  |             this.activityForm.controls['updateAccountBalance'].disable(); | 
			
		
	
		
			
				
					|  |  |  |             this.activityForm.controls['updateAccountBalance'].setValue(false); | 
			
		
	
		
			
				
					|  |  |  |           } | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |           this.activityForm.controls['accountId'].setValidators( | 
			
		
	
		
			
				
					|  |  |  |             Validators.required | 
			
		
	
	
		
			
				
					|  |  | 
 |