Skip to content

Commit

Permalink
Merge branch 'master' into 0116sync1.3.0toMaster
Browse files Browse the repository at this point in the history
# Conflicts:
#	gradle.properties
  • Loading branch information
Filip Ocelka committed Jan 16, 2024
2 parents 9692dcb + 4be57b5 commit 494064e
Show file tree
Hide file tree
Showing 80 changed files with 1,403 additions and 93 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CAS then parses any "batm-extensions.xml" found in the JAR file to enumerate the

<a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IExtension.java">Extension</a> is a high level component - something like a plugin - that encapsulates and instantiates the rest of the features.

Extension can be asked to provide wallet X for currency Y etc. The best way to learn more about extensions is to read the sample code and examine how other people have implemented support for their wallet or cryptocurrency in the <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_extra">server_extensions_extra</a> module. <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/examples">Additional examples can be found here</a>.
Extension can be asked to provide wallet X for currency Y etc. The best way to learn more about extensions is to read the sample code and examine how other people have implemented support for their wallet or cryptocurrency in the <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_extra">server_extensions_extra</a> module. <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_examples/src/main/java/com/generalbytes/batm/server/extensions/examples">Additional examples can be found here</a>.

Here is the list of some functionality that can be extended using Extensions API:
* **Implement support for different cryptocurrency wallets** - for more information, see the <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IWallet.java">IWallet</a> interface.
Expand All @@ -43,14 +43,16 @@ Here is the list of some functionality that can be extended using Extensions API
* **Send emails or SMSes from extension** - To notify your customer via SMS or email with custom messages, call the methods exposed by the <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IExtensionContext.java">IExtensionContext</a> interface.
* **<a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IExtensionContext.java">ExtensionContext</a>** is your main entrypoint for interacting with CAS.
ExtensionContext may be called from any extension. A reference to ExtensionContext is passed to an Extension when the **init** method is called by CAS on any Extension. Please make sure you read all of the methods that are available on the IExtensionContext interface. There are, for example: cash related operations, sell functionality, and more!
* **Implement RESTful services** - facilitates integration of the Server with a 3rd party system. Extensions enable you to quickly and easily create a RESTful service that sends/receives data via JSON and HTTPS. Do you want your website to contact CAS to find the current exchange rate on your BATM (or even more complicated functions)? Use <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IRestService.java">IRestService</a> for that. A simple example that returns your current CAS version can be found <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/examples/rest">here</a>.
* **Implement ChatBot commands** - Do you need to execute some tasks on server by sending message to server via Telegram Messenger? Simply implement Telegram your command and you are ready to go. A simple example that returns your current CAS version can be found <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/examples/chat">here</a>.
* **Implement RESTful services** - facilitates integration of the Server with a 3rd party system. Extensions enable you to quickly and easily create a RESTful service that sends/receives data via JSON and HTTPS. Do you want your website to contact CAS to find the current exchange rate on your BATM (or even more complicated functions)? Use <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_api/src/main/java/com/generalbytes/batm/server/extensions/IRestService.java">IRestService</a> for that. A simple example that returns your current CAS version can be found <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_examples/src/main/java/com/generalbytes/batm/server/extensions/examples/rest">here</a>.
* **Implement ChatBot commands** - Do you need to execute some tasks on server by sending message to server via Telegram Messenger? Simply implement Telegram your command and you are ready to go. A simple example that returns your current CAS version can be found <a href="https://github.com/GENERALBYTESCOM/batm_public/blob/master/server_extensions_examples/src/main/java/com/generalbytes/batm/server/extensions/examples/chat">here</a>.


Content
=======
* **server_extensions_api** - contains the extension API that all extensions use to extend CAS' functionality.
* **server_extensions_extra** - reference extension implementation that demonstrates BTC, LTC, CLOAK, DGB, DASH, HATCH, POT, VIA, BTX, SYS, FLASH, DOGE, NLG, ICG, NBT, GRS, MAX, BSD, MEC, BTDX, NANO, SUM, BURST, ECA, LINDA, $PAC, DAI, MKR, BTBS, GQ, VERUM, MUE, BAT and REP coin support functionality.
* **server_extensions_examples** - contains example implementations of various extensions.
* **server_extensions_template** - contains template for developer's own extension.
* **server_extensions_test** - contains tester for testing the extensions (CAS not required).
* **operators_sample_website** - The OSW is a sample web application that demonstrates how operators can enable their customers initiate sell transactions online via operator's website and later visit two-way BATMThree or BATMFour ATM when cash is ready for withdrawal. For more detailed information see <a href="https://github.com/GENERALBYTESCOM/batm_public/tree/master/operators_sample_website">description</a>.
<p align="center">`
Expand All @@ -65,7 +67,7 @@ Requirements:
* Java **1.8** (we recommend using https://sdkman.io/ for managing multiple JDK versions on your computer)
* Gradle

When you implement support for a new crypto-coin, please add it to **server_extensions_extra** - so that it may get into the default CAS installation pack for customers.
When you implement support for a new crypto-coin, please add it to **server_extensions_extra** - so that it may get into the default CAS distribution ready to be used by other operators.
Please use the appropriate Fork and Pull Request in the GitHub workflow when adding new functions, and bear in mind that your code will be reviewed prior to any merge with the master.

When adding new cryptocurrency support, please remember to provide its logo! This logo will later be downloaded by the BATM from CAS and displayed on the BATM screen. Both SVG and PNG logos are supported; however, only the SVG logo is used on newer BATM versions. A PNG logo is offered only for backward compatibility, and in the few cases where the SVG logo has an unusually large size.
Expand All @@ -88,6 +90,16 @@ Note that on startup, CAS scans the: <code>/batm/app/master/extensions/</code> f

If you happen to add new cryptocurrency in CryptoCurrency class in currencies module then don't forget to make sure that you copy your version of currencies-1.0.XX-SNAPSHOT.jar to /batm/app/master/lib

Creating your own extension
=================
When you want to develop your own operator specific extension please create a new module and implement your extension there.
Use server_extensions_template module as a termplate for your first extension. Just copy this module and rename it.
You will need to modify also settings.gradle file to contain your new extension module's name. See how is the server_extensions_template module mentioned and add line for your new extension module.
After building the whole project your built extension shoud be in following file: <code>yournewextension/build/libs/yournewextension.jar</code>
Copy it to CAS server at following location: <code>/batm/app/master/extensions/</code>
You may also want to modify build.gradle in your new module to change at least package names and final output filename.


How to run Tester
==========
```bash
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# buildscript - project id
projectGroup=com.generalbytes.batm.public
projectVersion=1.3.6
projectVersion=1.4.3

# buildscript - common dependency versions
bitrafaelVersion=1.0.44
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.generalbytes.batm.server.extensions.aml.verification.IIdentityVerificationProvider;
import com.generalbytes.batm.server.extensions.communication.ICommunicationProvider;
import com.generalbytes.batm.server.extensions.communication.IPhoneLookupProvider;
import com.generalbytes.batm.server.extensions.communication.voicecall.IVoiceCallProvider;
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;

import java.util.Set;
Expand Down Expand Up @@ -127,6 +128,9 @@ public Set<ICommunicationProvider> getCommunicationProviders() {
return null;
}

@Override
public Set<IVoiceCallProvider> getVoiceCallProviders() { return null; }

@Override
public Set<ISsnValidator> getSsnValidators() {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
public class DiscountSpec {
private BigDecimal buyDiscount;
private BigDecimal sellDiscount;
private BigDecimal buyFixedFeeDiscount;
private BigDecimal sellFixedFeeDiscount;
private Date validityFrom;
private Date validityTill;
private Long maximumUsages;
Expand All @@ -19,6 +21,60 @@ public class DiscountSpec {
private String notes;

/**
* Creates Discount Specification.
*
* @param buyDiscount
* @param sellDiscount
* @param buyFixedFeeDiscount The percentage discount applied to the fixed fee on purchase transactions
* A value of 10 would represent a 10% discount on the fixed fee for buying.
* @param sellFixedFeeDiscount The percentage discount applied to the fixed fee on sale transactions
* A value of 10 would represent a 10% discount on the fixed fee for selling.
* @param validityFrom
* @param validityTill
* @param maximumUsages
* @param maximumUsagesPerIdentity
* @param minimumTransactionAmount
* @param totalLimit
* @param fiatCurrency in which currency are limit amounts
* @param firstTransactionOnly
* @param code (Optional) Defined code to be used (upper-cased) or null for code to be generated.
* @param linkedIdentityPublicId (Optional) Public ID of an existing identity to be linked to the Discount.
* @param notes (Optional) Notes worth noting.
*/
public DiscountSpec(BigDecimal buyDiscount,
BigDecimal sellDiscount,
BigDecimal buyFixedFeeDiscount,
BigDecimal sellFixedFeeDiscount,
Date validityFrom,
Date validityTill,
Long maximumUsages,
Long maximumUsagesPerIdentity,
BigDecimal minimumTransactionAmount,
BigDecimal totalLimit,
String fiatCurrency,
boolean firstTransactionOnly,
String code,
String linkedIdentityPublicId,
String notes) {
this.buyDiscount = buyDiscount;
this.sellDiscount = sellDiscount;
this.buyFixedFeeDiscount = buyFixedFeeDiscount;
this.sellFixedFeeDiscount = sellFixedFeeDiscount;
this.validityFrom = validityFrom;
this.validityTill = validityTill;
this.maximumUsages = maximumUsages;
this.maximumUsagesPerIdentity = maximumUsagesPerIdentity;
this.minimumTransactionAmount = minimumTransactionAmount;
this.totalLimit = totalLimit;
this.fiatCurrency = fiatCurrency;
this.firstTransactionOnly = firstTransactionOnly;
this.code = code;
this.linkedIdentityPublicId = linkedIdentityPublicId;
this.notes = notes;
}

/**
* @deprecated Use first constructor instead.
* Creates Discount Specification.
*
* @param buyDiscount
Expand All @@ -34,7 +90,9 @@ public class DiscountSpec {
* @param code (Optional) Defined code to be used (upper-cased) or null for code to be generated.
* @param linkedIdentityPublicId (Optional) Public ID of an existing identity to be linked to the Discount.
* @param notes (Optional) Notes worth noting.
*
*/
@Deprecated
public DiscountSpec(BigDecimal buyDiscount, BigDecimal sellDiscount, Date validityFrom, Date validityTill, Long maximumUsages, Long maximumUsagesPerIdentity, BigDecimal minimumTransactionAmount, BigDecimal totalLimit, String fiatCurrency, boolean firstTransactionOnly, String code, String linkedIdentityPublicId, String notes) {
this.buyDiscount = buyDiscount;
this.sellDiscount = sellDiscount;
Expand Down Expand Up @@ -67,6 +125,22 @@ public void setSellDiscount(BigDecimal sellDiscount) {
this.sellDiscount = sellDiscount;
}

public BigDecimal getBuyFixedFeeDiscount() {
return buyFixedFeeDiscount;
}

public void setBuyFixedFeeDiscount(BigDecimal buyFixedFeeDiscount) {
this.buyFixedFeeDiscount = buyFixedFeeDiscount;
}

public BigDecimal getSellFixedFeeDiscount() {
return sellFixedFeeDiscount;
}

public void setSellFixedFeeDiscount(BigDecimal sellFixedFeeDiscount) {
this.sellFixedFeeDiscount = sellFixedFeeDiscount;
}

public Date getValidityFrom() {
return validityFrom;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.generalbytes.batm.server.extensions.aml.verification.IIdentityVerificationProvider;
import com.generalbytes.batm.server.extensions.communication.ICommunicationProvider;
import com.generalbytes.batm.server.extensions.communication.IPhoneLookupProvider;
import com.generalbytes.batm.server.extensions.communication.voicecall.IVoiceCallProvider;
import com.generalbytes.batm.server.extensions.watchlist.IWatchList;

import java.util.Set;
Expand Down Expand Up @@ -174,11 +175,17 @@ public interface IExtension {
ITransactionScoringProvider createTransactionScoringProvider(String transactionScoringProviderParamValues);

/**
* Optionally returns external communication providers that can be used by server to sending SMS or making voice calls.
* Optionally returns external communication providers that can be used by server to sending SMS.
* @return
*/
Set<ICommunicationProvider> getCommunicationProviders();

/**
* Optionally returns external communication providers that can be used by server to making voice call.
* @return
*/
Set<IVoiceCallProvider> getVoiceCallProviders();

/**
* @return Validators that can be used to validate SSNs
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,17 @@ public interface IExtensionContext {
*/
boolean addIdentityPiece(String identityPublicId, IIdentityPiece iidentityPiece);

/**
* Update an existing personal info identity piece.
*
* <p>This method can only be used to update <b>Personal Info</b> identity pieces.
*
* @param identityPublicId public ID of an existing identity to be updated
* @param identityPiece identity piece to be updated
* @return true in case of success, false otherwise
*/
boolean updateIdentityPiecePersonalInfo(String identityPublicId, IIdentityPiece identityPiece);

/**
* @param identityId public ID of an existing identity to be updated
* @param state new state to be set
Expand Down
Loading

0 comments on commit 494064e

Please sign in to comment.