Skip to content

Commit

Permalink
Issue #1157 - whatsapp objects improved
Browse files Browse the repository at this point in the history
  • Loading branch information
nbartels committed Jun 5, 2021
1 parent ce9647d commit 952401e
Show file tree
Hide file tree
Showing 7 changed files with 410 additions and 0 deletions.
62 changes: 62 additions & 0 deletions src/main/lombok/com/restfb/types/whatsapp/CurrencyAmount.java
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2010-2021 Mark Allen, Norbert Bartels.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.restfb.types.whatsapp;

import com.restfb.Facebook;

import lombok.Getter;
import lombok.Setter;

public class CurrencyAmount {

/**
* Value of the amount in whole currency units (USD 123.45 = "123.45")
*/
@Getter
@Setter
@Facebook
private String amount;

/**
* Value of the amount in hundredths, i.e. (USD 123.45 = "12345", JYP 1 = "100")
*/
@Getter
@Setter
@Facebook("amount_in_hundredths")
private String amountInHundredths;

/**
* Currency in which amount is given
*/
@Getter
@Setter
@Facebook
private String currency;

/**
* Value of the amount in cents (USD 123.45 = "12345")
*/
@Getter
@Setter
@Facebook("offsetted_amount")
private String offsettedAmount;
}
160 changes: 160 additions & 0 deletions src/main/lombok/com/restfb/types/whatsapp/ExtendedCredit.java
@@ -0,0 +1,160 @@
/*
* Copyright (c) 2010-2021 Mark Allen, Norbert Bartels.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.restfb.types.whatsapp;

import com.restfb.Facebook;
import com.restfb.types.FacebookType;
import com.restfb.types.ads.Business;

import lombok.Getter;
import lombok.Setter;

public class ExtendedCredit extends FacebookType {

/**
* The total amount of credit that has been granted to other businesses.
*
* Going forward, credentials are measured in USD at the top level, and attachable
* to ad accounts of multiple currencies.
*/
@Getter
@Setter
@Facebook("allocated_amount")
private CurrencyAmount allocatedAmount;

/**
* The total amount spent.
*
* This is calculated by adding parent ad account and all child ad accounts.
* Going forward, credentials are measured in USD at the top level, and attachable
* to ad accounts of multiple currencies.
*/
@Getter
@Setter
@Facebook
private CurrencyAmount balance;

/**
* The credit available to this business
*/
@Getter
@Setter
@Facebook("credit_available")
private CurrencyAmount creditAvailable;

/**
* The type of extended credit used.
*
* The most common are ADS_BUSINESS and ADS_SEQUENTIAL
*/
@Getter
@Setter
@Facebook("credit_type")
private String creditType;

/**
* Returns true if credit owner removed access for previously shared credit line
*/
@Getter
@Setter
@Facebook("is_access_revoked")
private Boolean isAccessRevoked;

/**
* Whether this credential is using the fully automated experience
*/
@Getter
@Setter
@Facebook("is_automated_experience")
private Boolean isAutomatedExperience;

/**
* The legal entity name of the owner of a line
*/
@Getter
@Setter
@Facebook("legal_entity_name")
private String legalEntityName;

/**
* When this credit is chosen as the payment method,
* the business name of the liable_party
*/
@Getter
@Setter
@Facebook("liable_biz_name")
private String liableBizName;

/**
* The amount of credit available to a specific business.
*
* Going forward, credentials are measured in USD at the top level, and
* attachable to ad accounts of multiple currencies.
*/
@Getter
@Setter
@Facebook("max_balance")
private CurrencyAmount maxBalance;

/**
* The raw credit limit for an entire business.
*
* Going forward, credentials are measured in USD at the top level, and
* attachable to ad accounts of multiple currencies.
*/
@Getter
@Setter
@Facebook("online_max_balance")
private CurrencyAmount onlineMaxBalance;

/**
* The business account responsible for extended credit payment
*/
@Getter
@Setter
@Facebook("owner_business")
private Business ownerBusiness;

