public void CanCreateCustomerShippingAddress()
        {
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);

            var createProfileResponse = cim.Create(_profileAttributes);
            _profileAttributes.GateWayId = createProfileResponse.Params["customerProfileId"];

            var createShippingAddressResponse = cim.Create(_profileAttributes, _addressAttributes);
            Assert.IsTrue(createShippingAddressResponse.Success);
            Assert.NotNull(createShippingAddressResponse.Params["customerAddressId"].ToString());
        }
예제 #2
0
        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 CanDeleteCustomerProfile()
        {
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
            var response = cim.Create(_profileAttributes);

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

            var deleteResponse = cim.Delete(_profileAttributes);
            Assert.IsTrue(deleteResponse.Success);
        }
 public void CanCreateCustomerProfile()
 {
     var random = new Random();
     var profileAttributes = ObjectMother.GetMockProfileAttributes(x =>
                                                     {
                                                         x.CustomerId = random.Next().ToString();
                                                         x.Email = "*****@*****.**";
                                                     });
     var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
     var response = cim.Create(profileAttributes);
     Assert.IsTrue(response.Success);
     Assert.NotNull(response.Params["customerProfileId"]);
 }
예제 #5
0
        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 CanUpdateCustomerProfile()
        {
            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
            var createProfileResponse = cim.Create(_profileAttributes);

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

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

            var updateCustomerProfileresponse = cim.Update(_profileAttributes);

            Assert.IsTrue(updateCustomerProfileresponse.Success);
        }
        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 CanNotCreateCustomerProfileWithImproperInputData()
 {
     var random = new Random();
     var profileAttributes = ObjectMother.GetMockProfileAttributes(x =>
     {
         x.CustomerId = random.Next().ToString() + "...blahbalhbalhbalhbalhbalh";
         x.Email = "*****@*****.**";
     });
     var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);
     var response = cim.Create(profileAttributes);
     Assert.IsFalse(response.Success);
     Assert.AreEqual("NO VALUE", response.Params.ToString());
 }
        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());
        }
        public void CanGetCustomerProfile()
        {
            var expectedDescrioption = _profileAttributes.CustomerId;
            var expectedEmail = _profileAttributes.Email;

            var cim = new CustomerInformationManager(TestHelper.TemplateFactory, ObjectMother.TestAuthentication);

            var createProfileResponse = cim.Create(_profileAttributes);
            _profileAttributes.GateWayId = createProfileResponse.Params["customerProfileId"];

            var getProfileResponse = cim.Get(_profileAttributes);
            Assert.IsTrue(getProfileResponse.Success);
            Assert.AreEqual(expectedDescrioption, getProfileResponse.Params["Description"].ToString());
            Assert.AreEqual(expectedEmail, getProfileResponse.Params["Email"].ToString());
        }