Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ name: ci

on:
- push
- pull_request
- workflow_dispatch

jobs:
ci:
uses: killbill/gh-actions-shared/.github/workflows/ci.yml@main
with:
test-profile-matrix: '[ "travis", "integration-mysql", "integration-postgresql" ]'
jdk-matrix: '[ "8", "11" ]'
secrets:
extra-env: '{ "VERTEX_URL": "${{ secrets.VERTEX_URL }}", "VERTEX_CLIENT_ID": "${{ secrets.VERTEX_CLIENT_ID }}", "VERTEX_CLIENT_SECRET": "${{ secrets.VERTEX_CLIENT_SECRET }}", "VERTEX_COMPANY_NAME": "${{ secrets.VERTEX_COMPANY_NAME }}", "VERTEX_COMPANY_DIVISION": "${{ secrets.VERTEX_COMPANY_DIVISION }}"}'
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: release

on:
workflow_dispatch:
inputs:
parent_version:
description: 'New killbill-oss-parent version'
required: false
default: ''
perform_version:
description: 'tag to (re-)perform (in case of release:perform failure)'
required: false
default: ''

env:
MAVEN_FLAGS: "-B --no-transfer-progress"
MAVEN_OPTS: "-Xmx2G -XX:+ExitOnOutOfMemoryError -Dmaven.wagon.rto=60000 -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
if: github.event.inputs.perform_version == ''
uses: actions/checkout@v2
- name: Checkout full repository
# Required when performing an existing release.
if: github.event.inputs.perform_version != ''
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Setup git user
env:
BUILD_USER: ${{ secrets.BUILD_USER }}
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
run: |
git config --global user.email "contact@killbill.io"
git config --global user.name "Kill Bill core team"
git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:"
- name: Configure Java
uses: actions/setup-java@v1
with:
java-version: 11
- name: Download Java dependencies
# We do as much as we can, but it may not be enough (https://issues.apache.org/jira/browse/MDEP-82)
run: |
mvn ${MAVEN_FLAGS} clean install dependency:resolve dependency:resolve-plugins -DskipTests=true -Dgpg.skip=true -Psonatype-oss-release
- name: Update killbill-oss-parent
if: github.event.inputs.parent_version != ''
run: |
echo "Updating killbill-oss-parent pom.xml to ${{ github.event.inputs.parent_version }}:"
mvn ${MAVEN_FLAGS} versions:update-parent -DgenerateBackupPoms=false -DparentVersion="[${{ github.event.inputs.parent_version }}]"
echo "killbill-oss-parent pom.xml changes:"
git --no-pager diff
echo "Downloading new dependencies:"
mvn ${MAVEN_FLAGS} -U clean install -DskipTests=true

git add pom.xml
# Will be pushed as part of the release process, only if the release is successful
git commit -m "pom.xml: update killbill-oss-parent to ${{ github.event.inputs.parent_version }}"
- name: Configure settings.xml for release
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Release artifacts
if: github.event.inputs.perform_version == ''
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# It will still check the remote but hopefully not download much (0 B at 0 B/s). -o isn't safe because of MDEP-82 (see above).
run: |
mvn ${MAVEN_FLAGS} release:clean release:prepare release:perform
- name: Perform release
if: github.event.inputs.perform_version != ''
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# It will still check the remote but hopefully not download much (0 B at 0 B/s). -o isn't safe because of MDEP-82 (see above).
# See https://issues.apache.org/jira/browse/SCM-729 for why the release.properties file is required.
run: |
echo "scm.url=scm\:git\:git@github.com\:${GITHUB_REPOSITORY}.git" > release.properties
echo "scm.tag=${{ github.event.inputs.perform_version }}" >> release.properties
mvn ${MAVEN_FLAGS} release:perform
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ Kill Bill compatibility
-----------------------

| Plugin version | Kill Bill version |
| -------------: | ----------------: |
| 0.1.y | 0.22.z |
|---------------:|------------------:|
| 0.1.y | 0.22.z |
| 0.2.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-vertex-plugin/tree/master/src/main/resources).

Configuration
-------------

