protected void SetupContacts()
        {
            CrudProxy contact = new ContactProxy();

            this.MrSmith = new ContactDto();
            this.MrSmith.Salutation = Salutation.Mr;
            this.MrSmith.GivenName = "John";
            this.MrSmith.FamilyName = "Smith";
            this.MrSmith.OrganisationName = "ACME Pty Ltd";
            contact.Insert(this.MrSmith);

            this.MrsSmith = new ContactDto();
            this.MrsSmith.Salutation = Salutation.Mrs;
            this.MrsSmith.GivenName = "Mary";
            this.MrsSmith.FamilyName = "Smith";
            this.MrsSmith.OrganisationName = "ACME Pty Ltd";
            contact.Insert(this.MrsSmith);
        }
Example #2
0
        private void CreateTestContacts()
        {
            //Billing contact.
            var response = new ContactsProxy().GetContacts(givenName: "TestAPIInvoice", familyName: "BillingContact");

            if (response.DataObject.Contacts.Count == 0)
            {
                var dto = new Ola.RestClient.Dto.ContactDto
                {
                    GivenName  = "TestAPIInvoice",
                    FamilyName = "BillingContact",
                    Email      = "*****@*****.**"
                };

                Ola.RestClient.Proxies.CrudProxy proxy = new Ola.RestClient.Proxies.ContactProxy();
                proxy.Insert(dto);
            }
            response = new ContactsProxy().GetContacts(givenName: "TestAPIInvoice", familyName: "BillingContact");

            _BillingContactId = response.DataObject.Contacts[0].Id.Value;


            //Shipping contact.
            response = new ContactsProxy().GetContacts(givenName: "TestAPIInvoice", familyName: "ShippingContact");

            if (response.DataObject.Contacts.Count == 0)
            {
                var dto = new Ola.RestClient.Dto.ContactDto
                {
                    GivenName  = "TestAPIInvoice",
                    FamilyName = "ShippingContact"
                };

                Ola.RestClient.Proxies.CrudProxy proxy = new Ola.RestClient.Proxies.ContactProxy();
                proxy.Insert(dto);
            }

            response           = new ContactsProxy().GetContacts(givenName: "TestAPIInvoice", familyName: "ShippingContact");
            _ShippingContactId = response.DataObject.Contacts[0].Id.Value;
        }
        private void CreateTestContacts()
        {
            //Billing contact.
            var response = new ContactsProxy().GetContacts(givenName: "TestAPIInvoice", familyName: "BillingContact");

            if (response.DataObject.Contacts.Count == 0)
            {
                var dto = new Ola.RestClient.Dto.ContactDto
                    {
                        GivenName = "TestAPIInvoice",
                        FamilyName = "BillingContact"
                    };

                Ola.RestClient.Proxies.CrudProxy proxy = new Ola.RestClient.Proxies.ContactProxy();
                proxy.Insert(dto);
            }
            else
            {
                _BillingContactId = response.DataObject.Contacts[0].Id.Value;
            }

            //Shipping contact.
            response = new ContactsProxy().GetContacts(givenName: "TestAPIInvoice", familyName: "ShippingContact");

            if (response.DataObject.Contacts.Count == 0)
            {
                var dto = new Ola.RestClient.Dto.ContactDto
                {
                    GivenName = "TestAPIInvoice",
                    FamilyName = "ShippingContact"
                };

                Ola.RestClient.Proxies.CrudProxy proxy = new Ola.RestClient.Proxies.ContactProxy();
                proxy.Insert(dto);
            }
            else
            {
                _ShippingContactId = response.DataObject.Contacts[0].Id.Value;
            }
        }
        private static void AssertEqual(ContactDto expected, ContactDto actual, bool checkTags)
        {
            Assert.AreEqual(expected.Uid, actual.Uid, "Different Uid.");
            Assert.AreEqual(expected.Salutation, actual.Salutation, "Different Salutation.");
            Assert.AreEqual(expected.GivenName, actual.GivenName, "Different GivenName.");
            Assert.AreEqual(expected.MiddleInitials, actual.MiddleInitials, "Different MiddleInitials.");
            Assert.AreEqual(expected.FamilyName, actual.FamilyName, "Different FamilyName.");
            Assert.AreEqual(expected.OrganisationName, actual.OrganisationName, "Different OrganisationName.");
            Assert.AreEqual(expected.OrganisationPosition, actual.OrganisationPosition, "Different OrganisationPosition.");
            Assert.AreEqual(expected.WebsiteUrl, actual.WebsiteUrl, "Different WebsiteUrl.");
            Assert.AreEqual(expected.Email, actual.Email, "Different Email.");
            Assert.AreEqual(expected.MainPhone, actual.MainPhone, "Different MainPhone.");
            Assert.AreEqual(expected.OtherPhone, actual.OtherPhone, "Different OtherPhone.");
            // No longer supported.
            //Assert.AreEqual(expected.StatusUid, actual.StatusUid, "Different StatusUid.");
            //Assert.AreEqual(expected.IndustryUid, actual.IndustryUid, "Different IndustryUid.");
            AssertEqual(expected.PostalAddress, actual.PostalAddress);
            Assert.AreEqual(expected.IsActive, actual.IsActive, "Different IsActive.");

            Assert.AreEqual(expected.AcceptDirectDeposit, actual.AcceptDirectDeposit, "Different AcceptDirectDeposit.");
            Assert.AreEqual(expected.DirectDepositBankName, actual.DirectDepositBankName, "Different DirectDepositBankName.");
            Assert.AreEqual(expected.DirectDepositAccountName, actual.DirectDepositAccountName, "Different direct deposit account name.");
            Assert.AreEqual(expected.DirectDepositBsb, actual.DirectDepositBsb, "Different Bsb.");
            Assert.AreEqual(expected.DirectDepositAccountNumber, actual.DirectDepositAccountNumber, "Different direct deposit account number.");
            Assert.AreEqual(expected.AcceptCheque, actual.AcceptCheque, "Different accept cheque.");
            Assert.AreEqual(expected.ChequePayableTo, actual.ChequePayableTo, "Different cheque payable to.");
            Assert.AreEqual(expected.AutoSendStatement, actual.AutoSendStatement, "Different auto send statement.");

            Assert.AreEqual(expected.IsPartner, actual.IsPartner, "Different IsPartner.");
            Assert.AreEqual(expected.IsCustomer, actual.IsCustomer, "Different IsCustomer.");
            Assert.AreEqual(expected.IsSupplier, actual.IsSupplier, "Different IsSupplier.");

            Assert.AreEqual(expected.LinkedInPublicProfile, actual.LinkedInPublicProfile, "Different LinkedInProfile.");
            Assert.AreEqual(expected.SaleTradingTermsPaymentDueInInterval, actual.SaleTradingTermsPaymentDueInInterval, "Different SaleTradingTermsPaymentDueInInterval.");
            Assert.AreEqual(expected.SaleTradingTermsPaymentDueInIntervalType, actual.SaleTradingTermsPaymentDueInIntervalType, "Different SaleTradingTermsPaymentDueInIntervalType.");

            Assert.AreEqual(expected.PurchaseTradingTermsPaymentDueInInterval, actual.PurchaseTradingTermsPaymentDueInInterval, "Different PurchaseTradingTermsPaymentDueInInterval.");
            Assert.AreEqual(expected.PurchaseTradingTermsPaymentDueInIntervalType, actual.PurchaseTradingTermsPaymentDueInIntervalType, "Different PurchaseTradingTermsPaymentDueInIntervalType.");
            Assert.AreEqual(expected.DefaultSaleDiscount, actual.DefaultSaleDiscount, "Different Sale Discount");

            Assert.AreEqual(expected.ContactType, actual.ContactType, "Diff. contact type.");
        }
 private void AddCarl()
 {
     CrudProxy proxy = new ContactProxy();
     ContactDto dto = new ContactDto();
     dto.Salutation = "Mr.";
     dto.GivenName = "Carl";
     dto.FamilyName = "O'Neil";
     dto.OrganisationName = "O'Neil Capital";
     dto.ContactID = "GLD879";
     dto.CustomField1 = "O'Neil";
     proxy.Insert(dto);
     Assert.IsTrue(dto.Uid > 0, "Incorrect uid post save.");
 }
        public ContactDto GetContactInvalidAbn()
        {
            ContactDto dto = new ContactDto();
            dto.Salutation = "Mr.";
            dto.GivenName = "John";
            dto.FamilyName = "Smith";
            dto.OrganisationName = "Invalid ABN Contact Org" + DateTime.UtcNow.ToString();
            dto.OrganisationPosition = "Director";
            dto.OrganisationAbn = "ABC123";
            dto.Email = "*****@*****.**";
            dto.MainPhone = "02 9999 9999";
            dto.MobilePhone = "0444 444 444";

            AddressDto address = new AddressDto();
            address.Street = "3/33 Victory Av";
            address.City = "North Sydney";
            address.State = "NSW";
            address.Country = "Australia";

            dto.PostalAddress = address;

            return dto;
        }
 private static void AssertEqual(ContactDto expected, ContactDto actual)
 {
     AssertEqual(expected, actual, false);
 }
 public ContactDto GetContact4()
 {
     ContactDto dto = new ContactDto();
     dto.Salutation = "Mr.";
     dto.GivenName = "James";
     dto.FamilyName = "Bond";
     dto.OrganisationName = "007 Enterprise";
     dto.Tags = "Entertainment, Famous Person";
     return dto;
 }
        public ContactDto GetContact3()
        {
            ContactDto dto = new ContactDto();
            dto.Salutation = Salutation.Mr;
            dto.GivenName = "Lex";
            dto.FamilyName = "Luthor";
            dto.OrganisationName = "Luthor Corp";
            dto.OrganisationPosition = "Director";
            dto.Email = "*****@*****.**";
            dto.MainPhone = "02 4444 4444";
            dto.MobilePhone = "0444 444 444";

            dto.IsActive = true;

            dto.AcceptDirectDeposit = true;
            dto.DirectDepositAccountName = "HSBC Australia";
            dto.DirectDepositBsb = "123456";
            dto.DirectDepositAccountNumber = "12345-343";
            dto.AcceptCheque = true;
            dto.ChequePayableTo = "123 Corp";

            return dto;
        }
        public ContactDto GetContact2()
        {
            ContactDto dto = new ContactDto();
            dto.Salutation = Salutation.Mrs;
            dto.GivenName = "Mary";
            dto.FamilyName = "Smith";
            dto.OrganisationName = "Mr. & Mrs. Smith";
            dto.OrganisationPosition = "Director";
            dto.Email = "*****@*****.**";
            dto.MainPhone = "02 4444 4444";
            dto.MobilePhone = "0444 444 444";

            return dto;
        }
        public ContactDto GetContact1()
        {
            ContactDto dto = new ContactDto();
            dto.Salutation = "Mr.";
            dto.GivenName = "Gawe";
            dto.FamilyName = "Jannie";
            dto.OrganisationName = "ACME Pty Ltd";
            dto.OrganisationPosition = "Director";
            dto.Email = "*****@*****.**";
            dto.MainPhone = "02 9999 9999";
            dto.MobilePhone = "0444 444 444";

            AddressDto address = new AddressDto();
            address.Street = @"3/33 Victory
            Av";
            address.City = "North Sydney";
            address.State = "NSW";
            address.Country = "Sydney";

            AddressDto otherAddres = new AddressDto();
            otherAddres.Street = "111 Elizabeth street";
            otherAddres.City = "Sydney";
            otherAddres.State = "NSW";
            otherAddres.Country = "United States";

            dto.PostalAddress = address;
            dto.OtherAddress = otherAddres;
            dto.AutoSendStatement = true;

            dto.CompanyEmail = "*****@*****.**";
            dto.IsCustomer = true;

            dto.SaleTradingTermsPaymentDueInInterval = 7;
            dto.SaleTradingTermsPaymentDueInIntervalType = (int)TimeIntervalType.Day;

            dto.PurchaseTradingTermsPaymentDueInInterval = 2;
            dto.PurchaseTradingTermsPaymentDueInIntervalType = (int)TimeIntervalType.Week;

            return dto;
        }
 private ContactDto GetBillingContact()
 {
     ContactDto contact = new ContactDto();
     contact.Salutation = "Mr.";
     contact.GivenName = "Jusa";
     contact.FamilyName = "Chin";
     contact.OrganisationName = "Quick Pic Pty Ltd";
     contact.PostalAddress.Street = "1/111 Elizabeth St";
     contact.PostalAddress.City = "Sydney";
     contact.PostalAddress.State = "NSW";
     contact.PostalAddress.PostCode = "2220";
     contact.PostalAddress.Country = "Australia";
     contact.MainPhone = "1300 360 733";
     contact.Email = "*****@*****.**";
     return contact;
 }