@@ -219,4 +219,68 @@ var _ = Context("Ledger revert transactions API tests", func() {
219219 })
220220 })
221221 })
222+ When ("creating a transaction through an empty passthrough account" , func () {
223+ var (
224+ timestamp = time .Now ().Round (time .Second ).UTC ()
225+ tx * components.V2Transaction
226+ events chan * nats.Msg
227+ err error
228+ )
229+ BeforeEach (func () {
230+ events = Subscribe (GinkgoT (), testServer .GetValue ())
231+ tx , err = CreateTransaction (
232+ ctx ,
233+ testServer .GetValue (),
234+ operations.V2CreateTransactionRequest {
235+ V2PostTransaction : components.V2PostTransaction {
236+ Metadata : map [string ]string {},
237+ Postings : []components.V2Posting {
238+ {
239+ Amount : big .NewInt (100 ),
240+ Asset : "USD" ,
241+ Source : "walter" ,
242+ Destination : "wendy" ,
243+ },
244+ {
245+ Amount : big .NewInt (100 ),
246+ Asset : "USD" ,
247+ Source : "wendy" ,
248+ Destination : "world" ,
249+ },
250+ },
251+ Timestamp : & timestamp ,
252+ },
253+ Ledger : "default" ,
254+ },
255+ )
256+ Expect (err ).ToNot (HaveOccurred ())
257+ })
258+ When ("trying to revert the passthrough transaction" , func () {
259+ BeforeEach (func () {
260+ _ , err := RevertTransaction (
261+ ctx ,
262+ testServer .GetValue (),
263+ operations.V2RevertTransactionRequest {
264+ Ledger : "default" ,
265+ ID : tx .ID ,
266+ AtEffectiveDate : pointer .For (true ),
267+ },
268+ )
269+ Expect (err ).To (Succeed ())
270+ })
271+ It ("should revert the passthrough transaction at date of the original tx" , func () {
272+ response , err := GetTransaction (
273+ ctx ,
274+ testServer .GetValue (),
275+ operations.V2GetTransactionRequest {
276+ Ledger : "default" ,
277+ ID : tx .ID ,
278+ },
279+ )
280+ Expect (err ).NotTo (HaveOccurred ())
281+ Expect (response .Reverted ).To (BeTrue ())
282+ Expect (response .Timestamp ).To (Equal (tx .Timestamp ))
283+ })
284+ })
285+ })
222286})
0 commit comments