public static PaymentErrorResponseModel Create(PaymentErrorType errorCode) { return(new PaymentErrorResponseModel { Error = new PaymentErrorDetailsModel { Code = errorCode } }); }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { PaymentErrorType errorCode = (PaymentErrorType)value; switch (errorCode) { case PaymentErrorType.InvalidPaymentId: writer.WriteValue("INVALID_PAYMENT_ID"); break; case PaymentErrorType.InvalidDestinationAddress: writer.WriteValue("INVALID_DESTINATION_ADDRESS"); break; case PaymentErrorType.NoPaymentTransactions: writer.WriteValue("NO_PAYMENT_TRANSACTIONS"); break; case PaymentErrorType.RefundIsNotAvailable: writer.WriteValue("REFUND_IS_NOT_AVAILABLE"); break; case PaymentErrorType.InvalidSettlementAsset: writer.WriteValue("INVALID_SETTLEMENTASSET"); break; case PaymentErrorType.InvalidPaymentAsset: writer.WriteValue("INVALID_PAYMENTASSET"); break; case PaymentErrorType.InvalidCallbackUrl: writer.WriteValue("INVALID_CALLBACKURL"); break; default: throw new Exception("Unexpected payment error type"); } }