Exemple #1
0
        public static void SendDocumentToSign(Customer pCustomer, Offer pOffer)
        {
            var loAsset           = GetData.GetAssetById(pOffer.asset_uuid.ToString());
            var loCompany         = GetData.GetBankById(loAsset.bank_guid.ToString());
            var loSendToSignModel = new SendToSign
            {
                document_to_sign = new DocumentToSign
                {
                    participant_guid         = Common.MespactWinvestateUser,
                    document_type_guid       = loCompany.mespact_agreement_uuid.ToString(),
                    erp_id                   = pOffer.agreement_uuid.ToString(),
                    participant_callback_url = Common.CallbackUrl
                },
                document_sign_flows = new List <DocumentSignFlow>()
            };

            var loSignFlow = new DocumentSignFlow
            {
                participant_name    = pCustomer.customer_name,
                participant_surname = pCustomer.customer_surname,
                identity_number     = pCustomer.identity_no,
                mail                     = pCustomer.mail,
                phone_number             = SerializePhone(pCustomer.phone),
                user_type_system_type_id = pCustomer.user_type_system_type_id == 2 ? 1 : 4,
                document_template_key    = ((int)ThkAgreement.ThkSatisSartname.Imzaci).ToString()
            };

            loSendToSignModel.document_sign_flows.Add(loSignFlow);


            if (loCompany.company_prefix == "THK")
            {
                loSendToSignModel.document_templates = GetThkAgreementTemplateValues(loAsset, pCustomer);
            }
            else //if (loCompany.company_prefix == "VST")
            {
                loSendToSignModel.document_templates = GetVstAgreementTemplateValues(loAsset, pCustomer, pOffer);
            }


            var loResult = RestCalls.SendCustomerAgreement(loSendToSignModel);

            if (loResult.Code == 200)
            {
                var loSendToSign    = JsonConvert.DeserializeObject <SendToSign>(loResult.Data.ToString());
                var loOfferToUpdate = GetData.GetOfferById(pOffer.row_guid.ToString());
                loOfferToUpdate.mespact_session_uuid = loSendToSign.document_to_sign.row_guid;
                Crud <Offer> .Update(loOfferToUpdate, out _);
            }
        }
Exemple #2
0
        public static GenericResponseModel SendCustomerAgreement(SendToSign pSendToSignModel)
        {
            var client  = new RestClient(_mespactApiUrl + "/Document/SendToSign");
            var request = new RestRequest(Method.POST);

            request.AddHeader("Authorization", "Bearer " + GetMespactToken());
            request.AddHeader("Content-Type", "application/json");
            request.RequestFormat = DataFormat.Json;

            var loModel = JsonConvert.SerializeObject(pSendToSignModel);

            request.AddJsonBody(loModel);
            //var responseData = client.Execute(request).Content;
            var result          = client.Execute(request);
            var loGenericResult = JsonConvert.DeserializeObject <GenericResponseModel>(result.Content);

            return(loGenericResult);
        }