0.3.2 • Published 6 months ago

@rytass/invoice-adapter-ecpay v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Rytass Utils - Invoices (ECPay)

Features

  • Issue Invoice
  • Validate Mobile Barcode
  • Validate Love Code
  • Query
  • Void
  • Allowance

Getting Started

Issue Invoice

import { ECPayInvoiceGateway, InvoiceCarriers } from '@rytass/invoice-adapter-ecpay';

const MERCHANT_ID = 'YOUR_ECPAY_MERCHANT_ID';
const AES_KEY = 'YOUR_ECPAY_AES_KEY';
const AES_IV = 'YOUR_ECPAY_AES_IV';

const invoiceGateway = new ECPayInvoiceGateway({
  aesIv: AES_IV,
  aesKey: AES_KEY,
  merchantId: MERCHANT_ID,
});

invoiceGateway.issue({
  orderId: '2022062900001',
  customer: {
    email: 'test@fake.com',
  },
  items: [{
    name: '橡皮擦',
    quantity: 1,
    unitPrice: 10, // Taxed Price
  }],
}).then((invoice) => {
  // Issued invoice
});

// With Mobile Barcode Carrier
invoiceGateway.issue({
  orderId: '2022062900002',
  customer: {
    email: 'test@fake.com',
  },
  carrier: InvoiceCarriers.MOBILE('/-F-K0PR'),
  items: [{
    name: 'Pencil',
    quantity: 1,
    unitPrice: 20, // Taxed Price
  }],
});

// With VAT number
invoiceGateway.issue({
  orderId: '2022062900002',
  vatNumber: '54366906',
  carrier: InvoiceCarriers.PRINT, // Always PRINT if vatNumber mode
  customer: {
    name: '八拍子股份有限公司',
    address: '台北市中山區中山北路二段72巷21號',
    email: 'test@fake.com',
  },
  items: [{
    name: 'Pencil',
    quantity: 1,
    unitPrice: 20,
  }],
});

Query Invoice

// Query with invoice number and issue date (date only, no time)
invoiceGateway.query({
  invoiceNumber: 'ZZ12345678',
  issuedOn: new Date(),
});

// Query with order id
invoiceGateway.query({
  orderId: '48f0d90c9039e8',
});
0.3.0

9 months ago

0.3.2

6 months ago

0.3.1

7 months ago

0.1.20

12 months ago

0.2.1

11 months ago

0.2.0

12 months ago

0.1.19

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago