Beispiel #1
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());
   }
 }
Beispiel #2
0
 private void fillAcknowledgmentQuinttancesToContext(
     ExchangeContext context,
     List<DoAcknowledgmentResponseType.Quittances.Quittance> quittanceList) {
   context.setVariable("quittance", (long) quittanceList.size());
   // context.setVariable("-quittance", "");
   for (int idx = 0; idx < quittanceList.size(); idx++) {
     int blockIndex = idx + 1;
     DoAcknowledgmentResponseType.Quittances.Quittance quittance = quittanceList.get(idx);
     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());
   }
 }
Beispiel #3
0
  private String createAppDataForImportPaymentOperation(ExchangeContext ctx) throws Exception {
    ImportData importData = new ImportData();
    final ImportRequest importRequest = new ImportRequest();
    importData.setImportRequest(importRequest);
    String postBlockSenderIdentifier = (String) ctx.getVariable("postBlockSenderIdentifier");
    final PostBlock postBlock = createPostBlock(ctx, postBlockSenderIdentifier);
    importRequest.setPostBlock(postBlock);
    PaymentInfoType paymentInfo = new PaymentInfoType();
    importRequest.setFinalPayment(paymentInfo);

    paymentInfo.setNarrative(getStringFromContext(ctx, "paymentNarrative", ""));
    paymentInfo.setSupplierBillID(getStringFromContext(ctx, "paymentSupplierBillID", ""));
    paymentInfo.setAmount(toLong((String) ctx.getVariable("paymentAmount")));
    paymentInfo.setPaymentDate(
        XmlTypes.date(formatDate((Date) ctx.getVariable("paymentDate"), "dd.MM.yyyy")));
    paymentInfo.setChangeStatus(getStringFromContext(ctx, "paymentChangeStatus", "1"));
    paymentInfo.setPayeeINN(getStringFromContext(ctx, "paymentPayeeINN", ""));
    paymentInfo.setPayeeKPP(getStringFromContext(ctx, "paymentPayeeKPP", ""));
    paymentInfo.setKBK(getStringFromContext(ctx, "paymentKBK", ""));
    paymentInfo.setOKATO(getStringFromContext(ctx, "paymentOKATO", ""));
    paymentInfo.setPayerPA(getStringFromContext(ctx, "paymentPA", ""));

    Account payeeBankAcc = new Account();
    paymentInfo.setPayeeBankAcc(payeeBankAcc);
    payeeBankAcc.setAccount(getStringFromContext(ctx, "paymentPayeeAccount", ""));
    payeeBankAcc.setKind(getStringFromContext(ctx, "paymentPayeeBankAccKind", "!"));
    Bank payeeBank = new Bank();
    payeeBankAcc.setBank(payeeBank);
    payeeBank.setName(getStringFromContext(ctx, "paymentPayeeBankName", ""));
    payeeBank.setCorrespondentBankAccount(
        getStringFromContext(ctx, "paymentCorrespondentBankAccount", ""));
    payeeBank.setBIK(getStringFromContext(ctx, "paymentPayeeBankBIK", ""));

    PaymentIdentificationDataType paymentIdentificationData = new PaymentIdentificationDataType();
    paymentInfo.setPaymentIdentificationData(paymentIdentificationData);
    Bank bank = new Bank();
    paymentIdentificationData.setBank(bank);
    bank.setBIK(getStringFromContext(ctx, "paymentBIK", ""));
    bank.setName(getStringFromContext(ctx, "paymentBankName", ""));
    paymentIdentificationData.setSystemIdentifier(
        buildSystemIdentifierForImportPaymentOperation(ctx));

    fillPaymentAdditionalData(paymentInfo, ctx);
    final BudgetIndex budgetIndex = new BudgetIndex();
    paymentInfo.setBudgetIndex(budgetIndex);
    budgetIndex.setStatus(getStringFromContext(ctx, "Status", "0")); // Статус плательщика
    budgetIndex.setPaymentType(getStringFromContext(ctx, "PaymentType", "0")); // тип платежа
    budgetIndex.setPurpose(
        getStringFromContext(ctx, "Purpose", "0")); // основание платежа 2 символа максимум
    budgetIndex.setTaxPeriod(
        getStringFromContext(ctx, "TaxPeriod", "0")); // налоговый период до 10 символов
    budgetIndex.setTaxDocNumber(
        getStringFromContext(ctx, "TaxDocNumber", "0")); // Показатель номера документа
    budgetIndex.setTaxDocDate(
        getStringFromContext(ctx, "TaxDocDate", "0")); // Показатель даты документа

    paymentInfo.setPayerIdentifier(buildUnifiedPayerID(ctx, ""));

    String importDataStr = new XmlTypes(ImportData.class).toXml(importData);
    return cryptoProvider.signElement(importDataStr, "FinalPayment", null, true, true, false);
  }