ecpay

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ecpay mocks ECPay (綠界 / Green World) — Taiwan's dominant acquiring gateway. Real-world wire shape: AioCheckOut v5 for order creation, ReturnURL form-POST for async settlement notifications. See dto.go for the sourcing notes on where each field originates.

DTO shapes for ECPay (綠界 / Green World) payment API.

Sourcing note: the production reference DTO (test-dto-/ecpay.go) only defined the channel constants and the payment-method enum, so the response/webhook shapes below are modelled on ECPay's public integration documentation (AioCheckOut v5 + ReturnURL callback format). Key contract points preserved from the real gateway:

  • `RtnCode` is the primary success flag: 1 = success, anything else is a failure. ECPay returns `RtnCode` as an *int* in the JSON response but as a *string* form field in the webhook (x-www-form- urlencoded). Our mock emits JSON for both but keeps the numeric semantics intact.
  • `MerchantTradeNo` is the merchant's correlation ID (echoed back).
  • `TradeNo` is ECPay's gateway-side transaction ID.
  • `TradeAmt` is the gross amount as integer TWD (ECPay uses no minor units — TWD is whole-dollar).
  • `PaymentType` identifies the tender (Credit_CreditCard, ATM_TAISHIN, CVS_CVS, BARCODE_BARCODE, etc.).
  • `CheckMacValue` is the MD5/SHA256 signature covering the whole payload, sorted alphabetically. Our mock emits a placeholder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct{}

func New

func New() *Adapter

func (*Adapter) BuildResponse

func (a *Adapter) BuildResponse(result *engine.Result, body []byte) (int, []byte, map[string]string)

func (*Adapter) BuildWebhookPayload

func (a *Adapter) BuildWebhookPayload(result *engine.Result, chargeID string, amount int64, currency string, requestBody map[string]any) map[string]any

func (*Adapter) Name

func (a *Adapter) Name() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL