private bool AuthorizationReversalsAreEquivalent(AuthorizationReversal rev1, AuthorizationReversal rev2)
        {
            if (!rev1.Id().Equals(rev2.Id()) ||
                !rev1.MerchantRefNum().Equals(rev2.MerchantRefNum()) ||
                !rev1.TxnTime().Equals(rev2.TxnTime()) ||
                !rev1.Amount().Equals(rev2.Amount()) ||
                !rev1.Status().Equals(rev2.Status()))
            {
                return(false);
            }

            return(true);
        }
        public async Task When_I_partially_void_an_auth_Then_it_should_return_a_valid_response_async()
        {
            _auth = _cardService.Authorize(_auth);

            AuthorizationReversal authReversal = AuthorizationReversal.Builder()
                                                 .MerchantRefNum(_auth.MerchantRefNum())
                                                 .Amount(111) //Amount voided < authorized amount
                                                 .AuthorizationId(_auth.Id())
                                                 .Build();

            AuthorizationReversal response = await _cardService.ReverseAuthAsync(authReversal);

            Assert.That(response.Status(), Is.EqualTo("COMPLETED"));
        }
        public void When_I_void_an_auth_Then_it_should_return_a_valid_response_sync()
        {
            _auth = _cardService.Authorize(_auth);

            AuthorizationReversal authReversal = AuthorizationReversal.Builder()
                                                 .MerchantRefNum(_auth.MerchantRefNum())
                                                 .Amount(6666) // Amount voided == authorized amount
                                                 .AuthorizationId(_auth.Id())
                                                 .Build();

            AuthorizationReversal response = _cardService.ReverseAuth(authReversal);

            Assert.That(response.Status(), Is.EqualTo("COMPLETED"));
        }
        public void When_I_lookup_a_reversal_using_a_reversal_id_Then_it_should_return_a_valid_reversal_sync()
        {
            _auth = _cardService.Authorize(_auth);

            AuthorizationReversal authReversal = AuthorizationReversal.Builder()
                                                 .MerchantRefNum(_auth.MerchantRefNum())
                                                 .Amount(6666)
                                                 .AuthorizationId(_auth.Id())
                                                 .Build();

            authReversal = _cardService.ReverseAuth(authReversal);

            AuthorizationReversal returnedReversal = _cardService.Get(new AuthorizationReversal(authReversal.Id()));

            Assert.That(returnedReversal.Status(), Is.EqualTo("COMPLETED"));
            Assert.That(AuthorizationReversalsAreEquivalent(authReversal, returnedReversal));
        }