yellowbean / Hastructure

ABS/MBS cashflow engine written in Haskell, with API to Python and C/Java (on the way)
https://deal-bench.xyz
Other
16 stars 4 forks source link

Bug: UTF8 support on Statement/Transaction #52

Closed yellowbean closed 1 year ago

yellowbean commented 1 year ago

Reproduce request Screenshot 2023-08-02 at 02 14 06

URL to send : http://localhost:8081/runDeal

Method : POST

Body (works for Postman) :

{"tag": "SingleRunReq", "contents": [{"tag": "MDeal", "contents": {"dates": {"tag": "PreClosingDates", "contents": ["2021-03-31", "2021-06-15", null, "2060-12-01", ["2021-06-15", {"tag": "MonthEnd"}], ["2021-07-26", {"tag": "DayOfMonth", "contents": 26}]]}, "name": "Senior/Junior", "status": {"tag": "Amortizing"}, "pool": {"assets": [{"tag": "Mortgage", "contents": [{"originBalance": 120, "originRate": {"tag": "Fix", "contents": 0.045}, "originTerm": 30, "period": "Monthly", "startDate": "2021-02-01", "prinType": {"tag": "Even"}, "tag": "MortgageOriginalInfo"}, 120, 0.08, 20, null, {"tag": "Current"}]}], "asOfDate": "2021-03-31", "issuanceStat": null, "futureCf": null}, "bonds": {"优先级": {"bndName": "优先级", "bndBalance": 100, "bndRate": 0.07, "bndOriginInfo": {"originBalance": 100, "originDate": "2020-01-03", "originRate": 0.07, "maturityDate": null}, "bndInterestInfo": {"tag": "Fix", "contents": [0.08, "DC_ACT_365F"]}, "bndType": {"tag": "Sequential"}, "bndDuePrin": 0, "bndDueInt": 0, "bndDueIntDate": null, "bndLastIntPayDate": null}, "B": {"bndName": "B", "bndBalance": 20, "bndRate": 0.0, "bndOriginInfo": {"originBalance": 100, "originDate": "2020-01-03", "originRate": 0.07, "maturityDate": null}, "bndInterestInfo": {"tag": "Fix", "contents": [0.0, "DC_ACT_365F"]}, "bndType": {"tag": "Equity"}, "bndDuePrin": 0, "bndDueInt": 0, "bndDueIntDate": null, "bndLastIntPayDate": null}}, "waterfall": {"DistributionDay Amortizing": [{"tag": "PayFee", "contents": [["账户01"], ["信托费用"]]}, {"tag": "AccrueAndPayInt", "contents": ["账户01", ["优先级"]]}, {"tag": "PayPrin", "contents": ["账户01", ["优先级"]]}, {"tag": "PayPrin", "contents": ["账户01", ["B"]]}, {"tag": "PayResidual", "contents": [null, "账户01", "B"]}]}, "fees": {"信托费用": {"feeName": "信托费用", "feeType": {"tag": "FixFee", "contents": 10}, "feeStart": "2021-06-15", "feeDueDate": null, "feeDue": 0, "feeArrears": 0, "feeLastPaidDay": null}}, "accounts": {"账户01": {"accBalance": 0, "accName": "账户01", "accType": null, "accInterest": null, "accStmt": null}}, "collects": [{"tag": "Collect", "contents": ["CollectedInterest", "账户01"]}, {"tag": "Collect", "contents": ["CollectedPrincipal", "账户01"]}, {"tag": "Collect", "contents": ["CollectedPrepayment", "账户01"]}, {"tag": "Collect", "contents": ["CollectedRecoveries", "账户01"]}], "rateSwap": null, "currencySwap": null, "custom": null, "triggers": null, "liqProvider": null, "ledgers": null}}, {"tag": "PoolLevel", "contents": []}, null]}
yellowbean commented 1 year ago

Issue: Why it doesn't show Chinese character ? like "<SeqPayFee:[\"\\20449\\25176\\36153\\29992\"]>"

The location of code : https://github.com/yellowbean/Hastructure/blob/d0ddaef7973ba3162f0135a40fb656298ed9dc21/src/Stmt.hs#L73

it seems that T.pack doesn't work with UTF8 ?

Screenshot 2023-08-02 at 02 15 48

yellowbean commented 1 year ago

https://github.com/yellowbean/Hastructure/commit/ed6410b534598f245f48fcd3b38051eefd97bbab