public static IAccountStatusResponse GetAccountStatus(IAccountStatusRequest request, ILogger logger = null) { string message; IAccountStatusResponse accountStatusResponse; try { EwsLabelService client = new EwsLabelService(); accountStatusResponse = AccountStatusClass.ConstructAccountStatusResponse(client.GetAccountStatus(AccountStatusClass.ConstructAccountStatusRequest(request))); } catch (BadRequestException badRequestException) { message = string.Format("Endicia::Invoker::GetAccountStatus Failed({0}).", badRequestException.Message); Logger.ExternalLogDebug(logger, message); throw; } catch (Exception exception) { Exception ex = exception; message = string.Format("Endicia::Invoker::GetAccountStatus Failed({0}).", ex.Message); Logger.ExternalLogDebug(logger, message); throw new Exception(message, ex); } return(accountStatusResponse); }
internal static IAccountStatusResponse ConstructAccountStatusResponse(TSI.Utils.Shipping.Endicia.EndiciaLabelService.AccountStatusResponse response) { TSI.Utils.Shipping.Endicia.AccountStatusResponse result = new TSI.Utils.Shipping.Endicia.AccountStatusResponse(); if (response.Status != 0) { throw new BadRequestException(response.Status, response.ErrorMessage); } result.AccountStatus = AccountStatusClass.ParseAccountStatus(response.CertifiedIntermediary.AccountStatus); result.AccountBalanceUSD = response.CertifiedIntermediary.PostageBalance; return(result); }
internal static IBuyPostageResponse ConstructBuyPostageResponse(RecreditRequestResponse response) { BuyPostageResponse result = new BuyPostageResponse(); if (response.Status == 0) { result.RecreditStatus = TransactionResultEnum.Succeed; result.AccountStatus = AccountStatusClass.ParseAccountStatus(response.CertifiedIntermediary.AccountStatus); result.AccountBalanceUSD = response.CertifiedIntermediary.PostageBalance; } else { result.ErrorMessage = response.ErrorMessage; result.RecreditStatus = TransactionResultEnum.Failed; } return(result); }