예제 #1
0
        public void DeleteTokenizedPaymentMethod_WithNonExistingId()
        {
            _card = new CreditCardData {
                Number   = "4111111111111111",
                ExpMonth = 12,
                ExpYear  = 2025,
                Cvn      = "123"
            };

            var tokenizedCard = new CreditCardData {
                Token = _card.Tokenize()
            };

            Assert.IsNotNull(tokenizedCard.Token);
            Assert.IsTrue(tokenizedCard.DeleteToken());
            Assert.IsFalse(tokenizedCard.DeleteToken());

            try {
                tokenizedCard.Verify().Execute();
            }
            catch (GatewayException ex) {
                Assert.AreEqual("RESOURCE_NOT_FOUND", ex.ResponseCode);
                Assert.AreEqual("40118", ex.ResponseMessage);
                Assert.IsTrue(ex.Message.StartsWith("Status Code: NotFound - PAYMENT_METHODS"));
            }
        }
예제 #2
0
        // The used credentials on this test have not permissions to delete a tokenized card
        public void DeleteTokenizedPaymentMethod_WithNonExistingId()
        {
            _card = new CreditCardData {
                Number   = "4111111111111111",
                ExpMonth = expMonth,
                ExpYear  = expYear,
                Cvn      = "123"
            };

            var tokenizedCard = new CreditCardData {
                Token = _card.Tokenize()
            };

            Assert.IsNotNull(tokenizedCard.Token);
            Assert.IsTrue(tokenizedCard.DeleteToken());
            Assert.IsFalse(tokenizedCard.DeleteToken());

            var exceptionCaught = false;

            try {
                tokenizedCard.Verify()
                .WithCurrency("USD")
                .Execute();
            }
            catch (GatewayException ex) {
                exceptionCaught = true;
                Assert.AreEqual("ACTION_NOT_AUTHORIZED", ex.ResponseCode);
                Assert.AreEqual("40212", ex.ResponseMessage);
                Assert.IsTrue(ex.Message.StartsWith("Status Code: Forbidden - Permission not enabled to execute action"));
            } finally {
                Assert.IsTrue(exceptionCaught);
            }
        }
예제 #3
0
        // The used credentials on this test have not permissions to delete a tokenized card
        public void DeleteTokenizedPaymentMethod_WithMalformedId()
        {
            const string token = "This_is_not_a_payment_id";

            var tokenizedCard = new CreditCardData {
                Token = token
            };

            Assert.IsFalse(tokenizedCard.DeleteToken());

            var exceptionCaught = false;

            try {
                tokenizedCard.Verify()
                .WithCurrency("USD")
                .Execute();
            }
            catch (GatewayException ex) {
                exceptionCaught = true;
                Assert.AreEqual("INVALID_REQUEST_DATA", ex.ResponseCode);
                Assert.AreEqual("40213", ex.ResponseMessage);
                Assert.AreEqual($"Status Code: BadRequest - payment_method.id: {token} contains unexpected data", ex.Message);
            } finally {
                Assert.IsTrue(exceptionCaught);
            }
        }
예제 #4
0
        public static void Cleanup()
        {
            CreditCardData tokenizedCard = new CreditCardData {
                Token = Token
            };

            Assert.IsTrue(tokenizedCard.DeleteToken());
        }
예제 #5
0
        public void UnboardCard()
        {
            string token = TestCards.MasterCardManual().Tokenize();

            Assert.IsNotNull(token);

            var deleteCard = new CreditCardData {
                Token = token
            };

            bool success = deleteCard.DeleteToken();

            Assert.IsTrue(success);
        }
예제 #6
0
        public void DeleteToken()
        {
            var token = new CreditCardData {
                Token = _token
            };

            Assert.IsTrue(token.DeleteToken());

            try {
                token.Verify().Execute();
            }
            catch (GatewayException exc) {
                Assert.AreEqual("23", exc.ResponseCode);
            }
        }
예제 #7
0
        public void Cleanup()
        {
            var tokenizedCard = new CreditCardData {
                Token = _token
            };

            Assert.IsTrue(tokenizedCard.DeleteToken());

            try {
                tokenizedCard.Verify().Execute();
            }
            catch (GatewayException ex) {
                Assert.AreEqual("RESOURCE_NOT_FOUND", ex.ResponseCode);
            }
        }
예제 #8
0
        public void DeleteTokenizedPaymentMethod_WithRandomId()
        {
            var tokenizedCard = new CreditCardData {
                Token = "PMT_" + Guid.NewGuid().ToString()
            };

            Assert.IsFalse(tokenizedCard.DeleteToken());

            try {
                tokenizedCard.Verify().Execute();
            }
            catch (GatewayException ex) {
                Assert.AreEqual("RESOURCE_NOT_FOUND", ex.ResponseCode);
                Assert.AreEqual("40118", ex.ResponseMessage);
                Assert.IsTrue(ex.Message.StartsWith("Status Code: NotFound - PAYMENT_METHODS"));
            }
        }
예제 #9
0
        public void DeleteTokenizedPaymentMethod_WithMalformedId()
        {
            string token = "This_is_not_a_payment_id";

            var tokenizedCard = new CreditCardData {
                Token = token
            };

            Assert.IsFalse(tokenizedCard.DeleteToken());

            try {
                tokenizedCard.Verify().Execute();
            }
            catch (GatewayException ex) {
                Assert.AreEqual("INVALID_REQUEST_DATA", ex.ResponseCode);
                Assert.AreEqual("40006", ex.ResponseMessage);
                Assert.AreEqual($"Status Code: BadRequest - payment_method.id: {token} contains unexpected data", ex.Message);
            }
        }
        public static void Cleanup()
        {
            var tokenizedCard = new CreditCardData {
                Token = Token
            };

            Assert.IsTrue(tokenizedCard.DeleteToken());

            var exceptionCaught = false;

            try {
                tokenizedCard.Verify()
                .WithCurrency("USD")
                .Execute();
            }
            catch (GatewayException ex) {
                exceptionCaught = true;
                Assert.AreEqual("RESOURCE_NOT_FOUND", ex.ResponseCode);
            } finally {
                Assert.IsTrue(exceptionCaught);
            }
        }
예제 #11
0
        // The used credentials on this test have not permissions to delete a tokenized card
        public void DeleteTokenizedPaymentMethod_WithRandomId()
        {
            var tokenizedCard = new CreditCardData {
                Token = "PMT_" + Guid.NewGuid()
            };

            Assert.IsFalse(tokenizedCard.DeleteToken());

            var exceptionCaught = false;

            try {
                tokenizedCard.Verify()
                .WithCurrency("USD")
                .Execute();
            }
            catch (GatewayException ex) {
                exceptionCaught = true;
                Assert.AreEqual("RESOURCE_NOT_FOUND", ex.ResponseCode);
                Assert.AreEqual("40116", ex.ResponseMessage);
                Assert.IsTrue(ex.Message.StartsWith("Status Code: NotFound - payment_method"));
            } finally {
                Assert.IsTrue(exceptionCaught);
            }
        }