Class UpdateSavedPaymentMethodRequest
- All Implemented Interfaces:
VersionedRequest
,Serializable
SavedPaymentMethod
.
It is important to note that the combined usage of @Nullable
and Optional
for
the fields is entirely intentional.. Since there is no way to distinguish between a value
not being supplied and being updated to null
, this mechanism is necessary.
If the request JSON does not have a particular field's key, the field in this DTO will
deserialize to null
. If the request JSON does have the field's key but the value
is null, the field in this DTO will deserialize to Optional.empty()
.
An earlier, alternate implementation relied on a single Map<String, Object>
"updateFields" property to achieve the same distinction between unsupplied and null, but this
approach had the flaw of not being able to take advantage of Jackson's automatic type-safe
deserialization. With the current approach, Jackson can understand the declared types and
automatically verify and convert the fields to the appropriate types.
Another important note is that the use of @Data
and @Setter
with
AccessLevel#PRIVATE
is intentional. This is required for getting the behavior we want
from Jackson on deserialization, while still maintaining @Value
-like immutability. If we
were to use @Value
, Jackson would always set unsupplied keys to Optional.empty()
.
However, when we use @Data
, it seems that Jackson simply does not call the setters for
the fields with unsupplied keys, which leaves them null (giving us our desired behavior).
- Author:
- Chad Harchar (charchar), Chris Kittrell (ckittrell), Sunny Yu
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
Map to capture any additional information about the saved payment methodThe billing address associated with this saved payment method.Whether this saved payment method is the default payment method for the owner entity.General use map to capture any display properties for this saved payment methodGets the version that the client is aware of.The gateway used to process this saved payment method.getId()
The ID of the saved payment method to update.getName()
The name of this saved payment method.Map to capture any information about the payment method needed to perform gateway transactionsgetType()
The type of this saved payment method like Credit Card or Gift Card.The version of this saved payment method.The visibility of the payment method to child accountsint
hashCode()
void
setEntityVersion
(Integer version) Sets the version.void
The ID of the saved payment method to update.toString()
-
Constructor Details
-
UpdateSavedPaymentMethodRequest
public UpdateSavedPaymentMethodRequest()
-
-
Method Details
-
getEntityVersion
Description copied from interface:VersionedRequest
Gets the version that the client is aware of. This should be populated by the client when making a request that modifies an existing entity.- Specified by:
getEntityVersion
in interfaceVersionedRequest
- Returns:
- the version that the client is aware of
-
setEntityVersion
Description copied from interface:VersionedRequest
Sets the version. Typically only used for setting the version on the request body if the version came from an alternative source (e.g. cookie or header).- Specified by:
setEntityVersion
in interfaceVersionedRequest
- Parameters:
version
- the version supplied from an alternative source
-
getId
The ID of the saved payment method to update.- Returns:
- the saved payment method ID this update is for
-
getName
The name of this saved payment method. This name is typically something like "Visa ending in 1234".- Returns:
- The name of this saved payment method.
-
getDefaultForOwner
Whether this saved payment method is the default payment method for the owner entity.- Returns:
- True if this saved payment method is the default payment method for the owner, otherwise false.
-
getType
The type of this saved payment method like Credit Card or Gift Card.- Returns:
- The type of this saved payment method like Credit Card or Gift Card.
- See Also:
-
DefaultPaymentTypes
-
getGatewayType
The gateway used to process this saved payment method. Only a SINGLE payment gateway can modify transactions on a particular payment.- Returns:
- The gateway used to process this saved payment method.
- See Also:
-
PaymentGatewayType
-
getPaymentMethodProperties
Map to capture any information about the payment method needed to perform gateway transactions- Returns:
- Map to capture any information about the payment method needed to perform gateway transactions
-
getAttributes
Map to capture any additional information about the saved payment method- Returns:
- Map to capture any additional information about the saved payment method
-
getDisplayAttributes
General use map to capture any display properties for this saved payment method- Returns:
- General use map to capture any display properties for this saved payment method
-
getBillingAddress
The billing address associated with this saved payment method.- Returns:
- The billing address associated with this saved payment method.
-
getVersion
The version of this saved payment method. Used for checking that the requested version of the payment is up-to-date before saving changes. Required for any request which results in an update being made to the payment. This should never be manually incremented/decremented. -
getVisibleToChildren
The visibility of the payment method to child accounts- Returns:
- The visibility of the payment method to child accounts
-
getNextAction
- See Also:
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-
setId
The ID of the saved payment method to update.- Parameters:
savedPaymentId
- the saved payment method ID this update is for
-