/**
 * Copyright (C) 2018-2022
 * All rights reserved, Designed By www.yixiang.co
 */
package co.yixiang.yshop.module.order.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * @author hupeng
 * 订单相关枚举
 */
@Getter
@AllArgsConstructor
public enum WxOrderResultEnum {

    NOT_PAY("NOTPAY", "未支付"),
    TRANSACTION_ID("transaction_id", "微信支付订单id"),
    OUT_TRADE_NO("out_trade_no", "商家订单号"),
    OUT_REFUND_NO("out_refund_no", "商家退款单号"),
    TRADE_STATE("trade_state", "订单交易装态"),
    REFUND_ID("refund_id", "微信退款单id");


    private String value;
    private String desc;

    public static WxOrderResultEnum toType(String value) {
        return Stream.of(WxOrderResultEnum.values())
                .filter(p -> Objects.equals(p.value, value))
                .findAny()
                .orElse(null);
    }


}
