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); } } }
private void processResponseOnImportChargeRequest( ClientResponse response, ExchangeContext context) { ImportDataResponse importDataResponse = (ImportDataResponse) new XmlTypes(ImportDataResponse.class).toBean(response.appData.getFirstChild()); if (importDataResponse == null) throw new IllegalStateException("Can't parse import data response"); Ticket ticket = importDataResponse.getTicket(); context.setVariable("ticketPostBlockID", ticket.getPostBlock().getID()); context.setVariable( "ticketPostBlockSenderIdentifier", ticket.getPostBlock().getSenderIdentifier()); context.setVariable( "ticketPostBlockTimeStamp", ticket.getPostBlock().getTimeStamp().toGregorianCalendar().getTime()); if (ticket.getRequestProcessResult() != null) { String errorCode = ticket.getRequestProcessResult().getErrorCode(); context.setVariable("requestProcessResultErrorCode", errorCode); context.setVariable( "requestProcessResultErrorDescription", ticket.getRequestProcessResult().getErrorDescription()); context.setVariable("responseSuccess", false); context.setVariable("smevPool", false); processInternalErrorService(context, errorCode); } else { context.setVariable("responseSuccess", true); context.setVariable("smevPool", false); } }
private void processInternalErrorService(ExchangeContext context, String errorCode) { if ("EBPP5000".equals(errorCode)) { int countRetries = context.getVariableNames().contains("countRetries") ? (Integer) context.getVariable("countRetries") : 0; countRetries++; context.setVariable("countRetries", countRetries); context.setVariable("smevTimeOut", calcTimeOut(countRetries)); context.setVariable("smevPool", countRetries < 5); } }
public ClientRequest createClientRequest(ExchangeContext ctx) { final String originRequestId = (String) ctx.getVariable("smevOriginRequestId"); final Packet packet = new Packet(); packet.recipient = new InfoSystem("RKZN35001", "Казначейство России"); InfoSystem pnzr8201 = new InfoSystem( "8201", "Комплексная система предоставления государственных и муниципальных услуг Пензенской области"); packet.sender = packet.originator = pnzr8201; packet.typeCode = Packet.Type.EXECUTION; packet.date = new Date(); packet.exchangeType = "6"; // 1 - Запрос на оказание услуги packet.originRequestIdRef = originRequestId; packet.testMsg = (String) ctx.getVariable("smevTest"); final ClientRequest request = new ClientRequest(); BigInteger caseNumber = generateCaseNumber(); packet.caseNumber = caseNumber.toString(); ctx.setVariable(SMEV_INITIAL_REG_NUMBER, caseNumber); ctx.setVariable(SMEV_INITIAL_REG_DATE, new Date()); request.packet = packet; request.action = new QName("http://roskazna.ru/SmevUnifoService/", "UnifoTransferMsg"); packet.status = Packet.Status.REQUEST; try { String typeOperation = getStringFromContext(ctx, "operationType", ""); if (IMPORT_CHARGE_OPERATION.equals(typeOperation)) { request.appData = createAppDataForImportChargeOperation(ctx); } else if (EXPORT_OPERATION.equals(typeOperation)) { request.appData = createAppDataForExportOperation(ctx); } else if (IMPORT_PAYMENT_OPERATION.equals(typeOperation)) { request.appData = createAppDataForImportPaymentOperation(ctx); } else if (DO_ACKNOWLEDGMENT_OPERATION.equals(typeOperation)) { request.appData = createAcknowledgmentRequest(ctx); } else { throw new IllegalArgumentException("Тип операции не верен"); } } catch (Exception e) { logger.log(Level.SEVERE, e.getMessage(), e); throw new RuntimeException(e.getMessage(), e); } return request; }
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); } }
private void processResponseOnAcknowledgmentOperation( ClientResponse response, ExchangeContext context) { context.setVariable("smevPool", false); DoAcknowledgmentResponseType acknowledgmentResponse = (DoAcknowledgmentResponseType) new XmlTypes(DoAcknowledgmentResponseType.class) .toBean(response.appData.getFirstChild()); if (acknowledgmentResponse.getRequestProcessResult() != null) { context.setVariable("responseSuccess", false); String errorCode = acknowledgmentResponse.getRequestProcessResult().getErrorCode(); processInternalErrorService(context, errorCode); context.setVariable("requestProcessResultErrorCode", errorCode); context.setVariable( "requestProcessResultErrorDescription", acknowledgmentResponse.getRequestProcessResult().getErrorDescription()); } else { context.setVariable("responseSuccess", true); fillAcknowledgmentQuinttancesToContext( context, acknowledgmentResponse.getQuittances().getQuittance()); } }
private PostBlock createPostBlock(ExchangeContext ctx, String postBlockSenderIdentifier) { final PostBlock postBlock = new PostBlock(); String postBlockID = ctx.getVariable("postBlockId") == null ? UUID.randomUUID().toString() : (String) ctx.getVariable("postBlockId"); ctx.setVariable("postBlockId", postBlockID); postBlock.setID(postBlockID); // идентификатор запроса postBlock.setSenderIdentifier(postBlockSenderIdentifier); Date postBlockTimeStamp = ctx.getVariable("postBlockTimeStamp") != null ? (Date) ctx.getVariable("postBlockTimeStamp") : new Date(); postBlock.setTimeStamp( XmlTypes.dateTimeAndZeroMilliseconds( formatDate(postBlockTimeStamp, "dd.MM.yyyy HH:mm:ss"))); // дата составления запроса return postBlock; }
public void processClientResponse(ClientResponse response, ExchangeContext context) { try { context.setVariable("smevPool", true); // сервис синхронный if (response.verifyResult.error != null) { context.setVariable("smevError", response.verifyResult.error); context.setVariable("responseSuccess", false); context.setVariable("smevPool", false); context.setVariable("requestProcessResultErrorDescription", response.verifyResult.error); } else if (new QName("http://roskazna.ru/SmevUnifoService/", "UnifoTransferMsg") .equals(response.action)) { processResponseWithFinalData(response, context); } else { context.setVariable("smevError", "Неизвестный ответ " + response.action); } } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } }
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()); } }
private void addChargeToContext(ChargeType charge, ExchangeContext context, int blockIndex) { context.setVariable("SupplierBillID_" + blockIndex, charge.getSupplierBillID()); context.setVariable("UnifiedPayerId_" + blockIndex, charge.getUnifiedPayerIdentifier()); context.setVariable( "BillDate_" + blockIndex, charge.getBillDate().toGregorianCalendar().getTime()); context.setVariable("SupplierOrgInfoName_" + blockIndex, charge.getSupplierOrgInfo().getName()); context.setVariable("SupplierOrgInfoINN_" + blockIndex, charge.getSupplierOrgInfo().getINN()); context.setVariable("SupplierOrgInfoKPP_" + blockIndex, charge.getSupplierOrgInfo().getKPP()); context.setVariable( "SupplierOrgAccountKind_" + blockIndex, charge.getSupplierOrgInfo().getAccount().getKind()); context.setVariable( "SupplierOrgAccountNumber_" + blockIndex, charge.getSupplierOrgInfo().getAccount().getAccount()); context.setVariable( "SupplierOrgAccountBankName_" + blockIndex, charge.getSupplierOrgInfo().getAccount().getBank().getName()); context.setVariable( "SupplierOrgAccountBankBIK_" + blockIndex, charge.getSupplierOrgInfo().getAccount().getBank().getBIK()); context.setVariable("ChargeChangeStatus_" + blockIndex, charge.getChangeStatus()); context.setVariable("ChargeKBK_" + blockIndex, charge.getKBK()); context.setVariable("ChargeOKATO_" + blockIndex, charge.getOKATO()); context.setVariable("ChargeTreasureBranch_" + blockIndex, charge.getTreasureBranch()); context.setVariable("budgetStatus_" + blockIndex, charge.getBudgetIndex().getStatus()); context.setVariable("budgetPurpose_" + blockIndex, charge.getBudgetIndex().getPurpose()); context.setVariable( "budgetPaymentType_" + blockIndex, charge.getBudgetIndex().getPaymentType()); context.setVariable("budgetTaxPeriod_" + blockIndex, charge.getBudgetIndex().getTaxPeriod()); context.setVariable( "budgetTaxDocNumber_" + blockIndex, charge.getBudgetIndex().getTaxDocNumber()); context.setVariable("budgetTaxDocDate_" + blockIndex, charge.getBudgetIndex().getTaxDocDate()); context.setVariable("TotalAmount_" + blockIndex, charge.getTotalAmount()); if (charge.getAdditionalData() != null) { context.setVariable("additionalData_" + blockIndex, (long) charge.getAdditionalData().size()); int additionalDataIdx = 0; for (Bill.AdditionalData additionalData : charge.getAdditionalData()) { additionalDataIdx++; context.setVariable( "additionalDataKey_" + blockIndex + "_" + additionalDataIdx, additionalData.getName()); context.setVariable( "additionalDataValue_" + blockIndex + "_" + additionalDataIdx, additionalData.getValue()); } } else { context.setVariable("additionalData_" + blockIndex, 0l); } if (charge.getSupplierOrgInfo().getAddresses() != null) { int addressIdx = 0; context.setVariable( "SupplierOrgAddress_" + blockIndex, (long) charge.getSupplierOrgInfo().getAddresses().getAddress().size()); for (AddressType address : charge.getSupplierOrgInfo().getAddresses().getAddress()) { addressIdx++; context.setVariable("addressType_" + blockIndex + "_" + addressIdx, address.getKind()); context.setVariable("addressView_" + blockIndex + "_" + addressIdx, address.getView()); } } else { context.setVariable("SupplierOrgAddress_" + blockIndex, 0l); } if (charge.getSupplierOrgInfo().getContacts() != null) { int contactIdx = 0; context.setVariable( "SupplierOrgContact_" + blockIndex, (long) charge.getSupplierOrgInfo().getContacts().getContact().size()); for (ContactInfoType contact : charge.getSupplierOrgInfo().getContacts().getContact()) { contactIdx++; context.setVariable("contactType_" + blockIndex + "_" + contactIdx, contact.getKind()); context.setVariable("contactValue_" + blockIndex + "_" + contactIdx, contact.getValue()); context.setVariable( "contactComment_" + blockIndex + "_" + contactIdx, contact.getComment()); } } else { context.setVariable("SupplierOrgContact_" + blockIndex, 0l); } }
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); } }
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()); } }
String createAppDataForImportChargeOperation(ExchangeContext ctx) throws Exception { ImportData importData = new ImportData(); final ImportRequest importRequest = new ImportRequest(); String postBlockSenderIdentifier = (String) ctx.getVariable("postBlockSenderIdentifier"); final PostBlock postBlock = createPostBlock(ctx, postBlockSenderIdentifier); importRequest.setPostBlock(postBlock); final ChargeType charge = new ChargeType(); importRequest.setCharge(charge); String ordinalNumber = (String) ctx.getVariable("ordinalNumber"); if (ordinalNumber == null || "".equals(ordinalNumber)) { ordinalNumber = formatDate(new Date(), "ddMMyyHHmmss"); } String supplierBillID = UINGenerator.generateChargeUIN(postBlockSenderIdentifier, ordinalNumber); ctx.setVariable("supplierBillID", supplierBillID); charge.setSupplierBillID(supplierBillID); // Уникальный идентификатор счёта в ИСП charge.setBillDate( XmlTypes.date( formatDate( (Date) ctx.getVariable("chargeBillDate"), "dd.MM.yyyy"))); // Дата выставления счёта final Organization supplierOrgInfo = new Organization(); supplierOrgInfo.setName((String) ctx.getVariable("supplierOrgInfoName")); supplierOrgInfo.setINN((String) ctx.getVariable("supplierOrgInfoINN")); supplierOrgInfo.setKPP((String) ctx.getVariable("supplierOrgInfoKPP")); final Account account = new Account(); account.setAccount((String) ctx.getVariable("accountAccount")); account.setKind((String) ctx.getVariable("accountKind")); final Bank bank = new Bank(); bank.setBIK((String) ctx.getVariable("bankBIK")); bank.setName((String) ctx.getVariable("bankName")); account.setBank(bank); supplierOrgInfo.setAccount(account); charge.setSupplierOrgInfo(supplierOrgInfo); charge.setBillFor((String) ctx.getVariable("chargeBillFor")); charge.setTotalAmount(toLong((String) ctx.getVariable("chargeTotalAmount"))); charge.setChangeStatus( (String) ctx.getVariable( "chargeChangeStatus")); /* Статус счёта 1 - новый 2 - изменение 3 - аннулирование */ charge.setTreasureBranch( (String) ctx.getVariable( "chargeTreasureBranch")); // Орган ФК, на счёт которого должны поступать средства // плательщика charge.setKBK((String) ctx.getVariable("chargeKBK")); charge.setOKATO((String) ctx.getVariable("chargeOKATO")); final BudgetIndex budgetIndex = new BudgetIndex(); budgetIndex.setStatus((String) ctx.getVariable("budgetIndexStatus")); // Статус плательщика budgetIndex.setPaymentType((String) ctx.getVariable("budgetPaymentType")); // тип платежа budgetIndex.setPurpose( (String) ctx.getVariable("budgetPurpose")); // основание платежа 2 символа максимум budgetIndex.setTaxPeriod( (String) ctx.getVariable("budgetTaxPeriod")); // налоговый период до 10 символов budgetIndex.setTaxDocNumber( (String) ctx.getVariable("budgetTaxDocNumber")); // Показатель номера документа budgetIndex.setTaxDocDate( (String) ctx.getVariable("budgetTaxDocDate")); // Показатель даты документа charge.setBudgetIndex(budgetIndex); if ("".equals(getStringFromContext(ctx, "chargeApplicationID", ""))) { String applicationID = String.valueOf(System.currentTimeMillis()); ctx.setVariable("chargeApplicationID", applicationID); charge.setApplicationID(applicationID); } else { charge.setApplicationID((String) ctx.getVariable("chargeApplicationID")); } String unifiedPayerIdentifier = buildUnifiedPayerID(ctx, ""); ctx.setVariable("unifiedPayerIdentifier", unifiedPayerIdentifier); charge.setUnifiedPayerIdentifier(unifiedPayerIdentifier); // единый идентификатор плательщика importData.setImportRequest(importRequest); String importDataStr = new XmlTypes(ImportData.class).toXml(importData); return cryptoProvider.signElement(importDataStr, "Charge", null, true, true, false); }