public async void TestPlansNegativeDeactivate(string subscriptionId, string errorName)
        {
            // - Deactivate Plan
            PlansDeactivateRequest deactivateRequest = new PlansDeactivateRequest(subscriptionId);

            PayPalHttp.HttpException httpException = await Assert.ThrowsAsync <PayPalHttp.HttpException>(() =>
            {
                return(TestHarness.client().Execute(deactivateRequest));
            });

            Assert.Equal(errorName, httpException.GetError().Name);
        }
        public async void TestPlansNegativeChangePricing(string planId, string errorName)
        {
            // - Change Plan Pricing
            PlansChangePricingRequest patchRequest = new PlansChangePricingRequest(planId);

            patchRequest.RequestBody(buildRequestBody());

            PayPalHttp.HttpException httpException = await Assert.ThrowsAsync <PayPalHttp.HttpException>(() =>
            {
                return(TestHarness.client().Execute(patchRequest));
            });

            Assert.Equal(errorName, httpException.GetError().Name);
        }
        public async void TestProductsNegativeUpdate(string productId, string errorName)
        {
            // - Update Product
            ProductsPatchRequest <string> patchRequest = new ProductsPatchRequest <string>(productId);

            patchRequest.RequestBody(buildRequestBody());

            PayPalHttp.HttpException httpException = await Assert.ThrowsAsync <PayPalHttp.HttpException>(() =>
            {
                return(TestHarness.client().Execute(patchRequest));
            });

            Assert.Equal(errorName, httpException.GetError().Name);
        }
Ejemplo n.º 4
0
        public async void TestSubscriptionsNegativeRevise(string subscriptionId, string errorName)
        {
            // - Revise Subscription
            SubscriptionsReviseRequest reviseRequest = new SubscriptionsReviseRequest(subscriptionId);

            reviseRequest.RequestBody(new SubscriptionReviseRequest()
            {
            });

            PayPalHttp.HttpException httpException = await Assert.ThrowsAsync <PayPalHttp.HttpException>(() =>
            {
                return(TestHarness.client().Execute(reviseRequest));
            });

            Assert.Equal(errorName, httpException.GetError().Name);
        }
        public async void TestSubscriptionsNegativeSuspend(string subscriptionId, string errorName)
        {
            // - Suspend Subscription
            SubscriptionsSuspendRequest suspendRequest = new SubscriptionsSuspendRequest(subscriptionId);

            suspendRequest.RequestBody(new SubscriptionSuspendRequest()
            {
                Reason = "Need to suspend"
            });

            PayPalHttp.HttpException httpException = await Assert.ThrowsAsync <PayPalHttp.HttpException>(() =>
            {
                return(TestHarness.client().Execute(suspendRequest));
            });

            Assert.Equal(errorName, httpException.GetError().Name);
        }
Ejemplo n.º 6
0
        public async void TestSubscriptionsNegativeCapture(string subscriptionId, string errorName)
        {
            // - Capture Subscription
            SubscriptionsCaptureRequest captureRequest = new SubscriptionsCaptureRequest(subscriptionId);

            captureRequest.RequestBody(new SubscriptionCaptureRequest()
            {
                Note = "This is a note"
            });

            PayPalHttp.HttpException httpException = await Assert.ThrowsAsync <PayPalHttp.HttpException>(() =>
            {
                return(TestHarness.client().Execute(captureRequest));
            });

            Assert.Equal(errorName, httpException.GetError().Name);
        }