/**
* The name of the business account responsible for extended credit payment
*/
@Getter
@Setter
@Facebook("owner_business_name")
private String ownerBusinessName;

/**
* The name of the business that granted the credit line. For ADS_SEQUENTIAL credit types
*/
@Getter
@Setter
@Facebook("partition_from")
private String partitionFrom;

/**
* When this credit is chosen as the payment method, the business name of the bill_to_party
*/
@Getter
@Setter
@Facebook("send_bill_to_biz_name")
private String sendBillToBizNname;
}
Expand Up @@ -36,6 +36,14 @@ public class WhatsAppBusinessAccount extends NamedFacebookType {

private static final long serialVersionUID = 1L;

/**
* Status from account review process
*/
@Getter
@Setter
@Facebook("account_review_status")
private String accountReviewStatus;

/**
* Analytics data of the WhatsApp Business Account
*/
Expand Down Expand Up @@ -69,12 +77,28 @@ public class WhatsAppBusinessAccount extends NamedFacebookType {
@Facebook("ineligible_for_sending_notifications_reason")
private String ineligibleForSendingNotificationsReason;

/**
* Namespace string for the message templates that belong to the WhatsApp Business Account
*/
@Getter
@Setter
@Facebook("message_template_namespace")
private String messageTemplateNamespace;

// WABAOnBehalfOfComputedInfo is not defined in Graph API reference
// @Getter
// @Setter
// @Facebook("WABAOnBehalfOfComputedInfo")
// private WABAOnBehalfOfComputedInfo onBehalfOfBusinessInfo;

/**
* Primary funding ID for the WhatsApp Business Account paid service
*/
@Getter
@Setter
@Facebook("primary_funding_id")
private String primaryFundingId;

/**
* The purchase order number supplied by the business for payment management purposes
*/
Expand Down
Expand Up @@ -36,11 +36,23 @@ public class WhatsAppBusinessAccountToNumberCurrentStatus extends FacebookType {

private static final long serialVersionUID = 1L;

@Getter
@Setter
@Facebook("account_mode")
private String accountMode;

@Getter
@Setter
@Facebook
private String certificate;

@Deprecated
@Getter
@Setter
@Facebook("country_code")
private String countryCode;

@Deprecated
@Getter
@Setter
@Facebook("country_dial_code")
Expand All @@ -51,6 +63,27 @@ public class WhatsAppBusinessAccountToNumberCurrentStatus extends FacebookType {
@Facebook("display_phone_number")
private String displayPhoneNumber;

@Getter
@Setter
@Facebook("name_status")
private String nameStatus;

@Getter
@Setter
@Facebook("new_certificate")
private String newCertificate;

@Getter
@Setter
@Facebook("new_name_status")
private String newNameStatus;

@Getter
@Setter
@Facebook("quality_score")
private WhatsAppPhoneQualityScoreShape qualityScore;

@Deprecated
@Getter
@Setter
@Facebook("quality_rating")
Expand All @@ -61,6 +94,7 @@ public class WhatsAppBusinessAccountToNumberCurrentStatus extends FacebookType {
@Facebook
private String status;

@Deprecated
@Getter
@Setter
@Facebook("verified_name")
Expand Down
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2010-2021 Mark Allen, Norbert Bartels.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.restfb.types.whatsapp;

import com.restfb.Facebook;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class WhatsAppHSMQualityScoreShape {

@Facebook
private List<String> reasons = new ArrayList<>();

@Getter
@Setter
@Facebook
private String score;

/**
* List of reasons for the score of the HSM
*/
public List<String> getReasons() {
return Collections.unmodifiableList(reasons);
}

public boolean addReason(String reason) {
return reasons.add(reason);
}

public boolean removeReason(String reason) {
return reasons.remove(reason);
}

}
Expand Up @@ -100,4 +100,10 @@ public class WhatsAppMessageTemplate extends NamedFacebookType {
@Setter
@Facebook("name_or_content")
private String nameOrContent;


@Getter
@Setter
@Facebook("quality_score")
private WhatsAppHSMQualityScoreShape qualityScore;
}

0 comments on commit 952401e

Please sign in to comment.