Exemple #1
0
 LoyaltyResponse UploadInvoiceTransactionToCloud(string inSyndicateCode, ApiMemberInvoiceTransactionViewModel transaction)
 {
     try
     {
         ILoyaltymateService loyaltymateService = new LoyaltymateService();
         var response = loyaltymateService.PostInvoiceTransaction(transaction, inSyndicateCode);
         if (response)
         {
             return(CreateResponseNoError());
         }
         else
         {
             return(CreateResponseError(
                        "@Failed to post member transaction to server",
                        "",
                        LoyaltyResponseCode.PostTransactionFailed));
         }
     }
     catch (AuthenticationFailedException ex)
     {
         return(CreateResponseError(
                    @"Failed to Authenticate",
                    ex.Message,
                    LoyaltyResponseCode.AuthenticationFailed));
     }
     catch (Exception ex)
     {
         return(CreateResponseError(
                    "@Failed to post member transaction to server",
                    ex.Message,
                    LoyaltyResponseCode.PostTransactionFailed));
     }
 }
Exemple #2
0
        public bool PostInvoiceTransaction(ApiMemberInvoiceTransactionViewModel pointsTransaction, string syndicateCode)
        {
            bool response = false;
            var  request  = Utility.WebUtility.CreateRequest(RequestAddress.PostInvoiceTransaction, syndicateCode, null,
                                                             WebRequestMethods.Http.Post, pointsTransaction);
            HttpWebResponse webResponse = null;

            try
            {
                webResponse = (HttpWebResponse)request.GetResponse();
            }
            catch (WebException we)
            {
                webResponse = (HttpWebResponse)we.Response;
                HandleExceptions(webResponse);
                return(false);
            }
            finally
            {
                if (webResponse != null)
                {
                    webResponse.Close();
                    response = true;
                }
            }
            return(response);
        }