001// Generated by delombok at Fri Oct 04 16:05:59 CEST 2024
002/*
003 * Copyright (c) 2010-2024 Mark Allen, Norbert Bartels.
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023package com.restfb.types.send;
024
025import java.util.ArrayList;
026import java.util.Collections;
027import java.util.List;
028import com.restfb.Facebook;
029
030/**
031 * Represents the
032 * <a href="https://developers.facebook.com/docs/messenger-platform/send-api-reference/receipt-template">Receipt
033 * Template Payload</a> type
034 */
035public class ReceiptTemplatePayload extends SharableTemplatePayload {
036  @Facebook("recipient_name")
037  private String recipientName;
038  @Facebook("order_number")
039  private String orderNumber;
040  @Facebook
041  private String currency;
042  @Facebook("merchant_name")
043  private String merchantName;
044  @Facebook("payment_method")
045  private String paymentMethod;
046  @Facebook("order_url")
047  private String orderUrl;
048  @Facebook
049  private Long timestamp;
050  @Facebook
051  private List<ReceiptElement> elements;
052  @Facebook
053  private ReceiptAddress address;
054  @Facebook
055  private ReceiptSummary summary;
056  @Facebook
057  private List<ReceiptAdjustment> adjustments;
058
059  public ReceiptTemplatePayload(String recipientName, String orderNumber, String currency, String paymentMethod, ReceiptSummary summary) {
060    this.recipientName = recipientName;
061    this.orderNumber = orderNumber;
062    this.currency = currency;
063    this.paymentMethod = paymentMethod;
064    this.summary = summary;
065    setTemplateType("receipt");
066  }
067
068  public boolean addElement(ReceiptElement element) {
069    if (elements == null) {
070      elements = new ArrayList<>();
071    }
072    return elements.add(element);
073  }
074
075  public boolean addAdjustment(ReceiptAdjustment adjustment) {
076    if (adjustments == null) {
077      adjustments = new ArrayList<>();
078    }
079    return adjustments.add(adjustment);
080  }
081
082  public List<ReceiptElement> getElements() {
083    return Collections.unmodifiableList(elements);
084  }
085
086  public List<ReceiptAdjustment> getAdjustments() {
087    return Collections.unmodifiableList(adjustments);
088  }
089
090  @java.lang.SuppressWarnings("all")
091  public String getRecipientName() {
092    return this.recipientName;
093  }
094
095  @java.lang.SuppressWarnings("all")
096  public String getOrderNumber() {
097    return this.orderNumber;
098  }
099
100  @java.lang.SuppressWarnings("all")
101  public String getCurrency() {
102    return this.currency;
103  }
104
105  @java.lang.SuppressWarnings("all")
106  public String getMerchantName() {
107    return this.merchantName;
108  }
109
110  @java.lang.SuppressWarnings("all")
111  public void setMerchantName(final String merchantName) {
112    this.merchantName = merchantName;
113  }
114
115  @java.lang.SuppressWarnings("all")
116  public String getPaymentMethod() {
117    return this.paymentMethod;
118  }
119
120  @java.lang.SuppressWarnings("all")
121  public String getOrderUrl() {
122    return this.orderUrl;
123  }
124
125  @java.lang.SuppressWarnings("all")
126  public void setOrderUrl(final String orderUrl) {
127    this.orderUrl = orderUrl;
128  }
129
130  @java.lang.SuppressWarnings("all")
131  public Long getTimestamp() {
132    return this.timestamp;
133  }
134
135  @java.lang.SuppressWarnings("all")
136  public void setTimestamp(final Long timestamp) {
137    this.timestamp = timestamp;
138  }
139
140  @java.lang.SuppressWarnings("all")
141  public ReceiptAddress getAddress() {
142    return this.address;
143  }
144
145  @java.lang.SuppressWarnings("all")
146  public void setAddress(final ReceiptAddress address) {
147    this.address = address;
148  }
149
150  @java.lang.SuppressWarnings("all")
151  public ReceiptSummary getSummary() {
152    return this.summary;
153  }
154}