Skip to content

Commit bdca2b2

Browse files
authored
Merge pull request #94 from xsalefter/generate-killbill-plugin-api-usage-classes
Generate killbill plugin api usage classes
2 parents 060bd2e + 4444a35 commit bdca2b2

9 files changed

Lines changed: 538 additions & 8 deletions

File tree

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@
216216
<artifactId>killbill-plugin-api-payment</artifactId>
217217
<scope>provided</scope>
218218
</dependency>
219+
<dependency>
220+
<groupId>org.kill-bill.billing.plugin</groupId>
221+
<artifactId>killbill-plugin-api-usage</artifactId>
222+
<scope>provided</scope>
223+
</dependency>
219224
<dependency>
220225
<groupId>org.kill-bill.commons</groupId>
221226
<artifactId>killbill-clock</artifactId>

src/main/java/org/killbill/billing/payment/plugin/api/boilerplate/plugin/PaymentPluginApiImp.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,26 @@ public GatewayNotification processNotification(final String notification, final
5656
throw new UnsupportedOperationException("processNotification(java.lang.String, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.CallContext) must be implemented.");
5757
}
5858
@Override
59-
public PaymentTransactionInfoPlugin creditPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) {
60-
throw new UnsupportedOperationException("creditPayment(java.util.UUID, java.util.UUID, java.util.UUID, java.util.UUID, java.math.BigDecimal, org.killbill.billing.catalog.api.Currency, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.CallContext) must be implemented.");
59+
public PaymentTransactionInfoPlugin authorizePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) {
60+
throw new UnsupportedOperationException("authorizePayment(java.util.UUID, java.util.UUID, java.util.UUID, java.util.UUID, java.math.BigDecimal, org.killbill.billing.catalog.api.Currency, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.CallContext) must be implemented.");
6161
}
6262
@Override
6363
public void addPaymentMethod(final UUID kbAccountId, final UUID kbPaymentMethodId, final PaymentMethodPlugin paymentMethodProps, final boolean setDefault, final Iterable<PluginProperty> properties, final CallContext context) {
6464
throw new UnsupportedOperationException("addPaymentMethod(java.util.UUID, java.util.UUID, org.killbill.billing.payment.api.PaymentMethodPlugin, boolean, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.CallContext) must be implemented.");
6565
}
6666
@Override
67-
public PaymentTransactionInfoPlugin authorizePayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) {
68-
throw new UnsupportedOperationException("authorizePayment(java.util.UUID, java.util.UUID, java.util.UUID, java.util.UUID, java.math.BigDecimal, org.killbill.billing.catalog.api.Currency, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.CallContext) must be implemented.");
69-
}
70-
@Override
71-
public List<PaymentTransactionInfoPlugin> getPaymentInfo(final UUID kbAccountId, final UUID kbPaymentId, final Iterable<PluginProperty> properties, final TenantContext context) {
72-
throw new UnsupportedOperationException("getPaymentInfo(java.util.UUID, java.util.UUID, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.TenantContext) must be implemented.");
67+
public PaymentTransactionInfoPlugin creditPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final BigDecimal amount, final Currency currency, final Iterable<PluginProperty> properties, final CallContext context) {
68+
throw new UnsupportedOperationException("creditPayment(java.util.UUID, java.util.UUID, java.util.UUID, java.util.UUID, java.math.BigDecimal, org.killbill.billing.catalog.api.Currency, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.CallContext) must be implemented.");
7369
}
7470
@Override
7571
public PaymentTransactionInfoPlugin voidPayment(final UUID kbAccountId, final UUID kbPaymentId, final UUID kbTransactionId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final CallContext context) {
7672
throw new UnsupportedOperationException("voidPayment(java.util.UUID, java.util.UUID, java.util.UUID, java.util.UUID, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.CallContext) must be implemented.");
7773
}
7874
@Override
75+
public List<PaymentTransactionInfoPlugin> getPaymentInfo(final UUID kbAccountId, final UUID kbPaymentId, final Iterable<PluginProperty> properties, final TenantContext context) {
76+
throw new UnsupportedOperationException("getPaymentInfo(java.util.UUID, java.util.UUID, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.TenantContext) must be implemented.");
77+
}
78+
@Override
7979
public void setDefaultPaymentMethod(final UUID kbAccountId, final UUID kbPaymentMethodId, final Iterable<PluginProperty> properties, final CallContext context) {
8080
throw new UnsupportedOperationException("setDefaultPaymentMethod(java.util.UUID, java.util.UUID, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>, org.killbill.billing.util.callcontext.CallContext) must be implemented.");
8181
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Generated by https://github.com/killbill/api-pojos. Do not edit!
3+
*
4+
* Copyright 2022-2022 The Billing Project, LLC
5+
*
6+
* The Billing Project licenses this file to you under the Apache License,
7+
* version 2.0 (the "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at:
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
* License for the specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
package org.killbill.billing.usage.plugin.api.boilerplate.plugin;
20+
21+
import com.fasterxml.jackson.databind.module.SimpleModule;
22+
23+
public class Module extends SimpleModule {
24+
public Module(){
25+
this.setAbstractTypes(new Resolver());
26+
}
27+
@Override
28+
public String getModuleName(){
29+
return "org.killbill.billing.usage.plugin.api.boilerplate.plugin";
30+
}
31+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Generated by https://github.com/killbill/api-pojos. Do not edit!
3+
*
4+
* Copyright 2022-2022 The Billing Project, LLC
5+
*
6+
* The Billing Project licenses this file to you under the Apache License,
7+
* version 2.0 (the "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at:
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
* License for the specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
package org.killbill.billing.usage.plugin.api.boilerplate.plugin;
20+
21+
import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
22+
import org.killbill.billing.usage.plugin.api.UsageContext;
23+
import org.killbill.billing.usage.plugin.api.UsagePluginApi;
24+
25+
public class Resolver extends SimpleAbstractTypeResolver {
26+
public Resolver(){
27+
this.addMapping(UsageContext.class, UsageContextImp.class);
28+
this.addMapping(UsagePluginApi.class, UsagePluginApiImp.class);
29+
}
30+
}
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
/*
2+
* Generated by https://github.com/killbill/api-pojos. Do not edit!
3+
*
4+
* Copyright 2022-2022 The Billing Project, LLC
5+
*
6+
* The Billing Project licenses this file to you under the Apache License,
7+
* version 2.0 (the "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at:
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
* License for the specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
package org.killbill.billing.usage.plugin.api.boilerplate.plugin;
20+
21+
import com.fasterxml.jackson.annotation.JsonGetter;
22+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
23+
import java.util.Arrays;
24+
import java.util.Objects;
25+
import java.util.UUID;
26+
import org.joda.time.LocalDate;
27+
import org.killbill.billing.invoice.api.DryRunType;
28+
import org.killbill.billing.usage.plugin.api.UsageContext;
29+
30+
@JsonDeserialize( builder = UsageContextImp.Builder.class )
31+
public class UsageContextImp implements UsageContext {
32+
33+
protected UUID accountId;
34+
protected DryRunType dryRunType;
35+
protected LocalDate inputTargetDate;
36+
protected UUID tenantId;
37+
38+
public UsageContextImp(final UsageContextImp that) {
39+
this.accountId = that.accountId;
40+
this.dryRunType = that.dryRunType;
41+
this.inputTargetDate = that.inputTargetDate;
42+
this.tenantId = that.tenantId;
43+
}
44+
protected UsageContextImp(final UsageContextImp.Builder<?> builder) {
45+
this.accountId = builder.accountId;
46+
this.dryRunType = builder.dryRunType;
47+
this.inputTargetDate = builder.inputTargetDate;
48+
this.tenantId = builder.tenantId;
49+
}
50+
protected UsageContextImp() { }
51+
@Override
52+
public UUID getAccountId() {
53+
return this.accountId;
54+
}
55+
@Override
56+
public DryRunType getDryRunType() {
57+
return this.dryRunType;
58+
}
59+
@Override
60+
public LocalDate getInputTargetDate() {
61+
return this.inputTargetDate;
62+
}
63+
@Override
64+
public UUID getTenantId() {
65+
return this.tenantId;
66+
}
67+
@Override
68+
public boolean equals(final Object o) {
69+
if ( this == o ) {
70+
return true;
71+
}
72+
if ( ( o == null ) || ( this.getClass() != o.getClass() ) ) {
73+
return false;
74+
}
75+
final UsageContextImp that = (UsageContextImp) o;
76+
if( !Objects.equals(this.accountId, that.accountId) ) {
77+
return false;
78+
}
79+
if( !Objects.equals(this.dryRunType, that.dryRunType) ) {
80+
return false;
81+
}
82+
if( ( this.inputTargetDate != null ) ? ( 0 != this.inputTargetDate.compareTo(that.inputTargetDate) ) : ( that.inputTargetDate != null ) ) {
83+
return false;
84+
}
85+
if( !Objects.equals(this.tenantId, that.tenantId) ) {
86+
return false;
87+
}
88+
return true;
89+
}
90+
@Override
91+
public int hashCode() {
92+
int result = 1;
93+
result = ( 31 * result ) + Objects.hashCode(this.accountId);
94+
result = ( 31 * result ) + Objects.hashCode(this.dryRunType);
95+
result = ( 31 * result ) + Objects.hashCode(this.inputTargetDate);
96+
result = ( 31 * result ) + Objects.hashCode(this.tenantId);
97+
return result;
98+
}
99+
@Override
100+
public String toString() {
101+
final StringBuffer sb = new StringBuffer(this.getClass().getSimpleName());
102+
sb.append("{");
103+
sb.append("accountId=").append(this.accountId);
104+
sb.append(", ");
105+
sb.append("dryRunType=").append(this.dryRunType);
106+
sb.append(", ");
107+
sb.append("inputTargetDate=").append(this.inputTargetDate);
108+
sb.append(", ");
109+
sb.append("tenantId=").append(this.tenantId);
110+
sb.append("}");
111+
return sb.toString();
112+
}
113+
114+
@SuppressWarnings("unchecked")
115+
public static class Builder<T extends UsageContextImp.Builder<T>> {
116+
117+
protected UUID accountId;
118+
protected DryRunType dryRunType;
119+
protected LocalDate inputTargetDate;
120+
protected UUID tenantId;
121+
122+
public Builder() { }
123+
public Builder(final Builder that) {
124+
this.accountId = that.accountId;
125+
this.dryRunType = that.dryRunType;
126+
this.inputTargetDate = that.inputTargetDate;
127+
this.tenantId = that.tenantId;
128+
}
129+
public T withAccountId(final UUID accountId) {
130+
this.accountId = accountId;
131+
return (T) this;
132+
}
133+
public T withDryRunType(final DryRunType dryRunType) {
134+
this.dryRunType = dryRunType;
135+
return (T) this;
136+
}
137+
public T withInputTargetDate(final LocalDate inputTargetDate) {
138+
this.inputTargetDate = inputTargetDate;
139+
return (T) this;
140+
}
141+
public T withTenantId(final UUID tenantId) {
142+
this.tenantId = tenantId;
143+
return (T) this;
144+
}
145+
public T source(final UsageContext that) {
146+
this.accountId = that.getAccountId();
147+
this.dryRunType = that.getDryRunType();
148+
this.inputTargetDate = that.getInputTargetDate();
149+
this.tenantId = that.getTenantId();
150+
return (T) this;
151+
}
152+
protected Builder validate() {
153+
return this;
154+
}
155+
public UsageContextImp build() {
156+
return new UsageContextImp(this.validate());
157+
}
158+
}
159+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Generated by https://github.com/killbill/api-pojos. Do not edit!
3+
*
4+
* Copyright 2022-2022 The Billing Project, LLC
5+
*
6+
* The Billing Project licenses this file to you under the Apache License,
7+
* version 2.0 (the "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at:
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
* License for the specific language governing permissions and limitations
16+
* under the License.
17+
*/
18+
19+
package org.killbill.billing.usage.plugin.api.boilerplate.plugin;
20+
21+
import com.fasterxml.jackson.annotation.JsonGetter;
22+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
23+
import java.util.Arrays;
24+
import java.util.List;
25+
import java.util.Objects;
26+
import java.util.UUID;
27+
import org.joda.time.DateTime;
28+
import org.killbill.billing.payment.api.PluginProperty;
29+
import org.killbill.billing.usage.api.RawUsageRecord;
30+
import org.killbill.billing.usage.plugin.api.UsageContext;
31+
import org.killbill.billing.usage.plugin.api.UsagePluginApi;
32+
33+
@JsonDeserialize( builder = UsagePluginApiImp.Builder.class )
34+
public class UsagePluginApiImp implements UsagePluginApi {
35+
36+
37+
public UsagePluginApiImp(final UsagePluginApiImp that) {
38+
}
39+
protected UsagePluginApiImp(final UsagePluginApiImp.Builder<?> builder) {
40+
}
41+
protected UsagePluginApiImp() { }
42+
@Override
43+
public List<RawUsageRecord> getUsageForAccount(final DateTime startDate, final DateTime endDate, final UsageContext context, final Iterable<PluginProperty> properties) {
44+
throw new UnsupportedOperationException("getUsageForAccount(org.joda.time.DateTime, org.joda.time.DateTime, org.killbill.billing.usage.plugin.api.UsageContext, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>) must be implemented.");
45+
}
46+
@Override
47+
public List<RawUsageRecord> getUsageForSubscription(final UUID subscriptionId, final DateTime startDate, final DateTime endDate, final UsageContext context, final Iterable<PluginProperty> properties) {
48+
throw new UnsupportedOperationException("getUsageForSubscription(java.util.UUID, org.joda.time.DateTime, org.joda.time.DateTime, org.killbill.billing.usage.plugin.api.UsageContext, java.lang.Iterable<org.killbill.billing.payment.api.PluginProperty>) must be implemented.");
49+
}
50+
@Override
51+
public boolean equals(final Object o) {
52+
if ( this == o ) {
53+
return true;
54+
}
55+
if ( ( o == null ) || ( this.getClass() != o.getClass() ) ) {
56+
return false;
57+
}
58+
return true;
59+
}
60+
@Override
61+
public int hashCode() {
62+
int result = 1;
63+
return result;
64+
}
65+
@Override
66+
public String toString() {
67+
final StringBuffer sb = new StringBuffer(this.getClass().getSimpleName());
68+
sb.append("{");
69+
sb.append("}");
70+
return sb.toString();
71+
}
72+
73+
@SuppressWarnings("unchecked")
74+
public static class Builder<T extends UsagePluginApiImp.Builder<T>> {
75+
76+
77+
public Builder() { }
78+
public Builder(final Builder that) {
79+
}
80+
public T source(final UsagePluginApi that) {
81+
return (T) this;
82+
}
83+
protected Builder validate() {
84+
return this;
85+
}
86+
public UsagePluginApiImp build() {
87+
return new UsagePluginApiImp(this.validate());
88+
}
89+
}
90+
}

src/main/resources/META-INF/services/com.fasterxml.jackson.databind.Module

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ org.killbill.billing.invoice.plugin.api.boilerplate.plugin.Module
4646
org.killbill.billing.currency.plugin.api.boilerplate.plugin.Module
4747

4848

49+
org.killbill.billing.usage.plugin.api.boilerplate.plugin.Module

0 commit comments

Comments
 (0)