public void PaymentNullAccessToken() { string accessToken = null; Payment pay = new Payment(); pay.intent = "sale"; CreditCard card = GetCreditCard(); List <FundingInstrument> instruments = new List <FundingInstrument>(); FundingInstrument instrument = new FundingInstrument(); instrument.credit_card = card; instruments.Add(instrument); Payer payr = new Payer(); payr.payment_method = "credit_card"; payr.funding_instruments = instruments; List <Transaction> transacts = new List <Transaction>(); Transaction trans = new Transaction(); trans.amount = GetAmount(); transacts.Add(trans); pay.transactions = transacts; pay.payer = payr; UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => pay.Create(accessToken)); }
public void PaymentNullAccessToken() { var payment = GetPaymentForSale(); string accessToken = null; UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => payment.Create(accessToken)); }
public void AuthorizationNullAccessTokenTest() { string token = null; var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => Authorization.Get(token, authorizationId)); }
public void AuthroizationReauthorizeTest() { var authorization = Authorization.Get(UnitTestUtil.GetApiContext(), "7GH53639GA425732B"); var reauthorizeAmount = new Amount(); reauthorizeAmount.currency = "USD"; reauthorizeAmount.total = "1"; authorization.amount = reauthorizeAmount; UnitTestUtil.AssertThrownException <PayPal.Exception.HttpException>(() => authorization.Reauthorize(UnitTestUtil.GetApiContext())); }
public void WebProfileDeleteTest() { // Create a new profile var profileName = Guid.NewGuid().ToString(); var profile = WebProfileTest.GetWebProfile(); profile.name = profileName; var createdProfile = profile.Create(UnitTestUtil.GetApiContext()); // Get the profile object for the new profile profile = WebProfile.Get(UnitTestUtil.GetApiContext(), createdProfile.id); // Delete the profile profile.Delete(UnitTestUtil.GetApiContext()); // Attempt to get the profile. This should result in an exception. UnitTestUtil.AssertThrownException <PayPal.Exception.HttpException>(() => { WebProfile.Get(UnitTestUtil.GetApiContext(), profile.id); }); }
public void AuthorizationNullIdTest() { UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => Authorization.Get(UnitTestUtil.GetApiContext(), null)); }
public void NullRefundIdTest() { UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => Refund.Get(UnitTestUtil.GetApiContext(), null)); }
public void CreditCardNullIdTest() { UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => CreditCard.Get(UnitTestUtil.GetApiContext(), null)); }
public void SaleNullIdTest() { UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => Sale.Get(UnitTestUtil.GetApiContext(), null)); }
public void NullAuthorizationIdTest() { string authorizationId = null; UnitTestUtil.AssertThrownException <System.ArgumentNullException>(() => Authorization.Get(UnitTestUtil.GetApiContext(), authorizationId)); }