Package com.akraml.satim.reply
Class OrderConfirmationReply
java.lang.Object
com.akraml.satim.reply.AbstractReply
com.akraml.satim.reply.OrderConfirmationReply
Response from the order confirmation endpoint.
Contains the result of confirming/completing a payment.
This is typically called when the customer returns from the payment page.Example usage:
api.confirmPayment(orderId)
.thenAccept(reply -> {
if (reply.isSuccessful()) {
System.out.println("Payment confirmed: " + reply.getApprovalCode());
} else {
System.out.println("Payment failed: " + reply.getErrorMessage());
}
});
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull OrderConfirmationReplyfromJson(@NotNull com.google.gson.JsonObject json) Creates an OrderConfirmationReply from a JSON response.longReturns the payment amount in the smallest currency unit.@Nullable StringReturns the approval code from the payment processor.@Nullable StringReturns the cardholder name.@Nullable StringReturns the currency code.@Nullable StringgetIp()Returns the customer's IP address.@Nullable StringReturns the merchant's order number.@NotNull OrderStatusReturns the order status.@Nullable StringgetPan()Returns the masked card number (PAN).@NotNull StringReturns a success message for confirmed payments.toString()Methods inherited from class com.akraml.satim.reply.AbstractReply
getErrorCode, getErrorMessage, getRawResponse, getResponse, isSuccessful
-
Method Details
-
getOrderStatus
Returns the order status.- Returns:
- the order status enum
-
getOrderNumber
Returns the merchant's order number.- Returns:
- the order number
-
getAmount
public long getAmount()Returns the payment amount in the smallest currency unit.- Returns:
- the amount in centimes
-
getCurrency
Returns the currency code.- Returns:
- the ISO 4217 numeric currency code (e.g., "012" for DZD)
-
getApprovalCode
Returns the approval code from the payment processor.- Returns:
- the approval code, or
nullif not approved
-
getCardholderName
Returns the cardholder name.- Returns:
- the cardholder name
-
getPan
Returns the masked card number (PAN).- Returns:
- the masked PAN (e.g., "411111******1111")
-
getIp
Returns the customer's IP address.- Returns:
- the IP address
-
getSuccessMessage
Returns a success message for confirmed payments.- Returns:
- a human-readable success message
-
toString
- Overrides:
toStringin classAbstractReply
-
fromJson
@NotNull public static @NotNull OrderConfirmationReply fromJson(@NotNull @NotNull com.google.gson.JsonObject json) Creates an OrderConfirmationReply from a JSON response.- Parameters:
json- the JSON response from the API- Returns:
- a new OrderConfirmationReply instance
-