package com.brilliance.isc.json2mx;

import com.brilliance.isc.swift.objmtconvert.ext.XmlDate;
import com.brilliance.isc.swift.objmtconvert.manager.CreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.mx.camt05200108.MXCamt05200108Creator;
import com.brilliance.isc.swift.objmtconvert.model.mx.common.Account2;
import com.brilliance.isc.swift.objmtconvert.model.mx.common.IdentificationAcc;
import com.brilliance.isc.swift.objmtconvert.model.mx.common.StmtPgntn;
import com.brilliance.isc.swift.objmtconvert.result.MxResult;
import org.junit.Test;

/**
 * @Description
 * @Author s_guodong
 * @Date 2023/4/23
 */
public class Camt05200108Test {
    @Test
    public void testCamt05200108() {
        MXCamt05200108Creator mxCamt05200108Creator = new MXCamt05200108Creator("camt.052.001.08");
        // 头部信息
        mxCamt05200108Creator.setSenderBic("PSBCCNBJ");
        mxCamt05200108Creator.setSenderNm("zs");
        mxCamt05200108Creator.setReceiverBic("PSBCCNBJ");
        mxCamt05200108Creator.setReceiverNm("lisi");
        mxCamt05200108Creator.setBizMsgIdr("1111111");
        mxCamt05200108Creator.setMsgDefIdr("sadasdd");
        mxCamt05200108Creator.setBizSvc("swift.cbprplus.02");
        mxCamt05200108Creator.setCreDt(new XmlDate());
        // 账户唯一标识
        mxCamt05200108Creator.setId("oooooooo");
        // 账号信息
        Account2 acct = new Account2();
        IdentificationAcc id = new IdentificationAcc();
        id.setIban("BE54988858148300");
        acct.setId(id);
        acct.setCcy("USD");
        mxCamt05200108Creator.setAcct(acct);

        // 分页账户信息
        StmtPgntn rptPgntn = new StmtPgntn();
        rptPgntn.setPgNb("1");
        rptPgntn.setLastPgInd(true);
        mxCamt05200108Creator.setRptPgntn(rptPgntn);

        MxResult result = (MxResult) CreatorManager.pack(mxCamt05200108Creator);
        if (result.isSuccess()) {
            System.out.println(result.getMessage());
        } else {
            System.out.println(result.getErrorInf());
        }
    }
}
