void TestCorrSOA()
        {
            var client = new CorrespondenceAgencyExternalECClient("ST01");
            var corr   = new InsertCorrespondenceV2();

            corr.ServiceCode    = "123";
            corr.ServiceEdition = "1";
            var x = client.InsertCorrespondenceEC(SOA1User, SOA2Pass, "123", "test123", corr);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new Correspondence with example values. Values are defined in SendInCorrespondence.config file.
        /// </summary>
        /// <returns></returns>
        public static InsertCorrespondenceV2 CreateCorrespondence(string archiveReference, string reportee)
        {
            InsertCorrespondenceV2 correspondence = new InsertCorrespondenceV2();

            correspondence.ServiceCode               = ConfigurationManager.AppSettings["serviceCode"];
            correspondence.ServiceEdition            = ConfigurationManager.AppSettings["serviceEdition"];
            correspondence.Reportee                  = reportee;
            correspondence.VisibleDateTime           = DateTime.Parse(ConfigurationManager.AppSettings["visibleDateTime"]);
            correspondence.AllowSystemDeleteDateTime = DateTime.Parse(ConfigurationManager.AppSettings["allowSystemDeleteDateTime"]);
            correspondence.DueDateTime               = DateTime.Parse(ConfigurationManager.AppSettings["dueDateTime"]);
            correspondence.ArchiveReference          = archiveReference;

            correspondence.Content = new ExternalContentV2
            {
                LanguageCode   = ConfigurationManager.AppSettings["languageCode"],
                MessageTitle   = "Title",
                MessageSummary = "Summary text",
                MessageBody    = "Body text",
            }
            ;

            correspondence.Notifications = new NotificationBEList
            {
                new Notification1
                {
                    FromAddress       = ConfigurationManager.AppSettings["fromAddress"],
                    ShipmentDateTime  = DateTime.Parse(ConfigurationManager.AppSettings["shipmentDateTime"]),
                    LanguageCode      = ConfigurationManager.AppSettings["languageCode"],
                    NotificationType  = ConfigurationManager.AppSettings["notificationTemplate"],
                    ReceiverEndPoints = new ReceiverEndPointBEList
                    {
                        new ReceiverEndPoint
                        {
                            TransportType   = TransportType.Email,
                            ReceiverAddress = ConfigurationManager.AppSettings["epost"],
                        },
                        new ReceiverEndPoint
                        {
                            TransportType   = TransportType.SMS,
                            ReceiverAddress = ConfigurationManager.AppSettings["mobilePhone"],
                        }
                    }
                }
            };

            return(correspondence);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Uses the ICorrespondenceAgencyExternalBasic web service for sending a correspondence
 /// </summary>
 /// <param name="systemUserName">User name for the system</param>
 /// <param name="systemPassword">System password</param>
 /// <param name="systemUserCode">User code for the system</param>
 /// <param name="externalShipmentReferece">Unique value to identify the shipment</param>
 /// <param name="correspondence">Correspondence to send</param>
 public static void SendCorrespondence(string systemUserName, string systemPassword, string systemUserCode, string externalShipmentReferece, InsertCorrespondenceV2 correspondence)
 {
     try
     {
         using (CorrespondenceAgencyExternalBasicClient client = new CorrespondenceAgencyExternalBasicClient())
         {
             var receipt = client.InsertCorrespondenceBasicV2(systemUserName, systemPassword, systemUserCode, externalShipmentReferece, correspondence);
             if (receipt.ReceiptStatusCode == ReceiptStatusEnum.OK)
             {
                 Logger.Log($"Correspondence sent successfully for reportee: {correspondence.Reportee} and reference: {correspondence.ArchiveReference}", false, EventLogEntryType.Information);
             }
             else
             {
                 Logger.Log($"Failed to send correspondence for reportee: {correspondence.Reportee} and reference: {correspondence.ArchiveReference}");
                 throw new Exception($"Error while sending correspondence: {receipt.ReceiptStatusCode}, {receipt.ReceiptText}");
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Log($"Failed to send correspondence for reportee: {correspondence.Reportee} and reference: {correspondence.ArchiveReference}, message: {exception.Message}");
         throw;
     }
 }