Class SystemUpdatePaymentRequest
- All Implemented Interfaces:
VersionedRequest
,Serializable
Payment
.
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)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
The list of restrictions that apply to payment access.int
hashCode()
void
setAccessRestrictions
(Optional<List<String>> accessRestrictions) The list of restrictions that apply to payment access.void
setMarkTransactionsIneligibleForAutomaticReversal
(boolean markTransactionsIneligibleForAutomaticReversal) Declares whether the Payment'sPaymentTransactions
should be marked ineligible for automatic reversal.boolean
toString()
Methods inherited from class com.broadleafcommerce.paymenttransaction.web.endpoint.domain.UpdatePaymentRequest
getAdjustmentsTotal, getAmount, getAttributes, getBillingAddress, getDisplayAttributes, getEntityVersion, getFeesTotal, getFulfillmentTotal, getGatewayType, getIncludedTaxTotal, getName, getPaymentId, getPaymentMethodProperties, getSavedPaymentMethodId, getSubtotal, getTaxTotal, getType, getVersion, isSingleUsePaymentMethod, setEntityVersion, setPaymentId, shouldSavePaymentForFutureUse, shouldSavePaymentToCustomer
-
Constructor Details
-
SystemUpdatePaymentRequest
public SystemUpdatePaymentRequest()
-
-
Method Details
-
shouldMarkTransactionsIneligibleForAutomaticReversal
public boolean shouldMarkTransactionsIneligibleForAutomaticReversal() -
getAccessRestrictions
The list of restrictions that apply to payment access.- Returns:
- the list of restrictions that apply to payment access
-
equals
- Overrides:
equals
in classUpdatePaymentRequest
-
canEqual
- Overrides:
canEqual
in classUpdatePaymentRequest
-
hashCode
public int hashCode()- Overrides:
hashCode
in classUpdatePaymentRequest
-
toString
- Overrides:
toString
in classUpdatePaymentRequest
-
setMarkTransactionsIneligibleForAutomaticReversal
public void setMarkTransactionsIneligibleForAutomaticReversal(boolean markTransactionsIneligibleForAutomaticReversal) Declares whether the Payment'sPaymentTransactions
should be marked ineligible for automatic reversal.- Parameters:
markTransactionsIneligibleForAutomaticReversal
- whether the Payment'sPaymentTransactions
should be marked ineligible for reversal.- See Also:
-
setAccessRestrictions
The list of restrictions that apply to payment access.- Parameters:
accessRestrictions
- the list of restrictions that apply to payment access
-