Skip to content

Commit

Permalink
Merge branch 'GENERALBYTESCOM:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
verumcoin authored Jul 15, 2024
2 parents 5b10ab5 + b13496a commit 8df52be
Show file tree
Hide file tree
Showing 198 changed files with 7,754 additions and 3,264 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew clean build
32 changes: 28 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 template 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 Expand Up @@ -140,3 +152,15 @@ By default, verification-site runs on port 8443. You should change it and most i
```bash
java -jar verification_site-<ver>.jar --server.port=443 --security.require-ssl=true --server.ssl.key-store=/etc/letsencrypt/live/example.com/keystore.p12 --server.ssl.key-store-password=<your-password> --server.ssl.keyStoreType=PKCS12 --server.ssl.keyAlias=tomcat
```
How to enable extension hot reload feature
=================
You can turn on/off extension hot reaload feature to be able to replace extension classes without restarting CAS.

:warning: Use this feature with caution as it may allow anyone with access to the server to change extension code on the fly.

To enable hot reload feature you need to modify `/batm/config/extensions` configuration file and set:

```
hot-reload=true
```
33 changes: 3 additions & 30 deletions annotations/build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
apply plugin: "java"
apply plugin: "com.generalbytes.gradle.main"
apply plugin: 'maven-publish'
plugins {
id("shared-build-conventions")
}

group = projectGroup
version = projectVersion

publishing {
if (hasGbUploadArtifactory) {
repositories {
maven {
credentials {
username gbArtifactoryUser
password gbArtifactoryPassword
}
url gbArtifactoryUploadUrl
}
}
}

publications {
mavenJava(MavenPublication) {
from components.java
}
}
}

dependencySubstitutions {
substitute file(batmDependencySubstitutionConfig)
}
dependencyVerifications {
checksums batmDependencyChecksumsConfig
printUnusedAssertions false
}
21 changes: 12 additions & 9 deletions batm_ssh_tunnel/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
apply plugin: "java"
apply plugin: 'application'
plugins {
id("application")
id("shared-build-conventions")
}

version = "1.0.0"

application {
mainClassName = 'com.generalbytes.batm.sshtunnel.Main'
mainClass = "com.generalbytes.batm.sshtunnel.Main"
}

distributions {
Expand All @@ -18,12 +20,13 @@ distributions {
}
}

configurations.configureEach {
exclude group: "org.eclipse.ee4j"
}

dependencies {
compile(group: 'org.apache.sshd', name: 'sshd-core', version: '2.3.0')
compile(group: 'org.apache.sshd', name: 'sshd-common', version: '2.3.0')
compile(group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3')

compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.63'

implementation("org.apache.sshd:sshd-core:2.3.0")
implementation("org.apache.sshd:sshd-common:2.3.0")
implementation("ch.qos.logback:logback-classic:1.2.9")
implementation("org.bouncycastle:bcpkix-jdk15on:1.63")
}
71 changes: 0 additions & 71 deletions build.gradle

This file was deleted.

7 changes: 7 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id 'groovy-gradle-plugin'
}

repositories {
gradlePluginPortal()
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class GBGradlePlugin implements Plugin<Project> {
project.dependencyVerifications.configuration('releaseRuntimeClasspath')
project.dependencyVerifications.configuration('debugRuntimeClasspath')
} else if (pluginMgr.hasPlugin('org.gradle.java')) {
project.dependencyVerifications.configuration('runtime')
project.dependencyVerifications.configuration('runtimeClasspath')
}

final Configuration buildScriptClasspathConfiguration =
Expand Down
40 changes: 40 additions & 0 deletions buildSrc/src/main/groovy/shared-build-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
plugins {
id("java")
id("com.generalbytes.gradle.main")
id("shared-publish-conventions")
}

repositories {
mavenCentral()
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.incremental = true
}

dependencySubstitutions {
substitute file("$project.rootDir/dependencySubstitutions.txt")
}

tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

afterEvaluate {
if (pluginManager.hasPlugin('com.generalbytes.gradle.dependency.verification')) {
dependencyChecksums {
global = true
}
dependencyVerifications {
setConfigurations([]) // effectively turns off all checksum verifications - replaced by gradle's verification-metadata.xml
}
}
}
29 changes: 29 additions & 0 deletions buildSrc/src/main/groovy/shared-publish-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plugins {
id("maven-publish")
}

publishing {
if (hasGbUploadArtifactory()) {
repositories {
maven {
credentials {
username gbArtifactoryUser
password gbArtifactoryPassword
}
url gbArtifactoryUploadUrl
}
}
}

publications {
mavenJava(MavenPublication) {
from components.java
}
}
}

private boolean hasGbUploadArtifactory() {
return project.hasProperty("gbArtifactoryUploadUrl")
&& project.hasProperty("gbArtifactoryUser")
&& project.hasProperty("gbArtifactoryPassword")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ext {
hasGbArtifactory = hasGbArtifactory()
}

repositories {
maven {
url = uri("https://jitpack.io")
}
if (hasGbArtifactory) {
maven {
url = uri(project.findProperty("gbArtifactoryUrl").toString())
credentials {
username = project.findProperty("gbArtifactoryUser").toString()
password = project.findProperty("gbArtifactoryPassword").toString()
}
}
}
}

private boolean hasGbArtifactory() {
return project.hasProperty('gbArtifactoryUrl')
&& project.hasProperty('gbArtifactoryUser')
&& project.hasProperty('gbArtifactoryPassword')
}
39 changes: 5 additions & 34 deletions currencies/build.gradle
Original file line number Diff line number Diff line change
@@ -1,40 +1,11 @@
apply plugin: "java"
apply plugin: "com.generalbytes.gradle.main"
apply plugin: 'maven-publish'
plugins {
id("shared-build-conventions")
}

group = projectGroup
version = projectVersion


dependencies {
compile(group: 'org.slf4j', name: 'slf4j-api', version: '1.7.28')
testCompile (group: 'junit', name: 'junit', version: '4.13.1')
}

publishing {
if (hasGbUploadArtifactory) {
repositories {
maven {
credentials {
username gbArtifactoryUser
password gbArtifactoryPassword
}
url gbArtifactoryUploadUrl
}
}
}

publications {
mavenJava(MavenPublication) {
from components.java
}
}
}

dependencySubstitutions {
substitute file(batmDependencySubstitutionConfig)
}
dependencyVerifications {
checksums batmDependencyChecksumsConfig
printUnusedAssertions false
implementation("org.slf4j:slf4j-api:1.7.28")
testImplementation("junit:junit:4.13.1")
}
Loading

0 comments on commit 8df52be

Please sign in to comment.