jp.gopay.sdk.builders.charge.AbstractChargesBuilders Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gopay-java-sdk Show documentation
Show all versions of gopay-java-sdk Show documentation
Official Gyro-n Payments Java SDK
package jp.gopay.sdk.builders.charge;
import jp.gopay.sdk.builders.IdempotentRetrofitRequestBuilder;
import jp.gopay.sdk.builders.Polling;
import jp.gopay.sdk.builders.RetrofitRequestBuilder;
import jp.gopay.sdk.builders.RetrofitRequestBuilderPaginated;
import jp.gopay.sdk.models.common.*;
import jp.gopay.sdk.models.common.Void;
import jp.gopay.sdk.models.request.charge.CardChargeSearch;
import jp.gopay.sdk.models.response.charge.Charge;
import jp.gopay.sdk.types.MetadataMap;
import jp.gopay.sdk.utils.MetadataAdapter;
import retrofit2.Retrofit;
import java.util.Date;
public abstract class AbstractChargesBuilders {
public static abstract class AbstractListChargesRequestBuilder
extends RetrofitRequestBuilderPaginated {
protected StoreId storeId;
protected CardChargeSearch propertySearch = new CardChargeSearch();
protected String metadataSearch;
protected StoreId getStoreId() {
return storeId;
}
public AbstractListChargesRequestBuilder(Retrofit retrofit) {
super(retrofit);
}
public AbstractListChargesRequestBuilder(Retrofit retrofit, StoreId storeId) {
super(retrofit);
this.storeId = storeId;
}
public B withCardChargeSearch(CardChargeSearch search){
this.propertySearch = search;
return (B)this;
}
public B withMetadataSearch(String search){
this.metadataSearch = search;
return (B)this;
}
}
public static abstract class AbstractGetChargeRequestBuilder
extends RetrofitRequestBuilder implements Polling{
protected StoreId storeId;
protected ChargeId chargeId;
protected Boolean polling;
protected StoreId getStoreId() {
return storeId;
}
protected ChargeId getChargeId() {
return chargeId;
}
public AbstractGetChargeRequestBuilder(Retrofit retrofit, StoreId storeId, ChargeId chargeId) {
super(retrofit);
this.storeId = storeId;
this.chargeId = chargeId;
}
public B withPolling(boolean polling){
this.polling = polling;
return (B)this;
}
}
public static abstract class AbstractCreateChargeRequestBuilder
extends IdempotentRetrofitRequestBuilder {
protected TransactionTokenId transactionTokenId;
protected MoneyLike money;
protected Boolean onlyDirectCurrency;
protected Date captureAt;
protected Boolean capture;
protected String descriptor;
protected MetadataMap metadata;
protected TransactionTokenId getTransactionTokenId() {
return transactionTokenId;
}
public MoneyLike getMoney() {
return money;
}
public Boolean getOnlyDirectCurrency() {
return onlyDirectCurrency;
}
public Date getCaptureAt() {
return captureAt;
}
public Boolean getCapture() {
return capture;
}
public String getDescriptor() {
return descriptor;
}
protected MetadataMap getMetadata() {
return metadata;
}
public AbstractCreateChargeRequestBuilder(Retrofit retrofit, TransactionTokenId transactionTokenId, MoneyLike money, Boolean capture) {
super(retrofit);
this.transactionTokenId = transactionTokenId;
this.money = money;
this.capture = capture;
}
public B withOnlyDirectCurrency(Boolean onlyDirectCurrency) {
this.onlyDirectCurrency = onlyDirectCurrency;
return (B)this;
}
public B withCaptureAt(Date captureAt) {
this.captureAt = captureAt;
return (B)this;
}
public B withDescriptor(String descriptor) {
this.descriptor = descriptor;
return (B)this;
}
public B withMetadata(MetadataMap metadata) {
this.metadata = metadata;
return (B)this;
}
public B withMetadata(T metadata, MetadataAdapter adapter) {
this.metadata = adapter.serialize(metadata);
return (B)this;
}
}
public static abstract class AbstractUpdateChargeRequestBuilder
extends IdempotentRetrofitRequestBuilder {
protected StoreId storeId;
protected ChargeId chargeId;
protected MetadataMap metadata;
public StoreId getStoreId() {
return storeId;
}
public ChargeId getChargeId() {
return chargeId;
}
protected MetadataMap getMetadata() {
return metadata;
}
public AbstractUpdateChargeRequestBuilder(Retrofit retrofit, StoreId storeId, ChargeId chargeId) {
super(retrofit);
this.storeId = storeId;
this.chargeId = chargeId;
}
public B withMetadata(MetadataMap metadata) {
this.metadata = metadata;
return (B)this;
}
public B withMetadata(T metadata, MetadataAdapter adapter) {
this.metadata = adapter.serialize(metadata);
return (B)this;
}
}
public static abstract class AbstractCaptureAuthorizedChargeRequestBuilder
extends IdempotentRetrofitRequestBuilder {
protected StoreId storeId;
protected ChargeId chargeId;
protected MoneyLike money;
public MoneyLike getMoney() {
return money;
}
public StoreId getStoreId() {
return storeId;
}
public ChargeId getChargeId() {
return chargeId;
}
public AbstractCaptureAuthorizedChargeRequestBuilder(Retrofit retrofit, StoreId storeId, ChargeId chargeId, MoneyLike money) {
super(retrofit);
this.storeId = storeId;
this.chargeId = chargeId;
this.money = money;
}
}
}