package com.ycwl.basic.pay.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class RefundResponse {
    private boolean valid;
    private String orderNo;
    private String refundNo;
    private String refundTransactionId;
    @JsonIgnore
    private Object originalResponse;
    private Integer orderPrice;
    private Integer refundPrice;
    private PAY_STATE state;
    private String refundTime;
    @JsonIgnore
    private String customResponse;

    public void setSuccess() {
        state = PAY_STATE.SUCCESS;
    }

    public void setFail() {
        state = PAY_STATE.FAIL;
    }

    public void setRefundPriceInYuan(BigDecimal bigDecimal) {
        refundPrice = bigDecimal.multiply(BigDecimal.valueOf(100)).intValue();
    }

    public enum PAY_STATE {
        SUCCESS,
        FAIL
    }
}
