@@ -60,11 +60,10 @@ describe("Create BookPayment", () => {
6060 } )
6161} )
6262
63- describe ( "Create Linkedayment" , ( ) => {
64- test ( "create linked payment" , async ( ) => {
65- const createCounterpartRes = await createCounterpartyForTest ( "22603" )
66-
67- const req : CreateLinkedPaymentRequest = {
63+ async function createPayment ( ) : Promise < CreateLinkedPaymentRequest > {
64+ const createCounterpartRes = await createCounterpartyForTest ( "22603" )
65+
66+ return {
6867 "type" : "achPayment" ,
6968 "attributes" : {
7069 "amount" : 200 ,
@@ -85,10 +84,29 @@ describe("Create Linkedayment", () => {
8584 }
8685 }
8786 }
88- }
87+ }
88+ }
89+
90+ describe ( "Create LinkedPayment" , ( ) => {
91+ test ( "create linked payment" , async ( ) => {
92+
93+
94+ const req : CreateLinkedPaymentRequest = ( await createPayment ( ) )
8995
9096 const createPaymentRes = await unit . payments . create ( req )
9197 const res = await unit . payments . get ( createPaymentRes . data . id )
9298 expect ( res . data . type === "achPayment" ) . toBeTruthy ( )
9399 } )
94100} )
101+
102+ describe ( "Create and cancel LinkedPayment" , ( ) => {
103+ test ( "create and cancel linked payment" , async ( ) => {
104+
105+
106+ const req : CreateLinkedPaymentRequest = ( await createPayment ( ) )
107+
108+ const createPaymentRes = await unit . payments . create ( req )
109+ const res = await unit . payments . cancel ( createPaymentRes . data . id )
110+ expect ( res . data . type === "achPayment" ) . toBeTruthy ( )
111+ } )
112+ } )
0 commit comments