Expand Down
68 changes: 48 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
<parent>
<groupId>org.kill-bill.billing</groupId>
<artifactId>killbill-oss-parent</artifactId>
<version>0.144.85</version>
<version>0.146.63</version>
</parent>
<groupId>org.kill-bill.billing.plugin.java</groupId>
<artifactId>vertex-plugin</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.2.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Kill Bill OSGI Vertex plugin</name>
<description>Kill Bill Vertex plugin</description>
Expand Down Expand Up @@ -57,7 +57,8 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.4.1</version> <!-- Fixed https://devhub.checkmarx.com/cve-details/CVE-2022-42004/-->
<version>2.13.4.1</version>
<!-- Fixed https://devhub.checkmarx.com/cve-details/CVE-2022-42004/-->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
Expand Down Expand Up @@ -88,17 +89,12 @@
</dependency>
<dependency>
<groupId>io.airlift</groupId>
<artifactId>testing-mysql-server</artifactId>
<artifactId>units</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.airlift</groupId>
<artifactId>testing-postgresql-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.airlift</groupId>
<artifactId>units</artifactId>
<groupId>io.zonky.test</groupId>
<artifactId>embedded-postgres</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -107,13 +103,13 @@
<version>1.3.5</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
Expand Down Expand Up @@ -147,10 +143,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand All @@ -170,6 +162,12 @@
<groupId>org.kill-bill.billing</groupId>
<artifactId>killbill-platform-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kill-bill.billing.plugin</groupId>
Expand All @@ -179,12 +177,37 @@
<dependency>
<groupId>org.kill-bill.billing.plugin.java</groupId>
<artifactId>killbill-base-plugin</artifactId>
<exclusions>
<exclusion>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>

</exclusions>
</dependency>
<dependency>
<groupId>org.kill-bill.billing.plugin.java</groupId>
<artifactId>killbill-base-plugin</artifactId>
<type>test-jar</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kill-bill.commons</groupId>
Expand All @@ -205,6 +228,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kill-bill.testing</groupId>
<artifactId>testing-mysql-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
import org.killbill.billing.account.api.Account;
import org.killbill.billing.invoice.api.Invoice;
import org.killbill.billing.invoice.api.InvoiceItem;
import org.killbill.billing.invoice.plugin.api.AdditionalItemsResult;
import org.killbill.billing.invoice.plugin.api.InvoiceContext;
import org.killbill.billing.invoice.plugin.api.OnSuccessInvoiceResult;
import org.killbill.billing.osgi.libs.killbill.OSGIConfigPropertiesService;
import org.killbill.billing.osgi.libs.killbill.OSGIKillbillAPI;
import org.killbill.billing.payment.api.PluginProperty;
import org.killbill.billing.plugin.api.PluginProperties;
import org.killbill.billing.plugin.api.invoice.PluginAdditionalItemsResult;
import org.killbill.billing.plugin.api.invoice.PluginInvoicePluginApi;
import org.killbill.billing.plugin.vertex.dao.VertexDao;
import org.killbill.billing.plugin.vertex.gen.ApiException;
Expand Down Expand Up @@ -71,12 +73,12 @@ public VertexInvoicePluginApi(final VertexApiConfigurationHandler vertexApiConfi
}

@Override
public List<InvoiceItem> getAdditionalInvoiceItems(final Invoice invoice,
final boolean dryRun,
final Iterable<PluginProperty> properties,
final CallContext context) {
public AdditionalItemsResult getAdditionalInvoiceItems(final Invoice invoice,
final boolean dryRun,
final Iterable<PluginProperty> properties,
final InvoiceContext context) {
if (PluginProperties.findPluginPropertyValue("VERTEX_SKIP", properties) != null) {
return ImmutableList.of();
return null;
}

final Collection<PluginProperty> pluginProperties = Lists.newArrayList(properties);
Expand All @@ -86,7 +88,9 @@ public List<InvoiceItem> getAdditionalInvoiceItems(final Invoice invoice,
checkForTaxCodes(invoice, pluginProperties, context);

try {
return calculator.compute(account, invoice, dryRun, pluginProperties, context);
List<InvoiceItem> invoiceItems = calculator.compute(account, invoice, dryRun, pluginProperties, context);
final AdditionalItemsResult additionalItemsResult = new PluginAdditionalItemsResult(invoiceItems, null);
return additionalItemsResult;
} catch (final Exception e) {
// Prevent invoice generation
throw new RuntimeException(e);
Expand Down
Loading
Loading