ecpay

package module
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 18 Imported by: 0

README

ECPay SDK for Golang

license go-version latest-version test-ci stability-wip

Description

ECPay SDK for Golang,with some helpers package.

Feature

  • Configure
    • Merchant ID
    • Hash Key
    • Hash IV
    • Return URL
    • Period Return Url
  • API
    • AioCheckOut Query Builder
    • QueryCreditCardPeriodInfo
    • QueryTradeInfo
  • Gin CheckMacValue Validator Handler
  • Echo CheckMacValue Validator Handler
  • Predefined Model
  • OpenAPI Definition

Init client

import (
	"github.com/Laysi/go-ecpay-sdk"
	"github.com/Laysi/go-ecpay-sdk/base"
)
for production
client := ecpay.NewClient("<MERCHANT_ID>", "<HASH_KEY>", "<HASH_IV>", "<RETURN_URL>")
for staging
client := ecpay.NewStageClient(ecpay.WithReturnURL("<RETURN_URL>"))
options
client = ecpay.NewStageClient(
    ecpay.WithReturnURL("<RETURN_URL>"), 
    ecpay.WithPeriodReturnURL("<PERIOD_RETURN_URL>"),
    ecpay.WithClientBackURL("<CLIENT_BACK_URL>"),
    ecpay.WithClientRedirectURL("<CLIENT_REDIRECT_URL>"),
    ecpay.WithOrderResultURL("<ORDER_RESULT_URL>"),
    ecpay.WithPaymentInfoURL("<PAYMENT_INFO_URL>"),
    ecpay.WithPlatformID("<PLATFORM_ID>"),
    ecpay.WithCtxFunc(func(c context.Context) context.Context {
        return context.WithValue(c, "<KEY>", "<VALUE>") // Add context operation for every request pass to the api client
    }),
    ecpay.WithDebug,  // Turn on debug log
)

Usage

Create Order
html, err := client.CreateOrder("<MerchantTradeNo>", time.Now(), 1000, "<Description>", []string{"<ItemName1>", "<ItemName2>"}).
    WithOptional(ecpay.AioCheckOutGeneralOptional{
        StoreID:           "<StoreID>",
        ItemURL:           "<ItemURL>",
        Remark:            "<Remark>",
        ChooseSubPayment:  ecpayBase.CHOOSESUBPAYMENTENUM_EMPTY,
        NeedExtraPaidInfo: ecpayBase.NEEDEXTRAPAIDINFOENUM_N,
        PlatformID:        "<PlatformID>",
        CustomField1:      "<CustomField1>",
        CustomField2:      "<CustomField2>",
        CustomField3:      "<CustomField3>",
        CustomField4:      "<CustomField4>",
        Language:          ecpayBase.LANGUAGEENUM_ENG,
    }).
    SetAllPayment(ecpayBase.CHOOSEPAYMENTENUM_ATM, ecpayBase.CHOOSEPAYMENTENUM_CREDIT).
    WithCreditOptional(ecpay.AioCheckOutCreditOptional{
        BindingCard:      ecpayBase.BINDINGCARDENUM_BINDING,
        MerchantMemberID: "<MerchantMemberID>",
    }).
    WithCreditOnetimeOptional(ecpay.AioCheckOutCreditOnetimeOptional{
        Redeem:   ecpayBase.REDEEMENUM_Y,
        UnionPay: ecpayBase.UNIONPAYENUM_HIDDEN,
    }).
    WithCreditInstallmentOptional(3, 12, 18).
    WithCreditPeriodOptional(ecpayBase.CREDITPERIODTYPEENUM_DAY, 1, 0).
    WithAtmOptional(5).
    WithCvsBarcodeOptional(ecpay.AioCheckOutCvsBarcodeOptional{
        StoreExpireDate: 5,
        Desc1:           "<Desc1>",
        Desc2:           "<Desc1>",
        Desc3:           "<Desc1>",
        Desc4:           "<Desc1>",
    }).
    GenerateRequestHtml()
