public async Task When_I_settle_an_auth_Then_it_should_return_a_valid_response_async() { _auth = await _cardService.AuthorizeAsync(_auth); Settlement settle = Settlement.Builder() .MerchantRefNum(_auth.MerchantRefNum()) .AuthorizationId(_auth.Id()) .Build(); Settlement response = await _cardService.SettlementAsync(settle); Assert.That(response.Status(), Is.EqualTo("PENDING")); }
public async Task When_I_lookup_a_settlement_using_a_settlement_id_Then_it_should_return_a_valid_settlement_async() { _auth = await _cardService.AuthorizeAsync(_auth); Settlement settle = Settlement.Builder() .MerchantRefNum(_auth.MerchantRefNum()) .AuthorizationId(_auth.Id()) .Build(); settle = await _cardService.SettlementAsync(settle); var returnedSettle = await _cardService.GetAsync(new Settlement(settle.Id())); Assert.That(SettlementsAreEquivalent(settle, returnedSettle)); }
public void When_I_cancel_a_settlement_Then_it_should_return_a_valid_response_sync() { _auth = _cardService.Authorize(_auth); Settlement settle = Settlement.Builder() .MerchantRefNum(_auth.MerchantRefNum()) .AuthorizationId(_auth.Id()) .Build(); settle = _cardService.Settlement(settle); Settlement response = _cardService.CancelSettlement(settle); Assert.That(response.Status(), Is.EqualTo("CANCELLED")); }
public async Task When_I_refund_a_pending_settlement_Then_it_should_throw_RequestDeclinedException_async() { _auth = await _cardService.AuthorizeAsync(_auth); Settlement settle = Settlement.Builder() .MerchantRefNum(_auth.MerchantRefNum()) .AuthorizationId(_auth.Id()) .Build(); settle = await _cardService.SettlementAsync(settle); Assert.ThrowsAsync <Paysafe.Common.RequestDeclinedException>(async() => await _cardService.RefundAsync(Refund.Builder() .MerchantRefNum(settle.MerchantRefNum()) .SettlementId(settle.Id()) .Build())); }
public void When_I_refund_a_pending_settlement_Then_it_should_throw_RequestDeclinedException_sync() { _auth = _cardService.Authorize(_auth); Settlement settle = Settlement.Builder() .MerchantRefNum(_auth.MerchantRefNum()) .AuthorizationId(_auth.Id()) .Build(); settle = _cardService.Settlement(settle); Assert.Throws <Paysafe.Common.RequestDeclinedException>(() => _cardService.Refund(Refund.Builder() .MerchantRefNum(settle.MerchantRefNum()) .SettlementId(settle.Id()) .Build())); }
public async Task When_I_lookup_a_settlement_using_a_merchant_refNum_Then_it_should_return_a_valid_settlement_async() { _auth = await _cardService.AuthorizeAsync(_auth); Settlement settle = Settlement.Builder() .MerchantRefNum(_auth.MerchantRefNum()) .AuthorizationId(_auth.Id()) .Build(); settle = await _cardService.SettlementAsync(settle); Pagerator <Settlement> settlements = await _cardService.GetSettlementsAsync(Settlement.Builder() .MerchantRefNum(settle.MerchantRefNum()) .Build()); var settleList = settlements.GetResults(); Assert.That(settleList.Count, Is.EqualTo(1)); Assert.That(SettlementsAreEquivalent(settle, settleList.First())); }