コード例 #1
0
ファイル: GMPClient3572.java プロジェクト: CodeInside/siu
 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);
     }
   }
 }
コード例 #2
0
ファイル: GMPClient3572.java プロジェクト: CodeInside/siu
 String buildUnifiedPayerID(ExchangeContext ctx, String suffix) {
   String payerType = getStringFromContext(ctx, "payerType" + suffix, "");
   String citizenship = getStringFromContext(ctx, "payerPersonCitizenshipID" + suffix, "");
   if ("1".equals(payerType)) { // ФЛ СНИЛС
     String snilsNumber = getStringFromContext(ctx, "payerPersonDocumentID1" + suffix, "");
     if (!snilsNumber.matches("\\d{11}"))
       throw new IllegalArgumentException("СНИЛС должен состоять из 11 цифр");
     return "1" + snilsNumber;
   }
   if ("2".equals(payerType)) { // ЮЛ резидент
     String legalPersonKPP = getStringFromContext(ctx, "payerLegalKPP" + suffix, "");
     String legalPersonINN = getStringFromContext(ctx, "payerLegalINN" + suffix, "");
     if (!legalPersonINN.matches("\\d{10}"))
       throw new IllegalArgumentException("ИНН должен состоять из 10 цифр");
     if (!legalPersonKPP.matches("\\d{9}"))
       throw new IllegalArgumentException("КПП должен состоять из 9 цифр");
     return "2" + legalPersonINN + legalPersonKPP;
   }
   if ("3".equals(payerType)) { // ЮЛ не резидент
     String legalPersonKPP = getStringFromContext(ctx, "payerLegalNonResidentKPP" + suffix, "");
     String legalPersonINN = getStringFromContext(ctx, "payerLegalNonResidentINN" + suffix, "");
     if (!legalPersonINN.matches("\\d{5}"))
       throw new IllegalArgumentException("КИО должен состоять из 5 цифр");
     if (!legalPersonKPP.matches("\\d{9}"))
       throw new IllegalArgumentException("КПП должен состоять из 9 цифр");
     return "3" + legalPersonINN + legalPersonKPP;
   }
   if (Arrays.asList(
           "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "21",
           "22", "23", "24")
       .contains(payerType)) {
     String personDocumentID = getPersonDocumentId(ctx, suffix, payerType);
     if (personDocumentID.length() < 20) {
       personDocumentID = padding(20 - personDocumentID.length(), '0').concat(personDocumentID);
       if (Arrays.asList("21", "22", "23", "24").contains(payerType)) {
         return payerType + personDocumentID + "643";
       } else {
         if (!citizenship.matches("\\d{3}"))
           throw new IllegalArgumentException("Неверно указан код страны, должно быть три цифры");
         return payerType + personDocumentID + citizenship;
       }
     }
   }
   throw new IllegalArgumentException("Неверный тип плательщика " + payerType);
 }
コード例 #3
0
ファイル: GMPClient3572.java プロジェクト: CodeInside/siu
 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());
   }
 }