File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,18 @@ class Events implements IEvents {
143143
144144 return await this . send ( target )
145145 }
146+
147+ public async invoiceSent ( data : InvoiceEvent ) : Promise < Response > {
148+ const amount = ( data . amount / 100 ) + ' ' + ( data . currency || 'USD' )
149+
150+ const target : GenericMessage = {
151+ message : `:e_mail: **Invoice ${ data . id } ** (${ amount } ) was sent to **${ data . customer_name } **.` ,
152+ title : `Invoice ${ data . number } ` . trim ( ) ,
153+ url : data . hosted_invoice_url ,
154+ }
155+
156+ return await this . send ( target )
157+ }
146158
147159 /**
148160 * Handler for 'payout.created' event.
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ const handlers: Handler = {
3232 'invoice.finalized' : 'invoiceFinalized' ,
3333 'invoice.paid' : 'invoicePaid' ,
3434 'invoice.payment_failed' : 'invoicePaymentFailed' ,
35+ 'invoice.sent' : 'invoiceSent' ,
3536 'payout.created' : 'payoutCreated' ,
3637 'payout.paid' : 'payoutPaid' ,
3738 'payout.failed' : 'payoutFailed' ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ interface IEvents {
99 invoiceFinalized : EventMethod < InvoiceEvent >
1010 invoicePaid : EventMethod < InvoiceEvent >
1111 invoicePaymentFailed : EventMethod < InvoiceEvent >
12+ invoiceSent : EventMethod < InvoiceEvent >
1213 payoutCreated : EventMethod < PayoutEvent >
1314 payoutPaid : EventMethod < PayoutEvent >
1415 payoutFailed : EventMethod < PayoutEvent >
You can’t perform that action at this time.
0 commit comments