QueryCreditCardPeriodInfo
info, resp, err := client.QueryCreditCardPeriodInfo("<MerchantTradeNo>", time.Now())

QueryTradeInfo
info, resp, err := client.QueryTradeInfo("<MerchantTradeNo>", time.Now())

Echo Helper

Check Mac Validator Handler

This handler can use to check the data CheckMacValue from the ECPAY server,and will return 0|Error with 400 status if validating failed.

server := echo.New()
var ecpayClient = ecpay.NewStageClient(ecpay.WithReturnURL("<RETURN_URL>"))
server.POST("/ecpay/return", func(c echo.Context) error { ... },ecpayEcho.ECPayCheckMacValueHandler(ecpayClient))

Gin Helper

Check Mac Validator Handler

This handler can use to check the data CheckMacValue from the ECPAY server,and will return 0|Error with 400 status if validating failed.

server := gin.Default()
var ecpayClient = ecpay.NewStageClient(ecpay.WithReturnURL("<RETURN_URL>"))
server.POST("/ecpay/return",ecpayGin.ECPayCheckMacValueHandler(ecpayClient), func(c *gin.Context) {...})
Ecpay Data Binding Patch Helper

Due to gin-gonic/gin#2510,there have some bug to binding the datetime field of data from ecpay server in gin's current version. So there is a helper function to deal with it as a temporary workaround.

server := gin.Default()
server.POST("/ecpay/return",ecpayCheckMacValueHandler, func(c *gin.Context) {
    data := ecpayBase.OrderResult{}
    err := ecpayGin.ResponseBodyDateTimePatchHelper(c)
    if err != nil {
        fmt.Println(err.Error())
        c.Status(http.StatusInternalServerError)
        return
    }
    if err = c.MustBindWith(&data, binding.FormPost); err != nil {
        fmt.Println(err.Error())
        return
    }
})

server.POST("/ecpay/period",ecpayCheckMacValueHandler, func(c *gin.Context) {
    data := ecpayBase.PeriodOrderResult{}
    err := ecpayGin.ResponseBodyDateTimePatchHelper(c)

    if err != nil {
        fmt.Println(err.Error())
        c.Status(http.StatusInternalServerError)
        return
    }
    if err := c.MustBindWith(&data, binding.FormPost); err != nil {
        fmt.Println(err.Error())
        return
    }
})

Documentation

Index

Constants

View Source
const AioCheckOutPath = "/Cashier/AioCheckOut/V5"

Variables

View Source
var OrderTemplateText = `` /* 253-byte string literal not displayed */
View Source
var OrderTmpl = template.Must(template.New("AutoPostOrder").Parse(OrderTemplateText))

Functions

func FormUrlEncode

func FormUrlEncode(s string) string

func PtrNilInt added in v0.0.25

func PtrNilInt(s int) *int

func PtrNilString added in v0.0.25

func PtrNilString(s string) *string

func QuoteDatetime added in v0.0.23

func QuoteDatetime(data string) string

func StructToParamsMap

func StructToParamsMap(data interface{}) map[string]string

func WithDebug added in v0.0.22

func WithDebug(c *Client)

Types

type AioCheckOutAtmOptional

type AioCheckOutAtmOptional struct {
	// **允許繳費有效天數**   若需設定最長 60 天,最短 1 天。   未設定此參數則預設為 3 天   注意事項:以天為單位
	ExpireDate *int `json:"ExpireDate,omitempty"`
}

type AioCheckOutCreditOnetimeOptional

type AioCheckOutCreditOnetimeOptional struct {
	// **信用卡是否使用紅利折抵**
	//  設為 Y 時,當綠界特店選擇信用卡付款時,會進入紅利折抵的交易流程。
	//  注意事項:
	//  紅利折抵請參考信用卡紅利折抵辦法
	Redeem ecpayBase.RedeemEnum `json:"Redeem,omitempty"`
	//  **銀聯卡交易選項**
	//   可帶入以下選項:
	//   `0`: 消費者於交易頁面可選擇是否使用銀聯交易。
	//   `1`: 只使用銀聯卡交易,且綠界會將交易頁面直接導到銀聯網站。
	//   `2`: 不可使用銀聯卡,綠界會將交易頁面隱藏銀聯選項。
	//   注意事項:
	//   1.若需使用銀聯卡服務,請與綠界提出申請方可使用,測試環境未提供銀聯卡服務。
	//   2.不支援信用卡分期付款及定期定額。
	//   3.不支援信用卡紅利折抵
	//   4.不支援信用卡記憶卡號功能
	UnionPay ecpayBase.UnionPayEnum `json:"UnionPay,omitempty"`
}

type AioCheckOutCreditOptional

type AioCheckOutCreditOptional struct {
	// **記憶卡號識別碼** 記憶卡號識別碼 (特店代號 `MerchantID` + `廠商會員編號`)
	BindingCard ecpayBase.BindingCardEnum `json:"BindingCard,omitempty"`
	// **記憶卡號識別碼** 記憶卡號識別碼 (特店代號 `MerchantID` + `廠商會員編號`)
	MerchantMemberID string `json:"MerchantMemberID,omitempty"`
}

type AioCheckOutCreditPeriodOptional

type AioCheckOutCreditPeriodOptional struct {
}

type AioCheckOutCvsBarcodeOptional

type AioCheckOutCvsBarcodeOptional struct {
	// **超商繳費截止時間**   注意事項:   `CVS`:以分鐘為單位   `BARCODE`:以天為單位   若未設定此參數,`CVS` 預設為 `10080` 分鐘(`7` 天);BARCODE 預設為 `7` 天。   若需設定此參數,請於建立訂單時將此參數送給綠界。提醒您,CVS 帶入數值不可超過 `86400` 分鐘,超過時一律以 `86400` 分鐘計(`60` 天)   例:`08/01` 的 `20:15` 分購買商品,繳費期限為 `7` 天,表示 `8/08` 的 `20:15` 分前您必須前往超商繳費。   範例: `CVS`=`1440`(共 `1` 天)、`BARCODE`=`7`(共 `7` 天)
	StoreExpireDate int `json:"StoreExpireDate,omitempty"`
	// **交易描述1** 會出現在超商繳費平台螢幕上
	Desc1 string `json:"Desc_1,omitempty"`
	// **交易描述2** 會出現在超商繳費平台螢幕上
	Desc2 string `json:"Desc_2,omitempty"`
	// **交易描述3** 會出現在超商繳費平台螢幕上
	Desc3 string `json:"Desc_3,omitempty"`
	// **交易描述4** 會出現在超商繳費平台螢幕上
	Desc4 string `json:"Desc_4,omitempty"`
}

type AioCheckOutGeneralOptional

type AioCheckOutGeneralOptional struct {
	// **特店旗下店舖代號** 提供特店填入分店代號使用,僅可用英數字大小寫混合。
	StoreID string `json:"StoreID,omitempty"`
	// **商品銷售網址**
	ItemURL string `json:"ItemURL,omitempty"`
	// **備註欄位**
	Remark string `json:"Remark,omitempty"`
	// **付款子項目**   若設定此參數,建立訂單將轉導至綠界訂單成立頁,依設定的付款方式及付款子項目帶入訂單,無法選擇其他付款子項目。   請參考付款方式一覽表
	ChooseSubPayment ecpayBase.ChooseSubPaymentEnum `json:"ChooseSubPayment,omitempty"`

	// **是否需要額外的付款資訊**
	//   額外的付款資訊:
	//   若不回傳額外的付款資訊時,參數值請傳:`N`;
	//   若要回傳額外的付款資訊時,參數值請傳:`Y`,付款完成後綠界會以 Server POST 方式回傳額外付款資訊。
	//   注意事項:
	//   回傳額外付款資訊參數請參考-額外回傳的參數
	NeedExtraPaidInfo ecpayBase.NeedExtraPaidInfoEnum `json:"NeedExtraPaidInfo,omitempty"`
	// **特約合作平台商代號(由綠界提供)**   為專案合作的平台商使用。   一般特店或平台商本身介接,則參數請帶放空值。   若為專案合作平台商的特店使用時,則參數請帶平台商所綁的特店編號 `MerchantID`。
	PlatformID string `json:"PlatformID,omitempty"`
	// **自訂名稱欄位1**   提供合作廠商使用記錄用客製化使用欄位   注意事項:   特殊符號只支援 `,.#()$[];%{}:/?&@<>!`
	CustomField1 string `json:"CustomField1,omitempty"`
	// **自訂名稱欄位2**   提供合作廠商使用記錄用客製化使用欄位   注意事項:   特殊符號只支援 `,.#()$[];%{}:/?&@<>!`
	CustomField2 string `json:"CustomField2,omitempty"`
	// **自訂名稱欄位3**   提供合作廠商使用記錄用客製化使用欄位   注意事項:   特殊符號只支援 `,.#()$[];%{}:/?&@<>!`
	CustomField3 string `json:"CustomField3,omitempty"`
	// **自訂名稱欄位4**   提供合作廠商使用記錄用客製化使用欄位   注意事項:   特殊符號只支援 `,.#()$[];%{}:/?&@<>!`
	CustomField4 string `json:"CustomField4,omitempty"`
	// **語系設定**
	//  預設語系為中文,若要變更語系參數值請帶:
	//  - 英語:`ENG`
	//  - 韓語:`KOR`
	//  - 日語:`JPN`
	//  - 簡體中文:`CHI`
	Language ecpayBase.LanguageEnum `json:"Language,omitempty"`
}

type AioCheckOutInvoiceOptional

type AioCheckOutInvoiceOptional struct {
	// **客戶編號** 該參數有值時,僅接受『英文、數字、下底線』等字元。
	CustomerID string `json:"CustomerID,omitempty"`
	// **統一編號** 該參數有值時,請帶固定長度為數字 8 碼。
	CustomerIdentifier string `json:"CustomerIdentifier,omitempty"`
	// **客戶名稱**    當列印註記`Print`為 `1`(列印)時,則該參數必須有值。   該參數有值時,僅接受『中、英文及數字』等字元。   請將參數值做 UrlEncode 方式編碼。
	CustomerName string `json:"CustomerName,omitempty"`
	// **客戶地址**    當列印註記`Print`為 `1`(列印)時,則該參數必須有值。   當該參數有值時,請注意特殊字元轉換 。    請將參數值做 UrlEncode 方式編碼。
	CustomerAddr string `json:"CustomerAddr,omitempty"`
	// **客戶手機號碼**   當客戶電子信箱`CustomerEmail`為空字串時,則該參數必須有值。   當該參數有值時,則格式為數字。   注意事項:   請填手機號碼,不能填市話因為要收簡訊通知用
	CustomerPhone string `json:"CustomerPhone,omitempty"`
	// **客戶電子信箱**   當客戶手機號碼`CustomerPhone`為空字串時,則該參數必須有值。   當該參數有值時,則格式需符合 EMAIL格式。   請將參數值做 UrlEncode 方式編碼。
	CustomerEmail string `json:"CustomerEmail,omitempty"`
	// **通關方式**
	//  當課稅類別`TaxType`為 `2`(零稅率)時,則該參數請帶 `1`(非經海關出口)或 `2`(經海關出口)。
	ClearanceMark ecpayBase.ClearanceMarkEnum `json:"ClearanceMark,omitempty"`
	// **載具類別**
	//  若為無載具時,則請帶空字串。
	//  若為特店載具時,則請帶 `1`。
	//  若為買受人之自然人憑證號碼時,則請帶 `2`。
	//  若為買受人之手機條碼資料時,則請帶`3`。
	//  若統一編號 `CustomerIdentifier` 有值時,則載具類別不可為特店載具或自然人憑證載具。
	//  注意事項:當`Print`有值時,載具類別不得有值。
	CarruerType ecpayBase.CarruerTypeEnum `json:"CarruerType,omitempty"`
	// **載具編號**   1. 當載具類別 `CarruerType`=“無載具),請帶空字串。   2. 當載具類別`CarruerType`=`1`(綠界科技電子發票載具)時,請帶空字串,系統會自動帶入值,為合作特店載具統一編號+自訂編號(RelateNumber)。   3. 當載具類別`CarruerType`=`2`(買受人之自然人憑證)時,則請帶固定長度為16且格式 為2碼大寫英文字母加上14碼數字。   4. 當載具類別`CarruerType`=`3`(買受人之手機條碼)時,則請帶固定長度為 8且格式為 1 碼斜線「/」加上由 7 碼數字及大寫英文字母及+-.符號組成。    注意事項:   1. 若手機條碼中有加號,可能在介接驗證時 發生錯誤,請將加號改為空白字元,產生 驗證碼。   2. 英文、數字、符號僅接受半形字   3. 若載具編號為手機條碼載具時,請先呼叫B2C電子發票介接技術文件手機條碼載驗證API進行檢核
	CarruerNum string `json:"CarruerNum,omitempty"`
	// **捐贈碼**   消費者選擇捐贈發票則於此欄位須填入受贈單位之捐贈碼。   1. 若捐贈註記 `Donation`= `1` (捐贈)時,此欄位須有值。   2. 捐贈碼以阿拉伯數字為限,最少三碼,最多七碼。內容定位採「文字格式」,首位可以為零。
	LoveCode string `json:"LoveCode,omitempty"`
	// **商品課稅別**   1:應稅   2:零稅率   3:免稅   注意事項:   1. 預設為空字串,當課稅類別 [TaxType] = 9 時,此欄位不可為空。   2. 格式為課稅 類別 1 | 課稅類別 2 | 課稅類別 3 | … | 課稅類別 n。當含有二筆或以上的商品課稅類別時,則以「|」符號區隔。   3. 課稅類別為混合稅率時,需含二筆或 以 上 的 商 品 課 稅   別[InvoiceItemTaxType],且至少需有一筆商品課稅別為應稅及至少需有一筆商品課稅別為免稅或零稅率,即混稅發票只能 1.應稅+免稅 2.應稅+零稅率,免稅和零稅率發票不能同時開立。
	//InvoiceItemTaxType *string `json:"InvoiceItemTaxType,omitempty"` //由TaxType控制,需要的時候會從別的地方填入
	// **備註** 當該參數有值時,請將參數值做UrlEncode 方式編碼。
	InvoiceRemark string `json:"InvoiceRemark,omitempty"`
}

type AioOrderRequest

type AioOrderRequest struct {
	ecpayBase.AioCheckOutGeneralOption
	*ecpayBase.AioCheckOutAtmOption
	*ecpayBase.AioCheckOutCvsBarcodeOption
	*ecpayBase.AioCheckOutCreditOption
	*ecpayBase.AioCheckOutCreditOnetimeOption
	*ecpayBase.AioCheckOutCreditInstallmentOption
	*ecpayBase.AioCheckOutCreditPeriodOption
	*ecpayBase.AioCheckOutInvoiceOption
}

type AioOrderRequestAllWithClient added in v0.0.26

type AioOrderRequestAllWithClient struct {
	*AioOrderRequestWithClient
}

func (*AioOrderRequestAllWithClient) WithAtmOptional added in v0.0.26

func (r *AioOrderRequestAllWithClient) WithAtmOptional(expireDate int) *AioOrderRequestAllWithClient

func (*AioOrderRequestAllWithClient) WithCreditInstallmentOptional added in v0.0.26

func (r *AioOrderRequestAllWithClient) WithCreditInstallmentOptional(installments ...int) *AioOrderRequestAllWithClient

func (*AioOrderRequestAllWithClient) WithCreditOnetimeOptional added in v0.0.26

func (*AioOrderRequestAllWithClient) WithCreditOptional added in v0.0.26

all options

func (*AioOrderRequestAllWithClient) WithCreditPeriodOptional added in v0.0.26

func (r *AioOrderRequestAllWithClient) WithCreditPeriodOptional(periodType ecpayBase.CreditPeriodTypeEnum, frequency int, execTimes int) *AioOrderRequestAllWithClient

