UNPKG

ecpay-einvoice-ts

Version:

ECPay e-invoice SDK for TypeScript

20 lines (15 loc) 620 B
import utils from "./ecUtils"; describe("測試ec的加密", () => { const init = { MerchantID: "2000132", HashKey: "ejCk326UnaZWKisg", HashIV: "q9jcZX8Ib9LM8wYk", } const {encode,decode} = utils(init) test("測試ec的加密", () => { const encryptedData = encode({"Name":"Test","ID":"A123456789"}) expect(encryptedData).toBe("uvI4yrErM37XNQkXGAgRgJAgHn2t72jahaMZzYhWL1HmvH4WV18VJDP2i9pTbC+tby5nxVExLLFyAkbjbS2Dvg==") const decrypt = decode(encryptedData) expect(decrypt).toBe('{"Name":"Test","ID":"A123456789"}') }) })