예제 #1
0
 /// <summary>
 /// Send business change request to settlement service
 /// </summary>
 /// <param name="newProvider">NewProvider</param>
 /// <returns>true if request succeeds,false otherwise</returns>
 public bool SendStoreBusinessChangeRequest(NewProvider newProvider)
 {
     return serviceProxy.StoreNewProvider(newProvider);
 }
예제 #2
0
        /// <summary>
        /// Set contact information on NewProvider Model
        /// </summary>
        /// <param name="provider">NewProvider</param>
        /// <param name="business">business</param>
        /// <param name="primaryContact">primaryContact</param>
        /// <param name="settlementBankAccount">settlementBankAccount</param>
        private void SetBusinessInfoOnNewProviderModel(NewProvider provider, Model.Business.Business business, BusinessContactPerson primaryContact, BankAccount settlementBankAccount)
        {

            Helper.ArgumentNotNull(provider, "provider");
            Helper.ArgumentNotNull(business, "business");
            Country countryOfBusiness = countryDao.GetByBusiness(business.Id);

            provider.NewProviderId = Helper.LongToGuid(business.Id).ToString();
            provider.ContactInformation = CreateContactInformation(business);
            provider.ModificationDate = business.UpdatedDateTime;
            provider.RefCode = business.ReferenceCode;
            provider.ShortName = business.ShortName;
            provider.FullName = business.Name;
            provider.MerchantId = settlementHelper.GetMerchantIdForNewProviderModel(business).Result;
            provider.AccountHolder = primaryContact != null ? GetAccountHolder(primaryContact) : string.Empty;
            provider.TaxStatus = business.IsTaxRegistered;

            provider.BankSortCode = GetBankSortCode(countryOfBusiness, settlementBankAccount);
            provider.BankAccountNumber = GetBankAccountNumber(countryOfBusiness, settlementBankAccount);
            provider.BankAccountName = settlementBankAccount != null ? settlementBankAccount.AccountName : null;

            provider.SupplyPartnerReferenceCode = SUPPLY_PARTNER_ID;
            provider.SupplyPartner = SUPPLY_PARTNER_ID;
            provider.Status = GetProviderStatus(business.BusinessStatus.Code);
            provider.IsMerchant = business.MerchantStatusEnum == MerchantStatusEnum.OwnMerchant;

        }
예제 #3
0
        /// <summary>
        /// Set settlement ActivationDate / InactivationDate
        /// </summary>
        /// <param name="provider">NewProvider</param>
        /// <param name="business">Business</param>
        /// <param name="businessStatusEvent">BusinessEvent</param>
        private void SetActiveInActiveDates(NewProvider provider, Model.Business.Business business, BusinessEvent businessStatusEvent)
        {
            Helper.ArgumentNotNull(provider, "provider");
            Helper.ArgumentNotNull(business, "business");
            Helper.ArgumentNotNull(businessStatusEvent, "businessStatusEvent");

            if (business.BusinessStatus != null)
            {
                if (business.BusinessStatus.Code == BusinessStatus.ACTIVE)
                {
                    provider.ActivationDate = businessStatusEvent.Created;
                }

                if (business.BusinessStatus.Code == BusinessStatus.DORMANT)
                {
                    provider.InactivationDate = businessStatusEvent.Created;
                }
            }
        }
예제 #4
0
        /// <summary>
        ///  Create a settlement NewProvider model for business change Request
        /// </summary>
        /// <param name="businessId"></param>
        /// <returns>NewProvider</returns>
        public NewProvider CreateNewProviderModelForBusinessChange(long businessId)
        {
            // check that there is a business
            Helper.ArgumentNotNull(businessId, "businessId");

            // get data from Eagle database
            var business = businessDao.GetByKey(businessId);
            var contactPersons = businessDao.GetContacts(businessId);
            var primaryContact = contactPersons.SingleOrDefault(c => c.IsPrimary);
            var settlementBankAccount = business.SettlementBankAccountId.HasValue
                ? businessDao.GetBankAccount(business.SettlementBankAccountId.Value)
                : null;
            var businessStatusEvent = businessDao.GetLatestBusinessStatusEvent(businessId);
         
            var provider = new NewProvider();

            // set retrieved data on settlement new provider
            SetBusinessInfoOnNewProviderModel(provider, business, primaryContact, settlementBankAccount);
            SetActiveInActiveDates(provider, business, businessStatusEvent);
         
            return provider;
        }