All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.messenger4j.send.message.template.ReceiptTemplate Maven / Gradle / Ivy

Go to download

The ultimate Java library for building Chatbots on the Facebook Messenger Platform

There is a newer version: 1.1.0
Show newest version
package com.github.messenger4j.send.message.template;

import static java.util.Optional.empty;

import com.github.messenger4j.internal.Lists;
import com.github.messenger4j.internal.gson.OptionalInstantToSecondsStringSerializer;
import com.github.messenger4j.send.message.template.receipt.Address;
import com.github.messenger4j.send.message.template.receipt.Adjustment;
import com.github.messenger4j.send.message.template.receipt.Item;
import com.github.messenger4j.send.message.template.receipt.Summary;
import com.google.gson.annotations.JsonAdapter;
import java.net.URL;
import java.time.Instant;
import java.util.List;
import java.util.Optional;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import lombok.ToString;

/**
 * @author Max Grabenhorst
 * @since 1.0.0
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class ReceiptTemplate extends Template {

    private final String recipientName;
    private final String orderNumber;
    private final String paymentMethod;
    private final String currency;
    private final Summary summary;
    private final Optional
address; private final Optional> elements; private final Optional> adjustments; private final Optional merchantName; private final Optional orderUrl; private final Optional sharable; @JsonAdapter(OptionalInstantToSecondsStringSerializer.class) private final Optional timestamp; public static ReceiptTemplate create(@NonNull String recipientName, @NonNull String orderNumber, @NonNull String paymentMethod, @NonNull String currency, @NonNull Summary summary) { return create(recipientName, orderNumber, paymentMethod, currency, summary, empty(), empty(), empty(), empty(), empty(), empty(), empty()); } public static ReceiptTemplate create(@NonNull String recipientName, @NonNull String orderNumber, @NonNull String paymentMethod, @NonNull String currency, @NonNull Summary summary, @NonNull Optional
address, @NonNull Optional> elements, @NonNull Optional> adjustments, @NonNull Optional merchantName, @NonNull Optional orderUrl, @NonNull Optional sharable, @NonNull Optional timestamp) { return new ReceiptTemplate(recipientName, orderNumber, paymentMethod, currency, summary, address, elements, adjustments, merchantName, orderUrl, sharable, timestamp); } private ReceiptTemplate(String recipientName, String orderNumber, String paymentMethod, String currency, Summary summary, Optional
address, Optional> elements, Optional> adjustments, Optional merchantName, Optional orderUrl, Optional sharable, Optional timestamp) { super(Type.RECEIPT); this.recipientName = recipientName; this.orderNumber = orderNumber; this.paymentMethod = paymentMethod; this.currency = currency; this.summary = summary; this.address = address; this.elements = elements.map(Lists::immutableList); this.adjustments = adjustments.map(Lists::immutableList); this.merchantName = merchantName; this.orderUrl = orderUrl; this.sharable = sharable; this.timestamp = timestamp; } public String recipientName() { return recipientName; } public String orderNumber() { return orderNumber; } public String paymentMethod() { return paymentMethod; } public String currency() { return currency; } public Summary summary() { return summary; } public Optional
address() { return address; } public Optional> elements() { return elements; } public Optional> adjustments() { return adjustments; } public Optional merchantName() { return merchantName; } public Optional orderUrl() { return orderUrl; } public Optional sharable() { return sharable; } public Optional timestamp() { return timestamp; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy