|
| 1 | +/* |
| 2 | + * Adyen Checkout API |
| 3 | + * |
| 4 | + * The version of the OpenAPI document: 71 |
| 5 | + * |
| 6 | + * |
| 7 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). |
| 8 | + * https://openapi-generator.tech |
| 9 | + * Do not edit the class manually. |
| 10 | + */ |
| 11 | + |
| 12 | + |
| 13 | +package com.adyen.model.checkout; |
| 14 | + |
| 15 | +import java.util.Objects; |
| 16 | +import java.util.Map; |
| 17 | +import java.util.HashMap; |
| 18 | +import com.adyen.model.checkout.Amount; |
| 19 | +import com.adyen.model.checkout.ResponsePaymentMethod; |
| 20 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 21 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 22 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 23 | +import com.fasterxml.jackson.annotation.JsonTypeName; |
| 24 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 25 | +import java.util.Arrays; |
| 26 | +import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| 27 | +import com.fasterxml.jackson.core.JsonProcessingException; |
| 28 | + |
| 29 | + |
| 30 | +/** |
| 31 | + * Payment |
| 32 | + */ |
| 33 | +@JsonPropertyOrder({ |
| 34 | + Payment.JSON_PROPERTY_AMOUNT, |
| 35 | + Payment.JSON_PROPERTY_PAYMENT_METHOD, |
| 36 | + Payment.JSON_PROPERTY_PSP_REFERENCE, |
| 37 | + Payment.JSON_PROPERTY_RESULT_CODE |
| 38 | +}) |
| 39 | + |
| 40 | +public class Payment { |
| 41 | + public static final String JSON_PROPERTY_AMOUNT = "amount"; |
| 42 | + private Amount amount; |
| 43 | + |
| 44 | + public static final String JSON_PROPERTY_PAYMENT_METHOD = "paymentMethod"; |
| 45 | + private ResponsePaymentMethod paymentMethod; |
| 46 | + |
| 47 | + public static final String JSON_PROPERTY_PSP_REFERENCE = "pspReference"; |
| 48 | + private String pspReference; |
| 49 | + |
| 50 | + /** |
| 51 | + * The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. |
| 52 | + */ |
| 53 | + public enum ResultCodeEnum { |
| 54 | + AUTHORISED(String.valueOf("Authorised")); |
| 55 | + |
| 56 | + private String value; |
| 57 | + |
| 58 | + ResultCodeEnum(String value) { |
| 59 | + this.value = value; |
| 60 | + } |
| 61 | + |
| 62 | + @JsonValue |
| 63 | + public String getValue() { |
| 64 | + return value; |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public String toString() { |
| 69 | + return String.valueOf(value); |
| 70 | + } |
| 71 | + |
| 72 | + @JsonCreator |
| 73 | + public static ResultCodeEnum fromValue(String value) { |
| 74 | + for (ResultCodeEnum b : ResultCodeEnum.values()) { |
| 75 | + if (b.value.equals(value)) { |
| 76 | + return b; |
| 77 | + } |
| 78 | + } |
| 79 | + throw new IllegalArgumentException("Unexpected value '" + value + "'"); |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + public static final String JSON_PROPERTY_RESULT_CODE = "resultCode"; |
| 84 | + private ResultCodeEnum resultCode; |
| 85 | + |
| 86 | + public Payment() { |
| 87 | + } |
| 88 | + |
| 89 | + /** |
| 90 | + * amount |
| 91 | + * |
| 92 | + * @param amount |
| 93 | + * @return the current {@code Payment} instance, allowing for method chaining |
| 94 | + */ |
| 95 | + public Payment amount(Amount amount) { |
| 96 | + this.amount = amount; |
| 97 | + return this; |
| 98 | + } |
| 99 | + |
| 100 | + /** |
| 101 | + * Get amount |
| 102 | + * @return amount |
| 103 | + */ |
| 104 | + @JsonProperty(JSON_PROPERTY_AMOUNT) |
| 105 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 106 | + public Amount getAmount() { |
| 107 | + return amount; |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * amount |
| 112 | + * |
| 113 | + * @param amount |
| 114 | + */ |
| 115 | + @JsonProperty(JSON_PROPERTY_AMOUNT) |
| 116 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 117 | + public void setAmount(Amount amount) { |
| 118 | + this.amount = amount; |
| 119 | + } |
| 120 | + |
| 121 | + /** |
| 122 | + * paymentMethod |
| 123 | + * |
| 124 | + * @param paymentMethod |
| 125 | + * @return the current {@code Payment} instance, allowing for method chaining |
| 126 | + */ |
| 127 | + public Payment paymentMethod(ResponsePaymentMethod paymentMethod) { |
| 128 | + this.paymentMethod = paymentMethod; |
| 129 | + return this; |
| 130 | + } |
| 131 | + |
| 132 | + /** |
| 133 | + * Get paymentMethod |
| 134 | + * @return paymentMethod |
| 135 | + */ |
| 136 | + @JsonProperty(JSON_PROPERTY_PAYMENT_METHOD) |
| 137 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 138 | + public ResponsePaymentMethod getPaymentMethod() { |
| 139 | + return paymentMethod; |
| 140 | + } |
| 141 | + |
| 142 | + /** |
| 143 | + * paymentMethod |
| 144 | + * |
| 145 | + * @param paymentMethod |
| 146 | + */ |
| 147 | + @JsonProperty(JSON_PROPERTY_PAYMENT_METHOD) |
| 148 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 149 | + public void setPaymentMethod(ResponsePaymentMethod paymentMethod) { |
| 150 | + this.paymentMethod = paymentMethod; |
| 151 | + } |
| 152 | + |
| 153 | + /** |
| 154 | + * Adyen's 16-character reference associated with the transaction/request. This value is globally unique. Use this reference when you communicate with us about this request. |
| 155 | + * |
| 156 | + * @param pspReference Adyen's 16-character reference associated with the transaction/request. This value is globally unique. Use this reference when you communicate with us about this request. |
| 157 | + * @return the current {@code Payment} instance, allowing for method chaining |
| 158 | + */ |
| 159 | + public Payment pspReference(String pspReference) { |
| 160 | + this.pspReference = pspReference; |
| 161 | + return this; |
| 162 | + } |
| 163 | + |
| 164 | + /** |
| 165 | + * Adyen's 16-character reference associated with the transaction/request. This value is globally unique. Use this reference when you communicate with us about this request. |
| 166 | + * @return pspReference Adyen's 16-character reference associated with the transaction/request. This value is globally unique. Use this reference when you communicate with us about this request. |
| 167 | + */ |
| 168 | + @JsonProperty(JSON_PROPERTY_PSP_REFERENCE) |
| 169 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 170 | + public String getPspReference() { |
| 171 | + return pspReference; |
| 172 | + } |
| 173 | + |
| 174 | + /** |
| 175 | + * Adyen's 16-character reference associated with the transaction/request. This value is globally unique. Use this reference when you communicate with us about this request. |
| 176 | + * |
| 177 | + * @param pspReference Adyen's 16-character reference associated with the transaction/request. This value is globally unique. Use this reference when you communicate with us about this request. |
| 178 | + */ |
| 179 | + @JsonProperty(JSON_PROPERTY_PSP_REFERENCE) |
| 180 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 181 | + public void setPspReference(String pspReference) { |
| 182 | + this.pspReference = pspReference; |
| 183 | + } |
| 184 | + |
| 185 | + /** |
| 186 | + * The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. |
| 187 | + * |
| 188 | + * @param resultCode The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. |
| 189 | + * @return the current {@code Payment} instance, allowing for method chaining |
| 190 | + */ |
| 191 | + public Payment resultCode(ResultCodeEnum resultCode) { |
| 192 | + this.resultCode = resultCode; |
| 193 | + return this; |
| 194 | + } |
| 195 | + |
| 196 | + /** |
| 197 | + * The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. |
| 198 | + * @return resultCode The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. |
| 199 | + */ |
| 200 | + @JsonProperty(JSON_PROPERTY_RESULT_CODE) |
| 201 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 202 | + public ResultCodeEnum getResultCode() { |
| 203 | + return resultCode; |
| 204 | + } |
| 205 | + |
| 206 | + /** |
| 207 | + * The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. |
| 208 | + * |
| 209 | + * @param resultCode The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. |
| 210 | + */ |
| 211 | + @JsonProperty(JSON_PROPERTY_RESULT_CODE) |
| 212 | + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) |
| 213 | + public void setResultCode(ResultCodeEnum resultCode) { |
| 214 | + this.resultCode = resultCode; |
| 215 | + } |
| 216 | + |
| 217 | + /** |
| 218 | + * Return true if this Payment object is equal to o. |
| 219 | + */ |
| 220 | + @Override |
| 221 | + public boolean equals(Object o) { |
| 222 | + if (this == o) { |
| 223 | + return true; |
| 224 | + } |
| 225 | + if (o == null || getClass() != o.getClass()) { |
| 226 | + return false; |
| 227 | + } |
| 228 | + Payment payment = (Payment) o; |
| 229 | + return Objects.equals(this.amount, payment.amount) && |
| 230 | + Objects.equals(this.paymentMethod, payment.paymentMethod) && |
| 231 | + Objects.equals(this.pspReference, payment.pspReference) && |
| 232 | + Objects.equals(this.resultCode, payment.resultCode); |
| 233 | + } |
| 234 | + |
| 235 | + @Override |
| 236 | + public int hashCode() { |
| 237 | + return Objects.hash(amount, paymentMethod, pspReference, resultCode); |
| 238 | + } |
| 239 | + |
| 240 | + @Override |
| 241 | + public String toString() { |
| 242 | + StringBuilder sb = new StringBuilder(); |
| 243 | + sb.append("class Payment {\n"); |
| 244 | + sb.append(" amount: ").append(toIndentedString(amount)).append("\n"); |
| 245 | + sb.append(" paymentMethod: ").append(toIndentedString(paymentMethod)).append("\n"); |
| 246 | + sb.append(" pspReference: ").append(toIndentedString(pspReference)).append("\n"); |
| 247 | + sb.append(" resultCode: ").append(toIndentedString(resultCode)).append("\n"); |
| 248 | + sb.append("}"); |
| 249 | + return sb.toString(); |
| 250 | + } |
| 251 | + |
| 252 | + /** |
| 253 | + * Convert the given object to string with each line indented by 4 spaces |
| 254 | + * (except the first line). |
| 255 | + */ |
| 256 | + private String toIndentedString(Object o) { |
| 257 | + if (o == null) { |
| 258 | + return "null"; |
| 259 | + } |
| 260 | + return o.toString().replace("\n", "\n "); |
| 261 | + } |
| 262 | + |
| 263 | +/** |
| 264 | + * Create an instance of Payment given an JSON string |
| 265 | + * |
| 266 | + * @param jsonString JSON string |
| 267 | + * @return An instance of Payment |
| 268 | + * @throws JsonProcessingException if the JSON string is invalid with respect to Payment |
| 269 | + */ |
| 270 | + public static Payment fromJson(String jsonString) throws JsonProcessingException { |
| 271 | + return JSON.getMapper().readValue(jsonString, Payment.class); |
| 272 | + } |
| 273 | +/** |
| 274 | + * Convert an instance of Payment to an JSON string |
| 275 | + * |
| 276 | + * @return JSON string |
| 277 | + */ |
| 278 | + public String toJson() throws JsonProcessingException { |
| 279 | + return JSON.getMapper().writeValueAsString(this); |
| 280 | + } |
| 281 | +} |
0 commit comments