public void CanVoidATransaction()
        {
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
            var createProfileResponse = cim.Create(_profileAttributes);

            _profileAttributes.GateWayId = createProfileResponse.Params["customerProfileId"];

            var createPaymentProfileResponse = cim.CreatePaymentProfile(_profileAttributes, _addressAttributes, _creditCardAttributes);

            _paymentProfileAttributes.GateWayId = createPaymentProfileResponse.Params["customerPaymentProfileId"].ToString();
            _paymentProfileAttributes.MaskedCreditCard = "XXXX" +
                _creditCardAttributes.CardNumber.Trim().Substring(_creditCardAttributes.CardNumber.Trim().Length - 4);

            var gateway = new Gateway(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);

            var createPaymentProfileTransactionResponse = gateway.Charge(_profileAttributes, _paymentProfileAttributes, _order);

            _transaction.GateWayId = createPaymentProfileTransactionResponse.Params["directResponseHash"]["PaymentGatewayTransactionId"];

            var voidResponse = gateway.Void(_profileAttributes, _paymentProfileAttributes, _transaction);

            Assert.IsTrue(voidResponse.Success);
            Assert.IsNotNull(voidResponse.Params["directResponseString"]);
            Assert.IsNotNull(voidResponse.Params["directResponseHash"]);
        }
        public void CanCreatePaymentProfile()
        {
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
            var createProfileResponse = cim.Create(_profileAttributes);

            _profileAttributes.GateWayId = createProfileResponse.Params["customerProfileId"];

            var createPaymentProfileResponse = cim.CreatePaymentProfile(_profileAttributes, _addressAttributes, _creditCardAttributes);

            Assert.IsTrue(createPaymentProfileResponse.Success);
            Assert.NotNull(createPaymentProfileResponse.Params["customerPaymentProfileId"].ToString());
        }
        public void CanCreatePaymentProfileTransactionAuthCapture()
        {
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
            var createProfileResponse = cim.Create(_profileAttributes);

            _profileAttributes.GateWayId = createProfileResponse.Params["customerProfileId"];

            var createPaymentProfileResponse = cim.CreatePaymentProfile(_profileAttributes, _addressAttributes, _creditCardAttributes);

            _paymentProfileAttributes.GateWayId = createPaymentProfileResponse.Params["customerPaymentProfileId"].ToString();

            var gateway = new Gateway(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);

            var createPaymentProfileTransactionResponse = gateway.Charge(_profileAttributes, _paymentProfileAttributes, _order);

            Assert.IsTrue(createPaymentProfileTransactionResponse.Success);
            Assert.IsNotNull(createPaymentProfileTransactionResponse.Params["directResponseString"]);
            Assert.IsNotNull(createPaymentProfileTransactionResponse.Params["directResponseHash"]);
        }
        public void CanUpdatePaymentProfile()
        {
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
            var createProfileResponse = cim.Create(_profileAttributes);

            _profileAttributes.GateWayId = createProfileResponse.Params["customerProfileId"];
            var createPaymentProfileResponse = cim.CreatePaymentProfile(_profileAttributes, _addressAttributes, _creditCardAttributes);
            _paymentProfileAttributes.GateWayId = createPaymentProfileResponse.Params["customerPaymentProfileId"];

            _profileAttributes.CustomerId = _profileAttributes.CustomerId + "chg";
            _profileAttributes.Email = "chg" + _profileAttributes.Email;

            var updateProfileresponse = cim.Update(_profileAttributes, _addressAttributes, _creditCardAttributes, _paymentProfileAttributes);

            Assert.IsTrue(updateProfileresponse.Success);
            Assert.IsNotNullOrEmpty(updateProfileresponse.Params["validationDirectResponse"]);
        }
        public void CanNotCreatePaymentProfileWithImproperInputData()
        {
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
            var createProfileResponse = cim.Create(_profileAttributes);

            _profileAttributes.GateWayId = createProfileResponse.Params["customerProfileId"];

            var createPaymentProfileResponse = cim.CreatePaymentProfile(_profileAttributes, new Mock<IAddressAttributes>().Object, _creditCardAttributes);

            Assert.IsFalse(createPaymentProfileResponse.Success);
            Assert.IsNotNull(createPaymentProfileResponse.Params["validationDirectResponseString"]);
        }
        public void CanGetPaymentProfile()
        {
            string expectedId;
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
            var createProfileResponse = cim.Create(_profileAttributes);

            _profileAttributes.GateWayId = createProfileResponse.Params["customerProfileId"];

            var createPaymentProfileResponse = cim.CreatePaymentProfile(_profileAttributes, _addressAttributes, _creditCardAttributes);

            _paymentProfileAttributes.GateWayId = createPaymentProfileResponse.Params["customerPaymentProfileId"];
            expectedId = createPaymentProfileResponse.Params["customerPaymentProfileId"];

            var getPaymentProfileResponse = cim.Get(_profileAttributes, _paymentProfileAttributes);
            Assert.IsTrue(getPaymentProfileResponse.Success);
            Assert.AreEqual(expectedId, getPaymentProfileResponse.Params["customerPaymentProfileId"].ToString());
        }