001/* 002 * Copyright 2024 Vonage 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package com.vonage.client.messages.whatsapp; 017 018import com.fasterxml.jackson.annotation.JsonProperty; 019import com.vonage.client.JsonableBaseObject; 020import java.util.Currency; 021import java.util.Objects; 022 023/** 024 * Used for inbound product orders. 025 * 026 * @since 7.2.0 027 */ 028public final class ProductItem extends JsonableBaseObject { 029 private String productRetailerId; 030 private Integer quantity; 031 private Double itemPrice; 032 private Currency currency; 033 034 ProductItem() {} 035 036 ProductItem(String productRetailerId) { 037 this.productRetailerId = Objects.requireNonNull(productRetailerId, "Product SKU is required."); 038 } 039 040 /** 041 * The ID of the specific product being ordered. 042 * 043 * @return The product ID. 044 */ 045 @JsonProperty("product_retailer_id") 046 public String getProductRetailerId() { 047 return productRetailerId; 048 } 049 050 /** 051 * The quantity ordered for this specific item. 052 * 053 * @return The order quantity as an integer, or {@code null} if not applicable. 054 */ 055 @JsonProperty("quantity") 056 public Integer getQuantity() { 057 return quantity; 058 } 059 060 /** 061 * The unit price for this specific item. 062 * 063 * @return The order item price as a double, or {@code null} if not applicable. 064 */ 065 @JsonProperty("item_price") 066 public Double getItemPrice() { 067 return itemPrice; 068 } 069 070 /** 071 * The currency code representing the currency for this specific item. 072 * 073 * @return The currency for the order, or {@code null} if not applicable. 074 */ 075 @JsonProperty("currency") 076 public Currency getCurrency() { 077 return currency; 078 } 079}