Exemple #1
0
 private void processResponseOnExport(ClientResponse response, ExchangeContext context)
     throws Exception {
   context.setVariable("smevPool", false);
   String exportType = getStringFromContext(context, "exportRequestType", "");
   addAdditionalXmlSchema(response, exportType);
   ExportDataResponse exportDataResponse =
       (ExportDataResponse)
           new XmlTypes(ExportDataResponse.class).toBean(response.appData.getFirstChild());
   if (exportDataResponse.getResponseTemplate().getRequestProcessResult() != null) {
     context.setVariable("responseSuccess", false);
     String errorCode =
         exportDataResponse.getResponseTemplate().getRequestProcessResult().getErrorCode();
     processInternalErrorService(context, errorCode);
     context.setVariable("requestProcessResultErrorCode", errorCode);
     context.setVariable(
         "requestProcessResultErrorDescription",
         exportDataResponse.getResponseTemplate().getRequestProcessResult().getErrorDescription());
   } else {
     context.setVariable("responseSuccess", true);
     if ("QUITTANCE".equals(exportType)) {
       processExportQuittanceResponse(context, exportDataResponse);
     } else if (Arrays.asList("CHARGE", "CHARGESTATUS", "CHARGENOTFULLMATCHED")
         .contains(exportType)) {
       processExportChargeResponse(context, exportDataResponse);
     } else if (Arrays.asList("PAYMENT", "PAYMENTMODIFIED", "PAYMENTUNMATCHED")
         .contains(exportType)) {
       processExportPaymentResponse(context, exportDataResponse);
     } else {
       throw new IllegalArgumentException("Unknown export type " + exportType);
     }
   }
 }
Exemple #2
0
 private void processExportQuittanceResponse(
     ExchangeContext context, ExportDataResponse exportDataResponse) {
   ExportQuittanceResponse exportQuittanceResponse =
       (ExportQuittanceResponse) exportDataResponse.getResponseTemplate();
   List<ExportQuittanceResponse.Quittances.Quittance> quittanceList =
       exportQuittanceResponse.getQuittances() != null
           ? exportQuittanceResponse.getQuittances().getQuittance()
           : Arrays.<ExportQuittanceResponse.Quittances.Quittance>asList();
   context.setVariable("quittance", (long) quittanceList.size());
   // context.setVariable("-quittance", "");
   for (int idx = 0; idx < quittanceList.size(); idx++) {
     int blockIndex = idx + 1;
     ExportQuittanceResponse.Quittances.Quittance quittance = quittanceList.get(idx);
     context.setVariable("quittanceIsRevoked_" + blockIndex, quittance.isIsRevoked());
     context.setVariable("quittanceSupplierBillID_" + blockIndex, quittance.getSupplierBillID());
     context.setVariable("quittancePayerIdentifier_" + blockIndex, quittance.getPayerIdentifier());
     context.setVariable("quittanceBalance_" + blockIndex, quittance.getBalance());
     context.setVariable("quittanceBillStatus_" + blockIndex, quittance.getBillStatus());
     PaymentIdentificationDataType paymentIdentificationData =
         quittance.getPaymentIdentificationData();
     if (paymentIdentificationData != null) {
       context.setVariable(
           "quittanceSystemIdentifier_" + blockIndex,
           paymentIdentificationData.getSystemIdentifier());
       context.setVariable(
           "quittanceBankBIK_" + blockIndex, paymentIdentificationData.getBank().getBIK());
       context.setVariable(
           "quittanceBankName_" + blockIndex, paymentIdentificationData.getBank().getName());
       context.setVariable(
           "quittanceBankCorrAccount_" + blockIndex,
           paymentIdentificationData.getBank().getCorrespondentBankAccount());
       context.setVariable(
           "quittanceBankSWIFT_" + blockIndex, paymentIdentificationData.getBank().getSWIFT());
     } else {
       PaymentIdentificationDataType incomeRowIdentificationData =
           quittance.getIncomeRowIdentificationData();
       if (incomeRowIdentificationData != null) {
         context.setVariable(
             "quittanceUFKName_" + blockIndex, incomeRowIdentificationData.getUFK());
       }
     }
     context.setVariable("quittanceApplicationId_" + blockIndex, quittance.getApplicationID());
     context.setVariable("payeeINN_" + blockIndex, quittance.getPayeeINN());
     context.setVariable("payeeKPP_" + blockIndex, quittance.getPayeeKPP());
     context.setVariable("KBK_" + blockIndex, quittance.getKBK());
     context.setVariable("OKATO_" + blockIndex, quittance.getOKATO());
   }
 }