func (*AioOrderRequestAllWithClient) WithCvsBarcodeOptional added in v0.0.26

type AioOrderRequestAtmWithClient added in v0.0.26

type AioOrderRequestAtmWithClient struct {
	*AioOrderRequestWithClient
}

func (*AioOrderRequestAtmWithClient) WithAtmOptional added in v0.0.26

func (r *AioOrderRequestAtmWithClient) WithAtmOptional(expireDate int) *AioOrderRequestAtmWithClient

expireDate: **允許繳費有效天數** 若需設定最長 60 天,最短 1 天。 未設定此參數則預設為 3 天 注意事項:以天為單位

type AioOrderRequestCreditWithClient added in v0.0.26

type AioOrderRequestCreditWithClient struct {
	*AioOrderRequestWithClient
}

func (*AioOrderRequestCreditWithClient) WithCreditInstallmentOptional added in v0.0.26

func (r *AioOrderRequestCreditWithClient) WithCreditInstallmentOptional(installments ...int) *AioOrderRequestCreditWithClient

信用卡分期可用參數為:3,6,12,18,24

func (*AioOrderRequestCreditWithClient) WithCreditOnetimeOptional added in v0.0.26

func (*AioOrderRequestCreditWithClient) WithCreditOptional added in v0.0.26

func (*AioOrderRequestCreditWithClient) WithCreditPeriodOptional added in v0.0.26

func (r *AioOrderRequestCreditWithClient) WithCreditPeriodOptional(periodType ecpayBase.CreditPeriodTypeEnum, frequency int, execTimes int) *AioOrderRequestCreditWithClient

type AioOrderRequestCvsBarcodeWithClient added in v0.0.26

type AioOrderRequestCvsBarcodeWithClient struct {
	*AioOrderRequestWithClient
}

func (*AioOrderRequestCvsBarcodeWithClient) WithCvsBarcodeOptional added in v0.0.26

type AioOrderRequestInvoiceWithClient added in v0.0.26

type AioOrderRequestInvoiceWithClient struct {
	*AioOrderRequestWithClient
}

func (*AioOrderRequestInvoiceWithClient) WithInvoiceOptional added in v0.0.26

type AioOrderRequestWithClient

type AioOrderRequestWithClient struct {
	// contains filtered or unexported fields
}

func (*AioOrderRequestWithClient) GenerateCheckMac

func (r *AioOrderRequestWithClient) GenerateCheckMac() (string, error)

func (*AioOrderRequestWithClient) GenerateRequestHtml

func (r *AioOrderRequestWithClient) GenerateRequestHtml() (string, error)

func (*AioOrderRequestWithClient) GenerateUrlQuery

func (r *AioOrderRequestWithClient) GenerateUrlQuery() (string, error)

func (*AioOrderRequestWithClient) SetAllPayment

func (r *AioOrderRequestWithClient) SetAllPayment(ignorePayment ...ecpayBase.ChoosePaymentEnum) *AioOrderRequestAllWithClient

all payment

func (*AioOrderRequestWithClient) SetAtmPayment

func (*AioOrderRequestWithClient) SetBarcodePayment

func (*AioOrderRequestWithClient) SetCreditPayment

func (*AioOrderRequestWithClient) SetCvsPayment

func (*AioOrderRequestWithClient) SetInvoice

func (r *AioOrderRequestWithClient) SetInvoice(relateNumber string, taxType ecpayBase.TaxTypeEnum, donation ecpayBase.InvoiceDonationEunm, print ecpayBase.InvoicePrintEnum, items []InvoiceItem, delay int, invType string) *AioOrderRequestInvoiceWithClient

func (*AioOrderRequestWithClient) SetWebAtmPayment added in v0.0.26

func (*AioOrderRequestWithClient) WithOptional

type Client added in v0.0.20

type Client struct {
	// contains filtered or unexported fields
}

func NewClient added in v0.0.15

func NewClient(merchantID string, hashKey string, hashIV string, returnUrl string, options ...OptionFunc) *Client

func NewStageClient added in v0.0.15

