Esempio n. 1
0
        private BusinessPartnerResponse ParseCustomerQuery(CustomerResponseMessage_sync sapResponse)
        {
            BusinessPartnerResponse response = new BusinessPartnerResponse();
            BaseResponse            tempRes  = SapLogParser.ParseSapResponseLog(sapResponse.Log);

            response.Errors   = tempRes.Errors;
            response.Warnings = tempRes.Warnings;

            if (sapResponse.Customer != null)
            {
                response.BpExternalId    = sapResponse.Customer[0].InternalID;
                response.CustomerDetails = new AccountTypeDetails();

                if (sapResponse.Customer[0].SalesArrangement != null)
                {
                    response.CustomerDetails.CurrencyID    = sapResponse.Customer[0].SalesArrangement[0].CurrencyCode;
                    response.CustomerDetails.PaymentTermID = sapResponse.Customer[0].SalesArrangement[0].CashDiscountTermsCode != null ?
                                                             sapResponse.Customer[0].SalesArrangement[0].CashDiscountTermsCode.Value : null;

                    if (sapResponse.Customer[0].PaymentData != null && sapResponse.Customer[0].PaymentData[0].CreditLimitAmount != null)
                    {
                        response.CustomerDetails.CreditLimit = sapResponse.Customer[0].PaymentData[0].CreditLimitAmount.Value;
                    }
                }
            }

            return(response);
        }
Esempio n. 2
0
        public void SetLocationAndContactIds(AccountDetailsResponse returnResponse, CustomerResponseMessage_sync queryResponse)
        {
            if (queryResponse.Customer[0].AddressInformation != null)
            {
                returnResponse.LocationExternalIds = new List <string>();
                int locationCount = queryResponse.Customer[0].AddressInformation.Length;
                for (int i = 0; i < locationCount; i++)
                {
                    returnResponse.LocationExternalIds.Add(queryResponse.Customer[0].AddressInformation[i].UUID.Value);
                }
            }

            if (queryResponse.Customer[0].ContactPerson != null)
            {
                returnResponse.ContactExternalIds = new List <string>();
                int contactCount = queryResponse.Customer[0].ContactPerson.Length;
                for (int i = 0; i < contactCount; i++)
                {
                    returnResponse.ContactExternalIds.Add(queryResponse.Customer[0].ContactPerson[i].BusinessPartnerContactInternalID);
                }
            }
        }