Skip to content

Commit

Permalink
BATM-6136 Add a method to override input queues config
Browse files Browse the repository at this point in the history
  • Loading branch information
d0by1 committed Nov 13, 2024
1 parent 36cb312 commit 93e1277
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ default OutputQueueInsertConfig overrideOutputQueueInsertConfig(ITransactionQueu
return null;
}

/**
* Called when there is an Input Queue configured for a SELL transaction on the server
* and the transaction is about to be queued instead.
* The default rules for inserting into the given queue (configured in Input Queue in admin) are passed in as an argument
* and extensions can return overridden rules.
*
* @param transactionQueueRequest information about the transaction that is going to be queued
* @param inputQueueInsertConfig rules for inserting into the queue configured in admin or possibly already overridden by another extension
* @return new rules for inserting the transaction into the queue.
* This can be a new {@link InputQueueInsertConfig} instance or the same one that is passed in (modified or not).
* Returning null has the same effect as returning unmodified inputQueueInsertConfig argument.
*/
default InputQueueInsertConfig overrideInputQueueInsertConfig(ITransactionQueueRequest transactionQueueRequest,
InputQueueInsertConfig inputQueueInsertConfig) {
return null;
}

/**
* Callback method that is called by server when transaction is created on server
* Returned value is a map of keys and values that will be stored in the database and available for later use in ticket template
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*************************************************************************************
* Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved.
*
* This software may be distributed and modified under the terms of the GNU
* General Public License version 2 (GPL2) as published by the Free Software
* Foundation and appearing in the file GPL2.TXT included in the packaging of
* this file. Please note that GPL2 Section 2[b] requires that all works based
* on this software must also be made publicly available under the terms of
* the GPL2 ("Copyleft").
*
* Contact information
* -------------------
*
* GENERAL BYTES s.r.o.
* Web : http://www.generalbytes.com
*
************************************************************************************/
package com.generalbytes.batm.server.extensions;

import java.util.Date;

/**
* Information about how a transaction should be inserted into an Input Queue.
* This is initially configured in admin per Input Queue, and it can be overridden by extensions for each transaction.
* An extension can decide to skip the queue that is configured in admin (do not add the transaction to it and send it immediately)
* but it cannot request to queue a transaction if no Input Queue is configured in admin.
*/
public class InputQueueInsertConfig {
private boolean skipQueue = false;
private boolean insertIntoSecondaryQueue = false;

private boolean manualApprovalRequired = false;
private int delaySeconds = 0;

private boolean secondaryManualApprovalRequired = false;
private int secondaryDelaySeconds = 0;
private Date unlockTime;

public boolean isSkipQueue() {
return skipQueue;
}

public void setSkipQueue(boolean skipQueue) {
this.skipQueue = skipQueue;
}

public boolean isInsertIntoSecondaryQueue() {
return insertIntoSecondaryQueue;
}

public void setInsertIntoSecondaryQueue(boolean insertIntoSecondaryQueue) {
this.insertIntoSecondaryQueue = insertIntoSecondaryQueue;
}

public boolean isManualApprovalRequired() {
return manualApprovalRequired;
}

public void setManualApprovalRequired(boolean manualApprovalRequired) {
this.manualApprovalRequired = manualApprovalRequired;
}

public int getDelaySeconds() {
return delaySeconds;
}

public void setDelaySeconds(int delaySeconds) {
this.delaySeconds = delaySeconds;
}

public boolean isSecondaryManualApprovalRequired() {
return secondaryManualApprovalRequired;
}

public void setSecondaryManualApprovalRequired(boolean secondaryManualApprovalRequired) {
this.secondaryManualApprovalRequired = secondaryManualApprovalRequired;
}

public int getSecondaryDelaySeconds() {
return secondaryDelaySeconds;
}

public void setSecondaryDelaySeconds(int secondaryDelaySeconds) {
this.secondaryDelaySeconds = secondaryDelaySeconds;
}

public Date getUnlockTime() {
return unlockTime;
}

public void setUnlockTime(Date unlockTime) {
this.unlockTime = unlockTime;
}

@Override
public String toString() {
return "InputQueueInsertConfig{" +
"skipQueue=" + skipQueue +
", manualApprovalRequired=" + manualApprovalRequired +
", delaySeconds=" + delaySeconds +
", insertIntoSecondaryQueue=" + insertIntoSecondaryQueue +
", secondaryManualApprovalRequired=" + secondaryManualApprovalRequired +
", secondaryDelaySeconds=" + secondaryDelaySeconds +
", unlockTime=" + unlockTime +
'}';
}
}

0 comments on commit 93e1277

Please sign in to comment.