Java Code Examples for org.springframework.transaction.TransactionDefinition#PROPAGATION_REQUIRES_NEW

The following examples show how to use org.springframework.transaction.TransactionDefinition#PROPAGATION_REQUIRES_NEW . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TicketReservationManagerConcurrentTest.java    From alf.io with GNU General Public License v3.0 6 votes vote down vote up
@Before
public void setUp() {
    var transactionDefinition = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    transactionTemplate = new TransactionTemplate(platformTransactionManager, transactionDefinition);

    transactionTemplate.execute(tx -> {
        List<TicketCategoryModification> categories = Collections.singletonList(
            new TicketCategoryModification(null, "default", AVAILABLE_SEATS,
                new DateTimeModification(LocalDate.now(), LocalTime.now()),
                new DateTimeModification(LocalDate.now(), LocalTime.now()),
                DESCRIPTION, BigDecimal.TEN, true, "", true, null,
                null, null, null, null, null, TicketCategory.TicketCheckInStrategy.ONCE_PER_EVENT, null, AlfioMetadata.empty()));

        Pair<Event, String> eventStringPair = initEvent(categories, organizationRepository, userManager, eventManager, eventRepository);
        event = eventStringPair.getLeft();
        username = eventStringPair.getRight();
        int eventId = event.getId();
        firstCategoryId = ticketCategoryRepository.findAllTicketCategories(eventId).get(0).getId();

        specialPriceTokenGenerator.generatePendingCodesForCategory(firstCategoryId);
        promoCodeDiscountRepository.addPromoCode(ACCESS_CODE, eventId, event.getOrganizationId(), ZonedDateTime.now(), ZonedDateTime.now().plusDays(1), 0, PromoCodeDiscount.DiscountType.NONE, null, 100, null, null, PromoCodeDiscount.CodeType.ACCESS, firstCategoryId);
        promoCodeDiscount = promoCodeDiscountRepository.findPublicPromoCodeInEventOrOrganization(eventId, ACCESS_CODE).orElseThrow();
        return null;
    });
}
 
