0.4.1 • Published 9 months ago

@rytass/invoice-adapter-ecpay v0.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 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.4.1

9 months ago

0.4.0

9 months ago

0.3.3

12 months ago

0.3.0

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.1.20

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.19

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.15

2 years ago

0.1.12

3 years ago

0.1.11

3 years ago

0.1.10

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago