org.killbill.billing.plugin.api.payment.PluginGatewayNotification Maven / Gradle / Ivy
/*
* Copyright 2014-2020 Groupon, Inc
* Copyright 2020-2020 Equinix, Inc
* Copyright 2014-2020 The Billing Project, LLC
*
* The Billing Project licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.killbill.billing.plugin.api.payment;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.killbill.billing.payment.api.PluginProperty;
import org.killbill.billing.payment.plugin.api.GatewayNotification;
import org.killbill.billing.payment.plugin.api.boilerplate.GatewayNotificationImp;
@JsonDeserialize( builder = PluginGatewayNotification.Builder.class )
public class PluginGatewayNotification extends GatewayNotificationImp {
public PluginGatewayNotification(final String entity) {
this(null,
200,
entity,
ImmutableMap.>of(),
ImmutableList.of());
}
public PluginGatewayNotification(final UUID kbPaymentId,
final int status,
final String entity,
final Map> headers,
final List properties) {
this(new Builder<>()
.withKbPaymentId(kbPaymentId)
.withStatus(status)
.withEntity(entity)
.withHeaders(headers)
.withProperties(properties)
.validate());
}
protected PluginGatewayNotification(final PluginGatewayNotification.Builder> builder) {
super(builder);
}
public PluginGatewayNotification(final PluginGatewayNotification that) {
super(that);
}
@SuppressWarnings("unchecked")
public static class Builder>
extends GatewayNotificationImp.Builder {
public Builder() {
this.withStatus(200);
this.withHeaders(ImmutableMap.>of());
this.withProperties(ImmutableList.of());
}
public Builder(final Builder that) {
super(that);
}
@Override
public Builder validate() {
return this;
}
@Override
public PluginGatewayNotification build() {
return new PluginGatewayNotification(validate());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy