Esempio n. 1
0
        public static IBuyPostageResponse BuyPostage(IBuyPostageRequest request, ILogger logger = null)
        {
            string message;
            IBuyPostageResponse buyPostageResponse;

            try
            {
                EwsLabelService client = new EwsLabelService();
                buyPostageResponse = BuyPostageClass.ConstructBuyPostageResponse(client.BuyPostage(BuyPostageClass.ConstructBuyPostageRequest(request)));
            }
            catch (BadRequestException badRequestException)
            {
                message = string.Format("Endicia::Invoker::BuyPostage Failed({0}).", badRequestException.Message);
                Logger.ExternalLogDebug(logger, message);
                throw;
            }
            catch (Exception exception)
            {
                Exception ex = exception;
                message = string.Format("Endicia::Invoker::BuyPostage Failed({0}).", ex.Message);
                Logger.ExternalLogDebug(logger, message);
                throw new Exception(message, ex);
            }
            return(buyPostageResponse);
        }
Esempio n. 2
0
        internal static RecreditRequest ConstructBuyPostageRequest(IBuyPostageRequest request)
        {
            RecreditRequest result = new RecreditRequest()
            {
                RequesterID           = ToolsClass.GetRequesterID,
                RequestID             = ToolsClass.GetRequestID,
                RecreditAmount        = request.Amount.ToString(),
                CertifiedIntermediary = new CertifiedIntermediary()
                {
                    AccountID  = request.AccountID,
                    PassPhrase = request.PassPhrase
                }
            };

            Logger.InternalLogDebug(string.Format("BuyPostageClass::ConstructBuyPostageRequest -> AccountID {0} RequestGuid {1} RequesterID {2} ", result.CertifiedIntermediary.AccountID, result.RequestID, result.RequesterID));
            return(result);
        }