/// <summary> /// Creates the post request. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="connector">The connector.</param> /// <param name="paymentId">The payment id.</param> /// <returns></returns> private static string CreatePostRequest(ConfigurationProvider configuration, CrmConnector connector, lss_payment payment) { OrderProvider orderProvider = new OrderProvider(connector); ContactProvider contactProvider = new ContactProvider(connector); PaymentProvider paymentProvider = new PaymentProvider(connector); var order = orderProvider.GetOrder(payment.lss_orderid.Id); var contact = contactProvider.GetContact(order.CustomerId.Id); StringBuilder postRequest = new StringBuilder(); payment.lss_vendortxcode = CreateVendorTransactionCode(order.Name); // Save the record so the payment has a name payment.lss_name = "Payment: " + payment.lss_vendortxcode + " - £" + payment.lss_amount.Value.ToString("#.##"); paymentProvider.SavePayment(payment); // Check the Contact has the relevant details for a sucessful transaction if (String.IsNullOrEmpty(contact.FirstName) || String.IsNullOrEmpty(contact.LastName) || String.IsNullOrEmpty(contact.Address1_Line1) || String.IsNullOrEmpty(contact.Address1_City) || String.IsNullOrEmpty(contact.Address1_PostalCode)) { return("INVALIDCONTACT"); } postRequest.Append("VPSProtocol=2.23&TxType=PAYMENT&Vendor="); postRequest.Append(configuration.VendorName); postRequest.Append("&VendorTxCode=" + payment.lss_vendortxcode); postRequest.Append("&Amount=" + payment.lss_amount.Value.ToString("#.##")); postRequest.Append("&Currency=GBP"); postRequest.Append("&Description=" + order.Name); postRequest.Append("&NotificationURL=" + configuration.NotificationUrl); postRequest.Append(BuildContactDetails(contact)); postRequest.Append("&CustomerEMail=" + (String.IsNullOrEmpty(contact.EMailAddress1) ? String.Empty : contact.EMailAddress1.Trim())); postRequest.Append(BuildBasket(connector, orderProvider, order)); postRequest.Append("&AllowGiftAid=0&ApplyAVSCV2=0&Apply3DSecure=0&Profile=NORMAL&AccountType=M"); return(postRequest.ToString()); }
private static void Campagna(ContactProvider cp, TDictionary dic, ref string callMode, ref bool eof, PhonesCallData CcData, ArrayList phoneNums) { Boolean res = cp.Init(CampagnaId, NomeCampagna, dic); if (res) { Int32 contatti = cp.Contacts(); Console.WriteLine("CONTATTI: " + contatti); } int count = 0; eof = false; while (!eof)// finchè nn indico la fine { count++; res = cp.GetContact(CcData, phoneNums, out callMode, out eof); if (res) { // chiamata KO if (count == 1) { res = cp.SetContact(CcData, "2", "P"); } else if (count == 2) { // chiamata OK res = cp.SetContact(CcData, "3", "P"); } else { res = cp.SetContact(CcData, "2", "P"); } } } }