public void PaymentStateTest() { try { var actual = CreatePaymentForSale(); Assert.AreEqual("approved", actual.state); } finally { TestingUtil.RecordConnectionDetails(); } }
public void PaymentListHistoryTest() { try { var context = TestingUtil.GetApiContext(); var paymentHistory = Payment.List(context, count: 10); Assert.IsTrue(paymentHistory.count > 0 && paymentHistory.count <= 10); } finally { TestingUtil.RecordConnectionDetails(); } }
public void OrderGetTest() { try { var orderId = "O-2HT09787H36911800"; var order = Order.Get(TestingUtil.GetApiContext(), orderId); Assert.AreEqual(orderId, order.id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void WebhookGetListTest() { try { var webhookList = Webhook.GetAll(TestingUtil.GetApiContext()); Assert.IsNotNull(webhookList); Assert.IsNotNull(webhookList.webhooks); } finally { TestingUtil.RecordConnectionDetails(); } }
public void AuthorizationGetTest() { try { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorize = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); Assert.AreEqual(authorizationId, authorize.id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void CreditCardListTest() { try { var creditCardList = CreditCard.List(TestingUtil.GetApiContext(), startTime: "2014-11-01T19:27:56Z", endTime: "2014-12-25T19:27:56Z"); Assert.IsNotNull(creditCardList); Assert.IsTrue(creditCardList.total_items > 0); Assert.IsTrue(creditCardList.total_pages > 0); } finally { TestingUtil.RecordConnectionDetails(); } }
public void PlanListTest() { try { var planList = Plan.List(TestingUtil.GetApiContext()); Assert.IsNotNull(planList); Assert.IsNotNull(planList.plans); Assert.IsTrue(planList.plans.Count > 0); } finally { TestingUtil.RecordConnectionDetails(); } }
public void FuturePaymentTest() { try { var context = TestingUtil.GetApiContext(); var futurePayment = CreateFuturePayment(); var retrievedPayment = FuturePayment.Get(context, futurePayment.id); Assert.AreEqual(futurePayment.id, retrievedPayment.id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void CreditCardDeleteTest() { try { var card = GetCreditCard(); var createdCreditCard = card.Create(TestingUtil.GetApiContext()); var retrievedCreditCard = CreditCard.Get(TestingUtil.GetApiContext(), createdCreditCard.id); retrievedCreditCard.Delete(TestingUtil.GetApiContext()); } finally { TestingUtil.RecordConnectionDetails(); } }
public void CreditCardGetTest() { try { var card = GetCreditCard(); var createdCreditCard = card.Create(TestingUtil.GetApiContext()); var retrievedCreditCard = CreditCard.Get(TestingUtil.GetApiContext(), createdCreditCard.id); Assert.AreEqual(createdCreditCard.id, retrievedCreditCard.id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void SaleGetTest() { try { var saleId = "4V7971043K262623A"; var sale = Sale.Get(TestingUtil.GetApiContext(), saleId); Assert.IsNotNull(sale); Assert.AreEqual(saleId, sale.id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void PaymentCreateAndGetTest() { try { var context = TestingUtil.GetApiContext(); var pay = CreatePaymentForSale(); var retrievedPayment = Payment.Get(context, pay.id); Assert.AreEqual(pay.id, retrievedPayment.id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void WebhookUpdateTest() { try { var webhook = WebhookTest.GetWebhook(); webhook.url = "https://" + Guid.NewGuid().ToString() + ".com/paypal_webhooks"; var createdWebhook = webhook.Create(TestingUtil.GetApiContext()); var newUrl = "https://update.com/paypal_webhooks/" + Guid.NewGuid().ToString(); var newEventTypeName = "PAYMENT.SALE.REFUNDED"; var patchRequest = new PatchRequest { new Patch { op = "replace", path = "/url", value = newUrl }, new Patch { op = "replace", path = "/event_types", value = new List <WebhookEventType> { new WebhookEventType { name = newEventTypeName } } } }; var updatedWebhook = createdWebhook.Update(TestingUtil.GetApiContext(), patchRequest); Assert.IsNotNull(updatedWebhook); Assert.AreEqual(createdWebhook.id, updatedWebhook.id); Assert.AreEqual(newUrl, updatedWebhook.url); Assert.IsNotNull(updatedWebhook.event_types); Assert.AreEqual(1, updatedWebhook.event_types.Count); Assert.AreEqual(newEventTypeName, updatedWebhook.event_types[0].name); // Cleanup updatedWebhook.Delete(TestingUtil.GetApiContext()); } finally { TestingUtil.RecordConnectionDetails(); } }
public void AgreementSearchTest() { try { var startDate = "2014-10-01"; var endDate = "2014-10-14"; var transactions = Agreement.ListTransactions(TestingUtil.GetApiContext(), "I-9STXMKR58UNN", startDate, endDate); Assert.IsNotNull(transactions); Assert.IsNotNull(transactions.agreement_transaction_list); } finally { TestingUtil.RecordConnectionDetails(); } }
public void WebhookDeleteTest() { try { var webhook = WebhookTest.GetWebhook(); webhook.url = "https://" + Guid.NewGuid().ToString() + ".com/paypal_webhooks"; var createdWebhook = webhook.Create(TestingUtil.GetApiContext()); createdWebhook.Delete(TestingUtil.GetApiContext()); Assert.AreEqual(204, (int)PayPalResource.LastResponseDetails.Value.StatusCode); } finally { TestingUtil.RecordConnectionDetails(); } }
public void PayoutItemGetTest() { try { var payoutItemId = "G2CFT8SJRB7RN"; var payoutItemDetails = PayoutItem.Get(TestingUtil.GetApiContext(), payoutItemId); Assert.IsNotNull(payoutItemDetails); Assert.AreEqual(payoutItemId, payoutItemDetails.payout_item_id); Assert.AreEqual("8NX77PFLN255E", payoutItemDetails.payout_batch_id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void InvoiceQrCodeTest() { try { var invoice = GetInvoice(); var createdInvoice = invoice.Create(TestingUtil.GetApiContext()); var qrCode = Invoice.QrCode(TestingUtil.GetApiContext(), createdInvoice.id); Assert.IsNotNull(qrCode); Assert.IsTrue(!string.IsNullOrEmpty(qrCode.image)); createdInvoice.Delete(TestingUtil.GetApiContext()); } finally { TestingUtil.RecordConnectionDetails(); } }
public void InvoiceCreateTest() { try { var invoice = GetInvoice(); invoice.merchant_info.address.phone = null; invoice.shipping_info.address.phone = null; var createdInvoice = invoice.Create(TestingUtil.GetApiContext()); Assert.IsNotNull(createdInvoice.id); Assert.AreEqual(invoice.note, createdInvoice.note); } finally { TestingUtil.RecordConnectionDetails(); } }
public void AuthroizationReauthorizeTest() { try { var authorization = Authorization.Get(TestingUtil.GetApiContext(), "7GH53639GA425732B"); var reauthorizeAmount = new Amount(); reauthorizeAmount.currency = "USD"; reauthorizeAmount.total = "1"; authorization.amount = reauthorizeAmount; TestingUtil.AssertThrownException <PayPal.PaymentsException>(() => authorization.Reauthorize(TestingUtil.GetApiContext())); } finally { TestingUtil.RecordConnectionDetails(); } }
public void AgreementExecuteTest() { try { var agreement = new Agreement() { token = "EC-2CD33889A9699491E" }; var executedAgreement = agreement.Execute(TestingUtil.GetApiContext()); Assert.AreEqual("I-ASXCM9U5MJJV", executedAgreement.id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void CreditCardUpdateTest() { try { var creditCard = CreateCreditCard(); // Create a patch request to update the credit card. var patchRequest = new PatchRequest { new Patch { op = "replace", path = "/billing_address", value = new Address { line1 = "111 First Street", city = "Saratoga", country_code = "US", state = "CA", postal_code = "95070" } } }; var apiContext = TestingUtil.GetApiContext(); var updatedCreditCard = creditCard.Update(apiContext, patchRequest); // Retrieve the credit card details from the vault and verify the // billing address was updated properly. var retrievedCreditCard = CreditCard.Get(apiContext, updatedCreditCard.id); Assert.IsNotNull(retrievedCreditCard); Assert.IsNotNull(retrievedCreditCard.billing_address); Assert.AreEqual("111 First Street", retrievedCreditCard.billing_address.line1); Assert.AreEqual("Saratoga", retrievedCreditCard.billing_address.city); Assert.AreEqual("US", retrievedCreditCard.billing_address.country_code); Assert.AreEqual("CA", retrievedCreditCard.billing_address.state); Assert.AreEqual("95070", retrievedCreditCard.billing_address.postal_code); } finally { TestingUtil.RecordConnectionDetails(); } }
public void WebProfilePartialUpdateTest() { try { // Create a new profile var profileName = Guid.NewGuid().ToString(); var profile = WebProfileTest.GetWebProfile(); profile.name = profileName; var createdProfile = profile.Create(TestingUtil.GetApiContext()); // Get the profile object for the new profile profile = WebProfile.Get(TestingUtil.GetApiContext(), createdProfile.id); // Partially update the profile var newName = "New " + profileName; var patch1 = new Patch(); patch1.op = "add"; patch1.path = "/presentation/brand_name"; patch1.value = newName; var patch2 = new Patch(); patch2.op = "remove"; patch2.path = "/flow_config/landing_page_type"; var patchRequest = new PatchRequest(); patchRequest.Add(patch1); patchRequest.Add(patch2); profile.PartialUpdate(TestingUtil.GetApiContext(), patchRequest); // Get the profile again and verify it was successfully updated via the patch commands. var retrievedProfile = WebProfile.Get(TestingUtil.GetApiContext(), profile.id); Assert.AreEqual(newName, retrievedProfile.presentation.brand_name); Assert.IsTrue(string.IsNullOrEmpty(retrievedProfile.flow_config.landing_page_type)); // Delete the profile profile.Delete(TestingUtil.GetApiContext()); } finally { TestingUtil.RecordConnectionDetails(); } }
public void AgreementCreateTest() { try { var apiContext = TestingUtil.GetApiContext(); // Create a new plan. var plan = PlanTest.GetPlan(); var createdPlan = plan.Create(apiContext); // Activate the plan. var patchRequest = new PatchRequest() { new Patch() { op = "replace", path = "/", value = new Plan() { state = "ACTIVE" } } }; createdPlan.Update(apiContext, patchRequest); // Create an agreement using the activated plan. var agreement = GetAgreement(); agreement.plan = new Plan() { id = createdPlan.id }; agreement.shipping_address = null; var createdAgreement = agreement.Create(apiContext); Assert.IsNull(createdAgreement.id); Assert.IsNotNull(createdAgreement.token); Assert.AreEqual(agreement.name, createdAgreement.name); } finally { TestingUtil.RecordConnectionDetails(); } }
public void AuthorizationCaptureTest() { try { var pay = PaymentTest.CreatePaymentAuthorization(); var authorizationId = pay.transactions[0].related_resources[0].authorization.id; var authorize = Authorization.Get(TestingUtil.GetApiContext(), authorizationId); var cap = new Capture(); var amt = new Amount(); amt.total = "1"; amt.currency = "USD"; cap.amount = amt; var response = authorize.Capture(TestingUtil.GetApiContext(), cap); Assert.AreEqual("completed", response.state); } finally { TestingUtil.RecordConnectionDetails(); } }
public void AgreementGetTest() { try { var apiContext = TestingUtil.GetApiContext(); var agreement = new Agreement() { token = "EC-2CD33889A9699491E" }; var executedAgreement = agreement.Execute(apiContext); var agreementId = executedAgreement.id; var retrievedAgreement = Agreement.Get(apiContext, agreementId); Assert.AreEqual(agreementId, retrievedAgreement.id); Assert.AreEqual("-6514356286402072739", retrievedAgreement.description); Assert.AreEqual("2015-02-19T08:00:00Z", retrievedAgreement.start_date); Assert.IsNotNull(retrievedAgreement.plan); } finally { TestingUtil.RecordConnectionDetails(); } }
public void WebProfileDeleteTest() { try { // Create a new profile var profileName = Guid.NewGuid().ToString(); var profile = WebProfileTest.GetWebProfile(); profile.name = profileName; var createdProfile = profile.Create(TestingUtil.GetApiContext()); // Get the profile object for the new profile profile = WebProfile.Get(TestingUtil.GetApiContext(), createdProfile.id); // Delete the profile profile.Delete(TestingUtil.GetApiContext()); Assert.AreEqual(204, (int)PayPalResource.LastResponseDetails.Value.StatusCode); } finally { TestingUtil.RecordConnectionDetails(); } }
public void PlanCreateAndGetTest() { try { var apiContext = TestingUtil.GetApiContext(); var plan = GetPlan(); var createdPlan = plan.Create(apiContext); Assert.IsTrue(!string.IsNullOrEmpty(createdPlan.id)); Assert.AreEqual(plan.name, createdPlan.name); var retrievedPlan = Plan.Get(apiContext, createdPlan.id); Assert.IsNotNull(retrievedPlan); Assert.AreEqual(createdPlan.id, retrievedPlan.id); Assert.AreEqual("T-Shirt of the Month Club Plan", retrievedPlan.name); Assert.AreEqual("Template creation.", retrievedPlan.description); Assert.AreEqual("FIXED", retrievedPlan.type); } finally { TestingUtil.RecordConnectionDetails(); } }
public void PayoutCreateAndGetTest() { try { var apiContext = TestingUtil.GetApiContext(); var payout = PayoutTest.GetPayout(); var payoutSenderBatchId = "batch_" + System.Guid.NewGuid().ToString().Substring(0, 8); payout.sender_batch_header.sender_batch_id = payoutSenderBatchId; var createdPayout = payout.Create(apiContext, false); Assert.IsNotNull(createdPayout); Assert.IsTrue(!string.IsNullOrEmpty(createdPayout.batch_header.payout_batch_id)); Assert.AreEqual(payoutSenderBatchId, createdPayout.batch_header.sender_batch_header.sender_batch_id); var payoutBatchId = createdPayout.batch_header.payout_batch_id; var retrievedPayout = Payout.Get(apiContext, payoutBatchId); Assert.IsNotNull(payout); Assert.AreEqual(payoutBatchId, retrievedPayout.batch_header.payout_batch_id); } finally { TestingUtil.RecordConnectionDetails(); } }
public void PlanUpdateTest() { try { var apiContext = TestingUtil.GetApiContext(); // Get a test plan for updating purposes. var plan = GetPlan(); var createdPlan = plan.Create(TestingUtil.GetApiContext()); var planId = createdPlan.id; // Create the patch request and update the description to a random value. var updatedDescription = Guid.NewGuid().ToString(); var patch = new Patch(); patch.op = "replace"; patch.path = "/"; patch.value = new Plan() { description = updatedDescription }; var patchRequest = new PatchRequest(); patchRequest.Add(patch); // Update the plan. createdPlan.Update(apiContext, patchRequest); // Verify the plan was updated successfully. var updatedPlan = Plan.Get(apiContext, planId); Assert.AreEqual(planId, updatedPlan.id); Assert.AreEqual(updatedDescription, updatedPlan.description); } finally { TestingUtil.RecordConnectionDetails(); } }