Skip to content

Commit af9f016

Browse files
nekhalycducrest
authored andcommitted
Add optional subject tp paymentRequestCancel
1 parent 43a88d3 commit af9f016

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Messaging.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,20 @@ export class Messaging {
107107
/**
108108
* Sends a payment request cancel message to given `counterParty` and returns created message.
109109
* @param counterPartyAddress Address of counter party.
110-
* @param id id of the payment request to decline
110+
* @param id id of the payment request to cancel
111111
* matches either the nonce as a number or id of a payment request as a hex string.
112+
* @param subject Optional subject of cancel message.
112113
*/
113114
public async paymentRequestCancel(
114115
counterPartyAddress: string,
115-
id: string
116+
id: string,
117+
subject?: string
116118
): Promise<PaymentRequestDeclineMessage> {
117119
const type = 'PaymentRequestCancel'
118120
const message = {
119121
type,
120-
id
122+
id,
123+
subject
121124
}
122125
await this.sendMessage(counterPartyAddress, type, message)
123126
return message

tests/e2e/Messaging.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ describe('e2e', () => {
7474
it('should return sent cancel', async () => {
7575
const cancelMessage = await tl1.messaging.paymentRequestCancel(
7676
tl2.user.address,
77-
'0x10'
77+
'0x10',
78+
'test subject'
7879
)
7980
expect(cancelMessage.type).to.equal('PaymentRequestCancel')
8081
expect(cancelMessage.id).to.equal('0x10')
82+
expect(cancelMessage.subject).to.equal('test subject')
8183
})
8284
})
8385

0 commit comments

Comments
 (0)