https://github.com/killbill/killbill-currency-plugin
A default currency plugin based on a set of static currency conversion tables
https://github.com/killbill/killbill-currency-plugin
Last synced: 7 months ago
JSON representation
A default currency plugin based on a set of static currency conversion tables
- Host: GitHub
- URL: https://github.com/killbill/killbill-currency-plugin
- Owner: killbill
- License: apache-2.0
- Created: 2023-07-11T12:05:01.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-03T22:17:09.000Z (almost 3 years ago)
- Last Synced: 2024-12-28T10:28:59.961Z (over 1 year ago)
- Language: Java
- Size: 42 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# killbill-currency-plugin
A default currency plugin based on a set of static currency conversion tables.
## Kill Bill compatibility
| Plugin version | Kill Bill version |
|---------------:|------------------:|
| 0.0.y | 0.22.z |
| 1.0.y | 0.24.z |
## Requirements
The plugin needs a database. The latest version of the schema can be found [here](https://github.com/killbill/killbill-currency-plugin/blob/master/src/main/resources/ddl.sql).
## Development
To install the plugin from sources:
```
kpm install_java_plugin currency --from-source-file target/currency-*-SNAPSHOT.jar --destination /var/tmp/bundles
```
## REST API
To add currency conversion rates for a given base currency and date:
```
curl -v \
-X POST \
-u admin:password \
-H 'X-Killbill-ApiKey: bob' \
-H 'X-Killbill-ApiSecret: lazar' \
-H 'X-Killbill-CreatedBy: admin' \
-H 'Content-Type: application/json' \
-d '{"baseCurrency":"USD","conversionDate":"2013-10-10T20:41:09Z","rates":{"BRL":"0.45721","EUR":"1.38045","GBP":"1.61650"}}' \
http://127.0.0.1:8080/plugins/killbill-currency/rates
```
To get all current rates for a given base currency:
```
curl -v \
-u admin:password \
-H 'X-Killbill-ApiKey: bob' \
-H 'X-Killbill-ApiSecret: lazar' \
'http://127.0.0.1:8080/plugins/killbill-currency/rates?baseCurrency=USD'
```
## Usage in a custom plugin
Create a `ServiceTracker` to track the `CurrencyPluginApi`:
```
ServiceTracker currencyPluginApiServiceTracker = new ServiceTracker<>(context, CurrencyPluginApi.class, null);
currencyPluginApiServiceTracker.open();
```
The API can then be used in your plugin, e.g.:
```
currencyPluginApiServiceTracker.getService().getBaseCurrencies()
```
## About
Kill Bill is the leading Open-Source Subscription Billing & Payments Platform. For more information about the project, go to https://killbill.io/.