Example 2
Source File: DataBaseTransactionLogWritterImpl.java    From EasyTransaction with Apache License 2.0 6 votes vote down vote up
public DataBaseTransactionLogWritterImpl(ObjectSerializer objectSerializer,DataSource dataSource, ByteFormIdCodec idCodec,String tablePrefix) {
	super();
	this.objectSerializer = objectSerializer;
	this.idCodec = idCodec;
	this.dataSource = dataSource;
	transactionManager = new DataSourceTransactionManager(dataSource);
	transactionTemplate = new TransactionTemplate(transactionManager, new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
	
	if(!StringUtils.isEmpty(tablePrefix)) {
		tablePrefix = tablePrefix.trim();
		
		cleanLog = cleanLog.replace("trans_log_detail", tablePrefix + "trans_log_detail");
		cleanLog = cleanLog.replace("trans_log_unfinished", tablePrefix + "trans_log_unfinished");
		deleteUnfinishedTag = deleteUnfinishedTag.replace("trans_log_unfinished", tablePrefix + "trans_log_unfinished");
		insertTransDetail = insertTransDetail.replace("trans_log_detail", tablePrefix + "trans_log_detail");
		insertUnfinished = insertUnfinished.replace("trans_log_unfinished", tablePrefix + "trans_log_unfinished");
	}

}
 
Example 3
Source File: NoteServiceImpl.java    From NoteBlog with MIT License 6 votes vote down vote up
@Override
public boolean updateNote(Note note, String tagNames) {
    String[] tagNameArray = tagNames.split(",");
    DefaultTransactionDefinition def = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    TransactionStatus status = tm.getTransaction(def);
    try {
        if (noteRepository.updateById(note) == 1) {
            tagReferRepository.deleteByReferId(note.getId());
            saveNoteTag(note, tagNameArray);
            tm.commit(status);
            return true;
        } else return false;
    } catch (Exception e) {
        tm.rollback(status);
        log.error("发布笔记出错,回滚数据...", e);
        throw new RuntimeException(e);
    }
}
 
Example 4
Source File: NoteServiceImpl.java    From NoteBlog with MIT License 6 votes vote down vote up
@Override
public boolean postNote(Note note, String tagNames) {
    if (LangUtils.string.isEmpty(tagNames)) {
        throw new RuntimeException("tagName不能为空!");
    }
    String[] tagNameArray = tagNames.split(",");
    DefaultTransactionDefinition def = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    TransactionStatus status = tm.getTransaction(def);
    try {
        note = noteRepository.save(note);
        if (note == null) {
            throw new RuntimeException("发布失败!");
        }
        saveNoteTag(note, tagNameArray);
        tm.commit(status);
        return true;
    } catch (Exception e) {
        tm.rollback(status);
        log.error("发布笔记出错,回滚数据...", e);
        throw new RuntimeException(e);
    }
}
 
Example 5
Source File: TransactionUtil.java    From mPass with Apache License 2.0 5 votes vote down vote up
/**
 * 开启新事务
 */
public static TransactionStatus beginNewTransaction() {
	DefaultTransactionDefinition td = new DefaultTransactionDefinition(
			TransactionDefinition.PROPAGATION_REQUIRES_NEW);
	TransactionStatus status = getTransactionManager().getTransaction(td);
	return status;
}
 
Example 6
Source File: GroupManager.java    From alf.io with GNU General Public License v3.0 5 votes vote down vote up
public GroupManager(GroupRepository groupRepository,
                    TicketRepository ticketRepository,
                    AuditingRepository auditingRepository,
                    PlatformTransactionManager transactionManager) {
    this.groupRepository = groupRepository;
    this.ticketRepository = ticketRepository;
    this.auditingRepository = auditingRepository;
    this.requiresNewTransactionTemplate = new TransactionTemplate(transactionManager, new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
}
 
Example 7
Source File: DataMigrator.java    From alf.io with GNU General Public License v3.0 5 votes vote down vote up
@Autowired
public DataMigrator(EventMigrationRepository eventMigrationRepository,
                    EventRepository eventRepository,
                    TicketCategoryRepository ticketCategoryRepository,
                    @Value("${alfio.version}") String currentVersion,
                    @Value("${alfio.build-ts}") String buildTimestamp,
                    PlatformTransactionManager transactionManager,
                    ConfigurationRepository configurationRepository,
                    NamedParameterJdbcTemplate jdbc,
                    TicketReservationManager ticketReservationManager,
                    TicketSearchRepository ticketSearchRepository,
                    PromoCodeDiscountRepository promoCodeDiscountRepository,
                    AdditionalServiceItemRepository additionalServiceItemRepository,
                    AdditionalServiceRepository additionalServiceRepository,
                    BillingDocumentManager billingDocumentManager) {
    this.eventMigrationRepository = eventMigrationRepository;
    this.eventRepository = eventRepository;
    this.ticketCategoryRepository = ticketCategoryRepository;
    this.configurationRepository = configurationRepository;
    this.jdbc = jdbc;
    this.currentVersion = parseVersion(currentVersion);
    this.currentVersionAsString = currentVersion;
    this.buildTimestamp = ZonedDateTime.parse(buildTimestamp);
    this.transactionTemplate = new TransactionTemplate(transactionManager, new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
    this.ticketReservationManager = ticketReservationManager;
    this.ticketSearchRepository = ticketSearchRepository;
    this.promoCodeDiscountRepository = promoCodeDiscountRepository;
    this.additionalServiceItemRepository = additionalServiceItemRepository;
    this.additionalServiceRepository = additionalServiceRepository;
    this.billingDocumentManager = billingDocumentManager;
}
 
Example 8
Source File: ArticleServiceImpl.java    From NoteBlog with MIT License 5 votes vote down vote up
@Override
public boolean updateArticle(Article article, String tagNames) {
    String[] tagNameArray = tagNames.split(",");
    DefaultTransactionDefinition def = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    TransactionStatus status = tm.getTransaction(def);
    try {
        article.setModify(now());
        getSumByFilterContent(article);
        if (articleRepository.updateById(article) == 1) {
            tagReferRepository.deleteByReferId(article.getId());
            int cnt = 0;
            for (String name : Arrays.asList(tagNameArray)) {
                long tagId;
                if (tagRepository.countByName(name) == 0) {
                    tagId = tagRepository.save(Tag.builder().name(name).build()).getId();
                } else {
                    tagId = tagRepository.findIdByName(name);
                }
                tagReferRepository.save(TagRefer.builder().referId(article.getId()).tagId(tagId).show(cnt < 4).type(TagType.article.name()).build());
                cnt++;
            }
            tm.commit(status);
            return true;
        } else return false;
    } catch (Exception e) {
        tm.rollback(status);
        log.error("发布博文出错,回滚数据...", e);
        throw new RuntimeException(e);
    }
}
 
Example 9
Source File: PullingListenerContainer.java    From iaf with Apache License 2.0 5 votes vote down vote up
public void configure() {
	if (receiver.getNumThreadsPolling() > 0 && receiver.getNumThreadsPolling() < receiver.getNumThreads()) {
		pollToken = new Semaphore(receiver.getNumThreadsPolling());
	}
	processToken = new Semaphore(receiver.getNumThreads());
	maxThreadCount = receiver.getNumThreads();
	if (receiver.isTransacted()) {
		DefaultTransactionDefinition txDef = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
		if (receiver.getTransactionTimeout() > 0) {
			txDef.setTimeout(receiver.getTransactionTimeout());
		}
		txNew = txDef;
	}
}
 
Example 10
Source File: TransactionUtil.java    From mPaaS with Apache License 2.0 5 votes vote down vote up
/**
 * 开启新事务
 */
public static TransactionStatus beginNewTransaction() {
	DefaultTransactionDefinition td = new DefaultTransactionDefinition(
			TransactionDefinition.PROPAGATION_REQUIRES_NEW);
	TransactionStatus status = getTransactionManager().getTransaction(td);
	return status;
}
 
Example 11
Source File: PipeLine.java    From iaf with Apache License 2.0 5 votes vote down vote up
public boolean isTransacted() {
//		return transacted;
		int txAtt = getTransactionAttributeNum();
		return  txAtt==TransactionDefinition.PROPAGATION_REQUIRED || 
				txAtt==TransactionDefinition.PROPAGATION_REQUIRES_NEW ||
				txAtt==TransactionDefinition.PROPAGATION_MANDATORY;
	}
 
Example 12
Source File: SpringTransactionManager.java    From dalesbred with MIT License 5 votes vote down vote up
static int springPropagationCode(@NotNull Propagation propagation) {
    switch (propagation) {
        case REQUIRED:
            return TransactionDefinition.PROPAGATION_REQUIRED;
        case MANDATORY:
            return TransactionDefinition.PROPAGATION_MANDATORY;
        case NESTED:
            return TransactionDefinition.PROPAGATION_NESTED;
        case REQUIRES_NEW:
            return TransactionDefinition.PROPAGATION_REQUIRES_NEW;
    }
    throw new IllegalArgumentException("unknown propagation: " + propagation);
}
 
Example 13
Source File: ReceiverBase.java    From iaf with Apache License 2.0 5 votes vote down vote up
public boolean isTransacted() {
//		return transacted;
		int txAtt = getTransactionAttributeNum();
		return  txAtt==TransactionDefinition.PROPAGATION_REQUIRED || 
				txAtt==TransactionDefinition.PROPAGATION_REQUIRES_NEW ||
				txAtt==TransactionDefinition.PROPAGATION_MANDATORY;
	}
 
Example 14
Source File: TransactionConfig.java    From scaffold-cloud with MIT License 4 votes vote down vote up
@Bean("txSource")
public TransactionAttributeSource transactionAttributeSource() {
    NameMatchTransactionAttributeSource source = new NameMatchTransactionAttributeSource();
    // 只读事务,不做更新操作
    RuleBasedTransactionAttribute readOnlyTx = new RuleBasedTransactionAttribute();
    readOnlyTx.setReadOnly(true);
    readOnlyTx.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
    // 默认级别 如果有事务 就加入当前事务 没有就新建
    RuleBasedTransactionAttribute requiredTx =
            new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED,
            Collections.singletonList(new RollbackRuleAttribute(Exception.class)));
    // 事务新建 不管有没有事务 都新建事务再执行
    RuleBasedTransactionAttribute requiredTxNew =
            new RuleBasedTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRES_NEW,
            Collections.singletonList(new RollbackRuleAttribute(Exception.class)));
    requiredTx.setTimeout(5);
    Map<String, TransactionAttribute> txMap = new HashMap<>();
    txMap.put("add*", requiredTx);
    txMap.put("create*", requiredTx);
    txMap.put("insert*", requiredTx);
    txMap.put("save*", requiredTx);
    txMap.put("update*", requiredTx);
    txMap.put("modify*", requiredTx);
    txMap.put("edit*", requiredTx);
    txMap.put("merge*", requiredTx);
    txMap.put("delete*", requiredTx);
    txMap.put("remove*", requiredTx);
    txMap.put("do*", requiredTx);
    txMap.put("handle*", requiredTx);
    // 以下为只读事务 PROPAGATION_NOT_SUPPORTED级别为不开启事务
    txMap.put("get*", readOnlyTx);
    txMap.put("query*", readOnlyTx);
    txMap.put("count*", readOnlyTx);
    txMap.put("find*", readOnlyTx);
    txMap.put("list*", readOnlyTx);
    txMap.put("load*", readOnlyTx);
    txMap.put("search*", readOnlyTx);
    txMap.put("*", readOnlyTx);
    source.setNameMap(txMap);
    return source;
}
 
Example 15
Source File: SqlScriptsTestExecutionListener.java    From java-technology-stack with MIT License 4 votes vote down vote up
/**
 * Execute the SQL scripts configured via the supplied {@link Sql @Sql}
 * annotation for the given {@link ExecutionPhase} and {@link TestContext}.
 * <p>Special care must be taken in order to properly support the configured
 * {@link SqlConfig#transactionMode}.
 * @param sql the {@code @Sql} annotation to parse
 * @param executionPhase the current execution phase
 * @param testContext the current {@code TestContext}
 * @param classLevel {@code true} if {@link Sql @Sql} was declared at the class level
 */
private void executeSqlScripts(Sql sql, ExecutionPhase executionPhase, TestContext testContext, boolean classLevel)
		throws Exception {

	if (executionPhase != sql.executionPhase()) {
		return;
	}

	MergedSqlConfig mergedSqlConfig = new MergedSqlConfig(sql.config(), testContext.getTestClass());
	if (logger.isDebugEnabled()) {
		logger.debug(String.format("Processing %s for execution phase [%s] and test context %s.",
				mergedSqlConfig, executionPhase, testContext));
	}

	final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
	populator.setSqlScriptEncoding(mergedSqlConfig.getEncoding());
	populator.setSeparator(mergedSqlConfig.getSeparator());
	populator.setCommentPrefix(mergedSqlConfig.getCommentPrefix());
	populator.setBlockCommentStartDelimiter(mergedSqlConfig.getBlockCommentStartDelimiter());
	populator.setBlockCommentEndDelimiter(mergedSqlConfig.getBlockCommentEndDelimiter());
	populator.setContinueOnError(mergedSqlConfig.getErrorMode() == ErrorMode.CONTINUE_ON_ERROR);
	populator.setIgnoreFailedDrops(mergedSqlConfig.getErrorMode() == ErrorMode.IGNORE_FAILED_DROPS);

	String[] scripts = getScripts(sql, testContext, classLevel);
	scripts = TestContextResourceUtils.convertToClasspathResourcePaths(testContext.getTestClass(), scripts);
	List<Resource> scriptResources = TestContextResourceUtils.convertToResourceList(
			testContext.getApplicationContext(), scripts);
	for (String stmt : sql.statements()) {
		if (StringUtils.hasText(stmt)) {
			stmt = stmt.trim();
			scriptResources.add(new ByteArrayResource(stmt.getBytes(), "from inlined SQL statement: " + stmt));
		}
	}
	populator.setScripts(scriptResources.toArray(new Resource[0]));
	if (logger.isDebugEnabled()) {
		logger.debug("Executing SQL scripts: " + ObjectUtils.nullSafeToString(scriptResources));
	}

	String dsName = mergedSqlConfig.getDataSource();
	String tmName = mergedSqlConfig.getTransactionManager();
	DataSource dataSource = TestContextTransactionUtils.retrieveDataSource(testContext, dsName);
	PlatformTransactionManager txMgr = TestContextTransactionUtils.retrieveTransactionManager(testContext, tmName);
	boolean newTxRequired = (mergedSqlConfig.getTransactionMode() == TransactionMode.ISOLATED);

	if (txMgr == null) {
		Assert.state(!newTxRequired, () -> String.format("Failed to execute SQL scripts for test context %s: " +
				"cannot execute SQL scripts using Transaction Mode " +
				"[%s] without a PlatformTransactionManager.", testContext, TransactionMode.ISOLATED));
		Assert.state(dataSource != null, () -> String.format("Failed to execute SQL scripts for test context %s: " +
				"supply at least a DataSource or PlatformTransactionManager.", testContext));
		// Execute scripts directly against the DataSource
		populator.execute(dataSource);
	}
	else {
		DataSource dataSourceFromTxMgr = getDataSourceFromTransactionManager(txMgr);
		// Ensure user configured an appropriate DataSource/TransactionManager pair.
		if (dataSource != null && dataSourceFromTxMgr != null && !dataSource.equals(dataSourceFromTxMgr)) {
			throw new IllegalStateException(String.format("Failed to execute SQL scripts for test context %s: " +
					"the configured DataSource [%s] (named '%s') is not the one associated with " +
					"transaction manager [%s] (named '%s').", testContext, dataSource.getClass().getName(),
					dsName, txMgr.getClass().getName(), tmName));
		}
		if (dataSource == null) {
			dataSource = dataSourceFromTxMgr;
			Assert.state(dataSource != null, () -> String.format("Failed to execute SQL scripts for " +
					"test context %s: could not obtain DataSource from transaction manager [%s] (named '%s').",
					testContext, txMgr.getClass().getName(), tmName));
		}
		final DataSource finalDataSource = dataSource;
		int propagation = (newTxRequired ? TransactionDefinition.PROPAGATION_REQUIRES_NEW :
				TransactionDefinition.PROPAGATION_REQUIRED);
		TransactionAttribute txAttr = TestContextTransactionUtils.createDelegatingTransactionAttribute(
				testContext, new DefaultTransactionAttribute(propagation));
		new TransactionTemplate(txMgr, txAttr).execute(status -> {
			populator.execute(finalDataSource);
			return null;
		});
	}
}
 
Example 16
Source File: HibernateJtaTransactionManagerAdapter.java    From gorm-hibernate5 with Apache License 2.0 4 votes vote down vote up
@Override
public void begin() {
    TransactionDefinition definition=new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    currentTransactionHolder.set(springTransactionManager.getTransaction(definition));
}
 
Example 17
Source File: ItemHashUtil.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
private TransactionDefinition requireNewTransaction() {
    return new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
}
 
Example 18
Source File: WorkflowExecutorImpl.java    From telekom-workflow-engine with MIT License 4 votes vote down vote up
private TransactionStatus begin(){
    TransactionDefinition definition = new DefaultTransactionDefinition( TransactionDefinition.PROPAGATION_REQUIRES_NEW );
    return platformTransactionManager.getTransaction( definition );
}
 
Example 19
Source File: ExtensionService.java    From alf.io with GNU General Public License v3.0 4 votes vote down vote up
private void executeInNewTransaction(TransactionCallback<Integer> t) {
    DefaultTransactionDefinition definition = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    TransactionTemplate template = new TransactionTemplate(platformTransactionManager, definition);
    template.execute(t);
}
 
Example 20
Source File: TicketReservationManager.java    From alf.io with GNU General Public License v3.0 4 votes vote down vote up
public TicketReservationManager(EventRepository eventRepository,
                                OrganizationRepository organizationRepository,
                                TicketRepository ticketRepository,
                                TicketReservationRepository ticketReservationRepository,
                                TicketCategoryRepository ticketCategoryRepository,
                                TicketCategoryDescriptionRepository ticketCategoryDescriptionRepository,
                                ConfigurationManager configurationManager,
                                PaymentManager paymentManager,
                                PromoCodeDiscountRepository promoCodeDiscountRepository,
                                SpecialPriceRepository specialPriceRepository,
                                TransactionRepository transactionRepository,
                                NotificationManager notificationManager,
                                MessageSourceManager messageSourceManager,
                                TemplateManager templateManager,
                                PlatformTransactionManager transactionManager,
                                WaitingQueueManager waitingQueueManager,
                                TicketFieldRepository ticketFieldRepository,
                                AdditionalServiceRepository additionalServiceRepository,
                                AdditionalServiceItemRepository additionalServiceItemRepository,
                                AdditionalServiceTextRepository additionalServiceTextRepository,
                                InvoiceSequencesRepository invoiceSequencesRepository,
                                AuditingRepository auditingRepository,
                                UserRepository userRepository,
                                ExtensionManager extensionManager, TicketSearchRepository ticketSearchRepository,
                                GroupManager groupManager,
                                BillingDocumentRepository billingDocumentRepository,
                                NamedParameterJdbcTemplate jdbcTemplate,
                                Json json,
                                PromoCodeDiscountRepository promoCodeRepository,
                                BillingDocumentManager billingDocumentManager) {
    this.eventRepository = eventRepository;
    this.organizationRepository = organizationRepository;
    this.ticketRepository = ticketRepository;
    this.ticketReservationRepository = ticketReservationRepository;
    this.ticketCategoryRepository = ticketCategoryRepository;
    this.ticketCategoryDescriptionRepository = ticketCategoryDescriptionRepository;
    this.configurationManager = configurationManager;
    this.paymentManager = paymentManager;
    this.promoCodeDiscountRepository = promoCodeDiscountRepository;
    this.specialPriceRepository = specialPriceRepository;
    this.transactionRepository = transactionRepository;
    this.notificationManager = notificationManager;
    this.messageSourceManager = messageSourceManager;
    this.templateManager = templateManager;
    this.waitingQueueManager = waitingQueueManager;
    this.requiresNewTransactionTemplate = new TransactionTemplate(transactionManager, new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW));
    DefaultTransactionDefinition serialized = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    serialized.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
    this.serializedTransactionTemplate = new TransactionTemplate(transactionManager, serialized);
    this.nestedTransactionTemplate = new TransactionTemplate(transactionManager, new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_NESTED));
    this.ticketFieldRepository = ticketFieldRepository;
    this.additionalServiceRepository = additionalServiceRepository;
    this.additionalServiceItemRepository = additionalServiceItemRepository;
    this.additionalServiceTextRepository = additionalServiceTextRepository;
    this.invoiceSequencesRepository = invoiceSequencesRepository;
    this.auditingRepository = auditingRepository;
    this.userRepository = userRepository;
    this.extensionManager = extensionManager;
    this.ticketSearchRepository = ticketSearchRepository;
    this.groupManager = groupManager;
    this.billingDocumentRepository = billingDocumentRepository;
    this.jdbcTemplate = jdbcTemplate;
    this.json = json;
    this.promoCodeRepository = promoCodeRepository;
    this.billingDocumentManager = billingDocumentManager;
}