Skip to content

Commit

Permalink
Fix compilation error after merge, update version in pom.
Browse files Browse the repository at this point in the history
  • Loading branch information
reshmabidikar committed Dec 13, 2022
1 parent dc22170 commit 5349b07
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
~ License for the specific language governing permissions and limitations
~ under the License.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kill-bill.billing</groupId>
<artifactId>killbill-oss-parent</artifactId>
<version>0.145.3-c9eb563-SNAPSHOT</version>
<version>0.146.6</version>
</parent>
<groupId>org.kill-bill.billing.plugin.java</groupId>
<artifactId>hello-world-plugin</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>2.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Kill Bill OSGI Hello World bundle</name>
<description>Kill Bill Hello World plugin</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package org.killbill.billing.plugin.helloworld;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
Expand All @@ -26,20 +28,18 @@
import org.killbill.billing.invoice.api.Invoice;
import org.killbill.billing.invoice.api.InvoiceItem;
import org.killbill.billing.invoice.api.InvoiceItemType;
import org.killbill.billing.invoice.plugin.api.AdditionalItemsResult;
import org.killbill.billing.invoice.plugin.api.InvoiceContext;
import org.killbill.billing.notification.plugin.api.ExtBusEvent;
import org.killbill.billing.osgi.libs.killbill.OSGIConfigPropertiesService;
import org.killbill.billing.osgi.libs.killbill.OSGIKillbillAPI;
import org.killbill.billing.osgi.libs.killbill.OSGIKillbillEventDispatcher.OSGIKillbillEventHandler;
import org.killbill.billing.payment.api.PluginProperty;
import org.killbill.billing.plugin.api.invoice.PluginInvoiceItem;
import org.killbill.billing.plugin.api.invoice.PluginInvoicePluginApi;
import org.killbill.billing.util.callcontext.CallContext;
import org.killbill.billing.util.callcontext.TenantContext;
import org.killbill.clock.Clock;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;

class HelloWorldInvoicePluginApi extends PluginInvoicePluginApi implements OSGIKillbillEventHandler {

public HelloWorldInvoicePluginApi(final OSGIKillbillAPI killbillAPI, final OSGIConfigPropertiesService configProperties,
Expand All @@ -63,13 +63,13 @@ public HelloWorldInvoicePluginApi(final OSGIKillbillAPI killbillAPI, final OSGIC
* items.
*/
@Override
public List<InvoiceItem> getAdditionalInvoiceItems(final Invoice newInvoice, final boolean dryRun,
final Iterable<PluginProperty> properties, final CallContext callContext) {
public AdditionalItemsResult getAdditionalInvoiceItems(final Invoice newInvoice, final boolean dryRun,
final Iterable<PluginProperty> properties, final InvoiceContext invoiceContext) {

final UUID accountId = newInvoice.getAccountId();
final Account account = getAccount(accountId, callContext);
final Set<Invoice> allInvoices = getAllInvoicesOfAccount(account, newInvoice, callContext);
final ImmutableList.Builder<InvoiceItem> additionalItems = ImmutableList.builder();
final Account account = getAccount(accountId, invoiceContext);
final Set<Invoice> allInvoices = getAllInvoicesOfAccount(account, newInvoice, invoiceContext);
final List<InvoiceItem> additionalItems = new LinkedList<InvoiceItem>();

// Creating tax item for first Item of new Invoice
final List<InvoiceItem> newInvoiceItems = newInvoice.getInvoiceItems();
Expand Down Expand Up @@ -102,8 +102,18 @@ public List<InvoiceItem> getAdditionalInvoiceItems(final Invoice newInvoice, fin
break;
}
}

return new AdditionalItemsResult() {
@Override
public List<InvoiceItem> getAdditionalItems() {
return additionalItems;
}

return additionalItems.build();
@Override
public Iterable<PluginProperty> getAdjustedPluginProperties() {
return null;
}
};
}

/**
Expand All @@ -116,10 +126,10 @@ public List<InvoiceItem> getAdditionalInvoiceItems(final Invoice newInvoice, fin
* @return All invoices of account
*/
private Set<Invoice> getAllInvoicesOfAccount(final Account account, final Invoice newInvoice, final TenantContext tenantCtx) {
final ImmutableSet.Builder<Invoice> builder = ImmutableSet.builder();
builder.addAll(getInvoicesByAccountId(account.getId(), tenantCtx));
builder.add(newInvoice);
return builder.build();
final Set<Invoice> invoices = new HashSet<Invoice>();
invoices.addAll(getInvoicesByAccountId(account.getId(), tenantCtx));
invoices.add(newInvoice);
return invoices;
}

/**
Expand Down

0 comments on commit 5349b07

Please sign in to comment.