void CancelCharge() { string code = null; while (String.IsNullOrEmpty(code)) { Console.WriteLine(""); Console.WriteLine("Entre o código da cobrança:"); code = Console.ReadLine(); } try { Charge charge = new Charge(); charge.Code = code; var response = boletoFacil.CancelCharge(charge); ShowObjectResponseHeader(); Console.WriteLine(response); ShowResponseSerialized(response); } catch (BoletoFacilException e) { HandleException(e); } finally { DoneMessage(); } }
public void CancelCharge() { BoletoFacil boletoFacil = GetBoletoFacil(); Charge charge = new Charge(); charge.Code = "12345678"; CancelChargeResponse response = boletoFacil.CancelCharge(charge); Assert.IsNotNull(response); Assert.IsTrue(response.Success); }
public void CancelChargeError() { BoletoFacil boletoFacil = GetBoletoFacil(); Charge charge = Charge; charge.Code = "00000000"; BoletoFacilRequestException response = AssertException <BoletoFacilRequestException>(() => boletoFacil.CancelCharge(charge)); Assert.IsNotNull(response); Assert.AreEqual(400, response.HTTPStatusCode); Assert.IsFalse(response.Error.Success); Assert.AreEqual("Cobrança inválida", response.Error.ErrorMessage); }