func NewStageClient(options ...OptionFunc) *Client

func (Client) CreateOrder added in v0.0.20

func (c Client) CreateOrder(tradeNo string, tradeDate time.Time, amount int, description string, itemNames []string) *AioOrderRequestWithClient

func (Client) GenerateAutoSubmitHtmlForm added in v0.0.20

func (c Client) GenerateAutoSubmitHtmlForm(params map[string]string, targetUrl string) string

func (Client) GenerateCheckMacValue added in v0.0.20

func (c Client) GenerateCheckMacValue(params map[string]string) string

func (Client) GetCurrentServer added in v0.0.20

func (c Client) GetCurrentServer() string

func (Client) HashIV added in v0.0.20

func (c Client) HashIV() string

func (Client) HashKey added in v0.0.20

func (c Client) HashKey() string

func (Client) MerchantID added in v0.0.20

func (c Client) MerchantID() string

func (Client) Mode added in v0.0.20

func (c Client) Mode() Mode

func (Client) QueryCreditCardPeriodInfo added in v0.0.20

func (c Client) QueryCreditCardPeriodInfo(merchantTradeNo string, timeStamp time.Time, cs ...context.Context) (ecpayBase.CreditCardPeriodInfo, *http.Response, error)

func (Client) QueryTradeInfo added in v0.0.20

func (c Client) QueryTradeInfo(merchantTradeNo string, timeStamp time.Time, cs ...context.Context) (ecpayBase.TradeInfo, *http.Response, error)

func (Client) WithContext added in v0.0.20

func (c Client) WithContext(ctx context.Context) context.Context

type ECPayValues

type ECPayValues struct {
	url.Values
}

func NewECPayValuesFromMap

func NewECPayValuesFromMap(values map[string]string) *ECPayValues

func (ECPayValues) Encode

func (v ECPayValues) Encode() string

func (ECPayValues) ToMap

func (v ECPayValues) ToMap() map[string]string

type IntSliceConverter

type IntSliceConverter []int

func (IntSliceConverter) ToStringSlice

func (i IntSliceConverter) ToStringSlice() []string

type InvoiceItem

type InvoiceItem struct {
	// Name **商品名稱**
	Name string
	// Count **商品數量**
	Count int
	// Word **商品單位**
	Word string
	// Price **商品價格**
	Price int
	// TaxType **商品課稅別** 當課稅類別 [TaxType] = 9 (MIXED) 時,此欄位不可為空
	TaxType *ecpayBase.TaxTypeEnum
}

type LowerStringSlice

type LowerStringSlice []string

func (LowerStringSlice) Len

func (p LowerStringSlice) Len() int

func (LowerStringSlice) Less

func (p LowerStringSlice) Less(i, j int) bool

func (LowerStringSlice) Swap

func (p LowerStringSlice) Swap(i, j int)

type Mode added in v0.0.20

type Mode int
const (
	PRODUCTION_MODE Mode = iota
	STAGE_MODE
)

func (Mode) Index added in v0.0.20

func (e Mode) Index() int

type OptionFunc added in v0.0.24

type OptionFunc func(client *Client)

func WithClientBackURL added in v0.0.20

func WithClientBackURL(url string) OptionFunc

func WithClientRedirectURL added in v0.0.20

func WithClientRedirectURL(url string) OptionFunc

func WithCtxFunc added in v0.0.20

func WithCtxFunc(f func(c context.Context) context.Context) OptionFunc

func WithOrderResultURL added in v0.0.20

func WithOrderResultURL(url string) OptionFunc

func WithPaymentInfoURL added in v0.0.20

func WithPaymentInfoURL(url string) OptionFunc

func WithPeriodReturnURL added in v0.0.20

func WithPeriodReturnURL(url string) OptionFunc

func WithPlatformID added in v0.0.20

func WithPlatformID(id string) OptionFunc

func WithReturnURL added in v0.0.20

func WithReturnURL(url string) OptionFunc

type OrderTmplArgs

type OrderTmplArgs struct {
	Values map[string]string
	Action string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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