Code Monkey home page Code Monkey logo

killbill-catalog-plugin-test's Introduction

killbill-catalog-test

Maven Central

This repo is intended as a starting point to build a custom catalog plugin.

Kill Bill compatibility

killbill-catalog-test A test plugin to verify the behavior of the CatalogPluginApi.

The plugin will load a static json catalog (WeaponsHire.pretty.json) and serve that catalog through the CatalogPluginApi.

Minimal functionality has been implemented at this point.

Kill Bill compatibility

Plugin version Kill Bill version
0.2.y 0.18.z
0.3.y 0.20.z
0.4.y 0.22.z
0.5.y 0.24.z

Requirements

There is no requirement aside from running Kill Bill.Based on the configuration, the plugin may expect specific resources to be available or access to file system to load some catalog versions.

Build

mvn clean install -DskipTests

Installation

Locally:

kpm install_java_plugin kb:catalog --from-source-file target/catalog-test-*-SNAPSHOT.jar  --destination /var/tmp/bundles

Use Cases

The main use case for a catalog plugin is to interact with your catalog service existing outside of Kill Bill and map the results into a format compatible with the Kill Bill abstraction by implementing the CatalogPluginApi.

The plugin allows for a flexible per-tenant YAML based configuration to achieve the below :

  • Specify an input XML-based resource file (resources/Weapons.Hire.xml) to be used as the catalog.
  • Specify a file-system based directory to provide the XML versions. This option also allows to serve per-account catalogs.

Configuration Instructions

Assuming a proper yaml configuration, one can configure the plugin using:

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: text/plain' \
-d@<path_to_yam_config> \
http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-catalog-test
  • If you are looking to specify an input XML-based resource file to be used as the catalog, then the YAML configuration would look like :
!!org.killbill.billing.plugin.catalog.CatalogYAMLConfiguration
  uri: WeaponsHire.xml
  validateAccount: false
  accountCatalog: false
  • If you are looking to specify file-system based directory to provide the XML versions which can be used at serve account-level catalogs, then the YAML configuration would look like :
!!org.killbill.billing.plugin.catalog.CatalogYAMLConfiguration
  uri: file:///<some_catalog_directory>
  validateAccount: false
  accountCatalog: true

When using the accountCatalog=true, the directory structure should look like the following:

\ some_catalog_directory \
                           - \ <kb_account_id_1>
                                               - \ v1.xml
                                               - \ v2.xml
                                               - \ v3.xml
                                               - \ ...
                           - \ <kb_account_id_2>
                                 ...

The config validateAccount specifies whether plugin should check for the existence of the account prior serving the catalog.

Testing

  • Build and Install the plugin as mentioned in the above instructions.
  • If you want to test the existing catalog service,then the easiest way is to specify the existing WeaponsHire.xml as described in the above configuration section. The same will be visible in KAUI as well as through API.
  • If you want to test the file system based per-account level catalog, then kindly specify the catalog for the account using the directory structure explained in the above configuration section. The same will be useable for any subscription actions on the account.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.