All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nbsaas.boot.pay.rest.convert.PaymentResponseConvert Maven / Gradle / Ivy

package com.nbsaas.boot.pay.rest.convert;

import com.nbsaas.boot.pay.data.entity.Payment;
import com.nbsaas.boot.pay.api.domain.response.PaymentResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;

/**
* 实体对象转化成响应对象
*/

public class PaymentResponseConvert  implements Converter {

    @Override
    public PaymentResponse convert(Payment source) {
        PaymentResponse  result = new  PaymentResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getMethod()!=null){
                        result.setMethodName(String.valueOf(source.getMethod()));
                    }
                    if(source.getPayState()!=null){
                        result.setPayStateName(String.valueOf(source.getPayState()));
                    }
                    if(source.getPayConfig()!=null){
                        result.setPayConfigName(source.getPayConfig().getName());
                    }
                    if(source.getPayConfig()!=null){
                        result.setPayConfig(source.getPayConfig().getId());
                    }
                    if(source.getUser()!=null){
                        result.setUser(source.getUser().getId());
                    }
        return result;
    }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy