Beispiel #1
0
 private void fillPaymentAdditionalData(PaymentInfoType paymentInfo, ExchangeContext ctx) {
   Long valuesCount = (Long) ctx.getVariable("payeeAddDataBlock");
   for (long idx = 0; idx < valuesCount; idx++) {
     PaymentType.AdditionalData additionalData = new PaymentType.AdditionalData();
     additionalData.setName(getStringFromContext(ctx, "payeeAddDataKey_" + (idx + 1), ""));
     additionalData.setValue(getStringFromContext(ctx, "payeeAddDataValue_" + (idx + 1), ""));
     paymentInfo.getAdditionalData().add(additionalData);
   }
 }
Beispiel #2
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);
   }
 }
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);
  }