-
-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #332 from bigcapitalhq/big-105-convert-invoice-sta…
…tus-after-sending-mail-notification feat: convert invoice status after sending mail notification
- Loading branch information
Showing
50 changed files
with
767 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
packages/server/src/services/Accounts/AccountTransactionTransformer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...ges/server/src/services/Sales/Estimates/subscribers/SaleEstimateMarkApprovedOnMailSent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Inject, Service } from 'typedi'; | ||
import events from '@/subscribers/events'; | ||
import { ISaleEstimateMailPresendEvent } from '@/interfaces'; | ||
import { DeliverSaleEstimate } from '../DeliverSaleEstimate'; | ||
import { ServiceError } from '@/exceptions'; | ||
import { ERRORS } from '../constants'; | ||
|
||
@Service() | ||
export class SaleEstimateMarkApprovedOnMailSent { | ||
@Inject() | ||
private deliverEstimateService: DeliverSaleEstimate; | ||
|
||
/** | ||
* Attaches events. | ||
*/ | ||
public attach(bus) { | ||
bus.subscribe(events.saleEstimate.onPreMailSend, this.markEstimateApproved); | ||
} | ||
|
||
/** | ||
* Marks the given estimate approved on submitting mail. | ||
* @param {ISaleEstimateMailPresendEvent} | ||
*/ | ||
private markEstimateApproved = async ({ | ||
tenantId, | ||
saleEstimateId, | ||
}: ISaleEstimateMailPresendEvent) => { | ||
try { | ||
await this.deliverEstimateService.deliverSaleEstimate( | ||
tenantId, | ||
saleEstimateId | ||
); | ||
} catch (error) { | ||
if ( | ||
error instanceof ServiceError && | ||
error.errorType === ERRORS.SALE_ESTIMATE_ALREADY_DELIVERED | ||
) { | ||
} else { | ||
throw error; | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.