Exemple #3
0
 private void processExportChargeResponse(
     ExchangeContext context, ExportDataResponse exportDataResponse) throws Exception {
   ExportChargesResponse exportResponse =
       (ExportChargesResponse) exportDataResponse.getResponseTemplate();
   if (exportResponse.getCharges() != null) {
     List<ExportChargesResponse.Charges.ChargeInfo> charges =
         exportResponse.getCharges().getChargeInfo();
     context.setVariable("chargeBlock", (long) charges.size());
     for (int idx = 0; idx < charges.size(); idx++) {
       int blockIndex = idx + 1;
       ExportChargesResponse.Charges.ChargeInfo chargeInfo = charges.get(idx);
       context.setVariable("amountToPay_" + blockIndex, chargeInfo.getAmountToPay());
       context.setVariable(
           "quittanceWithPaymentStatus_" + blockIndex, chargeInfo.getQuittanceWithPaymentStatus());
       context.setVariable(
           "quittanceWithIncomeStatus_" + blockIndex, chargeInfo.getQuittanceWithIncomeStatus());
       if (chargeInfo.getIsRevoked() != null) {
         context.setVariable("isRevoked_" + blockIndex, chargeInfo.getIsRevoked().isValue());
         if (chargeInfo.getIsRevoked().getDate() != null) {
           context.setVariable(
               "revokedDate_" + blockIndex,
               chargeInfo.getIsRevoked().getDate().toGregorianCalendar().getTime());
         } else {
           context.setVariable("revokedDate_" + blockIndex, null);
         }
       } else {
         context.setVariable("revokedDate_" + blockIndex, null);
         context.setVariable("isRevoked_" + blockIndex, false);
       }
       if (chargeInfo.getChargeData() != null) {
         ChargeType charge =
             (ChargeType)
                 parseEntity(
                     chargeInfo.getChargeData(),
                     "http://roskazna.ru/xsd/Charge",
                     "Charge",
                     ChargeType.class);
         addChargeToContext(charge, context, blockIndex);
       }
     }
   } else {
     context.setVariable("chargeBlock", 0l);
   }
 }
Exemple #4
0
 private void processExportPaymentResponse(
     ExchangeContext ctx, ExportDataResponse exportDataResponse) throws Exception {
   ExportPaymentsResponse exportResponse =
       (ExportPaymentsResponse) exportDataResponse.getResponseTemplate();
   if (exportResponse.getPayments() != null) {
     List<ExportPaymentsResponse.Payments.PaymentInfo> paymentInfoList =
         exportResponse.getPayments().getPaymentInfo();
     ctx.setVariable("paymentBlock", (long) paymentInfoList.size());
     int blockIndex = 0;
     for (ExportPaymentsResponse.Payments.PaymentInfo paymentInfo : paymentInfoList) {
       blockIndex++;
       PaymentInfoType paymentType =
           (PaymentInfoType)
               parseEntity(
                   paymentInfo.getPaymentData(),
                   "http://roskazna.ru/xsd/PaymentInfo",
                   "FinalPayment",
                   PaymentInfoType.class);
       ctx.setVariable("paymentNarrative" + "_" + blockIndex, paymentType.getNarrative());
       ctx.setVariable(
           "paymentSupplierBillID" + "_" + blockIndex, paymentType.getSupplierBillID());
       ctx.setVariable("paymentAmount" + "_" + blockIndex, paymentType.getAmount());
       ctx.setVariable(
           "paymentDate" + "_" + blockIndex,
           paymentType.getPaymentDate().toGregorianCalendar().getTime());
       ctx.setVariable("paymentChangeStatus" + "_" + blockIndex, paymentType.getChangeStatus());
       ctx.setVariable("paymentPayeeINN" + "_" + blockIndex, paymentType.getPayeeINN());
       ctx.setVariable("paymentPayeeKPP" + "_" + blockIndex, paymentType.getPayeeKPP());
       ctx.setVariable("paymentKBK" + "_" + blockIndex, paymentType.getKBK());
       ctx.setVariable("paymentOKATO" + "_" + blockIndex, paymentType.getOKATO());
       ctx.setVariable("paymentPA" + "_" + blockIndex, paymentType.getPayerPA());
       if (paymentType.getPayeeBankAcc() != null) {
         ctx.setVariable(
             "paymentPayeeAccount" + "_" + blockIndex, paymentType.getPayeeBankAcc().getAccount());
         ctx.setVariable(
             "paymentPayeeBankAccKind" + "_" + blockIndex,
             paymentType.getPayeeBankAcc().getKind());
         ctx.setVariable(
             "paymentPayeeBankName" + "_" + blockIndex,
             paymentType.getPayeeBankAcc().getBank().getName());
         ctx.setVariable(
             "paymentCorrespondentBankAccount" + "_" + blockIndex,
             paymentType.getPayeeBankAcc().getBank().getCorrespondentBankAccount());
         ctx.setVariable(
             "paymentPayeeBankBIK" + "_" + blockIndex,
             paymentType.getPayeeBankAcc().getBank().getBIK());
       }
       ctx.setVariable("Status" + "_" + blockIndex, paymentType.getBudgetIndex().getStatus());
       ctx.setVariable(
           "PaymentType" + "_" + blockIndex, paymentType.getBudgetIndex().getPaymentType());
       ctx.setVariable("Purpose" + "_" + blockIndex, paymentType.getBudgetIndex().getPurpose());
       ctx.setVariable(
           "TaxPeriod" + "_" + blockIndex, paymentType.getBudgetIndex().getTaxPeriod());
       ctx.setVariable(
           "TaxDocNumber" + "_" + blockIndex, paymentType.getBudgetIndex().getTaxDocNumber());
       ctx.setVariable(
           "TaxDocDate" + "_" + blockIndex, paymentType.getBudgetIndex().getTaxDocDate());
       ctx.setVariable(
           "paymentSystemId" + "_" + blockIndex,
           paymentType.getPaymentIdentificationData().getSystemIdentifier());
       ctx.setVariable(
           "paymentBIK" + "_" + blockIndex,
           paymentType.getPaymentIdentificationData().getBank().getBIK());
       ctx.setVariable(
           "paymentBankName" + "_" + blockIndex,
           paymentType.getPaymentIdentificationData().getBank().getName());
       ctx.setVariable("payerId" + "_" + blockIndex, paymentType.getPayerIdentifier());
     }
   } else {
     ctx.setVariable("paymentBlock", 0l);
   }
 }