ecpay

package module
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: MIT Imports: 15 Imported by: 0

README

go-ecpay-sdk

綠界科技 SDK

Work In Process

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 StructToParamsMap

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

Types

type AioCheckOutAtmOptional

type AioCheckOutAtmOptional struct {
	// **允許繳費有效天數**   若需設定最長 60 天,最短 1 天。   未設定此參數則預設為 3 天   注意事項:以天為單位
	ExpireDate *int `json:"ExpireDate,omitempty"`
	// **Server端回傳付款相關資訊**   若有設定此參數,訂單建立完成後(非付款完成),綠界會 Server 端背景回傳消費者付款方式相關資訊(例:銀行代碼、繳費虛擬帳號繳費期限…等)。   請參考[ATM、CVS 或 BARCODE 的取號結果通知.]   注意事項:   頁面將會停留在綠界,顯示繳費的相關資訊。
	PaymentInfoURL *string `json:"PaymentInfoURL,omitempty"`
	// **Client端回傳付款相關資訊**   若有設定此參數,訂單建立完成後(非付款完成),綠界會 Client 端回傳消費者付款方式相關資訊(例:銀行代碼、繳費虛擬帳號繳費期限…等)且將頁面轉到特店指定的頁面。請參考[ATM、CVS 或 BARCODE 的取號結果通知.]   注意事項:   若設定此參數,將會使設定的返回特店的按鈕連結[ClientBackURL]失效。   若導回網址未使用 https 時,部份瀏覽器可能會出現警告訊息。
	ClientRedirectURL *string `json:"ClientRedirectURL,omitempty"`
}

type AioCheckOutCreditOnetimeOptional

type AioCheckOutCreditOnetimeOptional struct {
	Redeem   *base.RedeemEnum   `json:"Redeem,omitempty"`
	UnionPay *base.UnionPayEnum `json:"UnionPay,omitempty"`
}

type AioCheckOutCreditOptional

type AioCheckOutCreditOptional struct {
	BindingCard *base.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"`
	// **Server 端回傳付款相關資訊**   若有設定此參數,訂單建立完成後(非付款完成),綠界會 Server 端背景回傳消費者付款方式相關資訊(例:繳費代碼與繳費超商)。   請參考[`ATM`、`CVS` 或 `BARCODE` 的取號結果通知.]   注意事項:   頁面將會停留在綠界,顯示繳費的相關資訊。   回傳只有三段號碼,並不會回傳條碼圖,需自行轉換成 code39 的三段條碼。
	PaymentInfoURL *string `json:"PaymentInfoURL,omitempty"`
	// **Client端回傳付款方式相關資訊**   若有設定此參數,訂單建立完成後(非付款完成),綠界會從 Client 端回傳消費者付款方式相關資訊(例:繳費代碼與繳費超商)且將頁面轉到特店指定的頁面。   請參考[`ATM`、`CVS` 或 `BARCODE` 的取號結果通知.]   注意事項:   若設定此參數,將會使設定的返回特店的按鈕連結[ClientBackURL]失效。   若導回網址未使用 https 時,部份瀏覽器可能會出現警告訊息。   回傳只有三段號碼,並不會回傳條碼圖,需自行轉換成 code39 的三段條碼。
	ClientRedirectURL *string `json:"ClientRedirectURL,omitempty"`
}

type AioCheckOutGeneralOptional

type AioCheckOutGeneralOptional struct {
	// **特店旗下店舖代號** 提供特店填入分店代號使用,僅可用英數字大小寫混合。
	StoreID *string `json:"StoreID,omitempty"`
	// **Client端返回特店的按鈕連結**   消費者點選此按鈕後,會將頁面導回到此設定的網址   注意事項:   導回時不會帶付款結果到此網址,只是將頁面導回而已。   設定此參數,綠界會在付款完成或取號完成頁面上顯示[返回商店]的按鈕。   設定此參數,發生簡訊 OTP 驗證失敗時,頁面上會顯示[返回商店]的按鈕。   若未設定此參數,則綠界付款完成頁或取號完成頁面,不會顯示[返回商店]的按鈕。   若導回網址未使用 https 時,部份瀏覽器可能會出現警告訊息。
	ClientBackURL *string `json:"ClientBackURL,omitempty"`
	// **商品銷售網址**
	ItemURL *string `json:"ItemURL,omitempty"`
	// **備註欄位**
	Remark *string `json:"Remark,omitempty"`
	// **付款子項目**   若設定此參數,建立訂單將轉導至綠界訂單成立頁,依設定的付款方式及付款子項目帶入訂單,無法選擇其他付款子項目。   請參考付款方式一覽表
	ChooseSubPayment *base.ChooseSubPaymentEnum `json:"ChooseSubPayment,omitempty"`
	// **Client端回傳付款結果網址**     當消費者付款完成後,綠界會將付款結果參數以幕前(Client POST)回傳到該網址。   詳細說明請參考付款結果通知   注意事項:   1. 若與[ClientBackURL]同時設定,將會以此參數為主。   2. 銀聯卡及非即時交易(ATM、CVS、BARCODE)不支援此參數。
	OrderResultURL    *string                     `json:"OrderResultURL,omitempty"`
	NeedExtraPaidInfo *base.NeedExtraPaidInfoEnum `json:"NeedExtraPaidInfo,omitempty"`
	// **裝置來源** 請帶空值,由系統自動判定。
	// DeviceSource *string `json:"DeviceSource,omitempty"` 預設留空
	// **隱藏付款**   當付款方式 `ChoosePayment` 為 `ALL` 時,可隱藏不需要的付款方式,多筆請以井號分隔(#)。   可用的參數值:   - `Credit`: 信用卡   - `WebATM`: 網路 ATM   - `ATM`: 自動櫃員機   - `CVS`: 超商代碼   - `BARCODE`: 超商條碼
	IgnorePayment *string `json:"IgnorePayment,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"`
	Language     *base.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"`
	ClearanceMark *base.ClearanceMarkEnum `json:"ClearanceMark,omitempty"`
	CarruerType   *base.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 AioOrderRequestWithClient

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

func (*AioOrderRequestWithClient) GenerateCheckMac

func (r *AioOrderRequestWithClient) GenerateCheckMac() string

func (*AioOrderRequestWithClient) GenerateRequestHtml

func (r *AioOrderRequestWithClient) GenerateRequestHtml() string

func (*AioOrderRequestWithClient) GenerateUrlQuery

func (r *AioOrderRequestWithClient) GenerateUrlQuery() string

func (*AioOrderRequestWithClient) SetAllPayment

func (*AioOrderRequestWithClient) SetAtmPayment

func (*AioOrderRequestWithClient) SetBarcodePayment

func (r *AioOrderRequestWithClient) SetBarcodePayment() *AioOrderRequestWithClient

func (*AioOrderRequestWithClient) SetCreditPayment

func (*AioOrderRequestWithClient) SetCvsPayment

func (*AioOrderRequestWithClient) SetInvoice

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

func (*AioOrderRequestWithClient) WithAtmOptional

func (*AioOrderRequestWithClient) WithCreditInstallmentOptional

func (r *AioOrderRequestWithClient) WithCreditInstallmentOptional(installments []int) *AioOrderRequestWithClient

func (*AioOrderRequestWithClient) WithCreditOnetimeOptional

func (*AioOrderRequestWithClient) WithCreditOptional

func (*AioOrderRequestWithClient) WithCreditPeriodOptional

func (r *AioOrderRequestWithClient) WithCreditPeriodOptional(periodType base.CreditPeriodTypeEnum, frequency int, execTimes int) *AioOrderRequestWithClient

func (*AioOrderRequestWithClient) WithCvsBarcodeOptional

func (*AioOrderRequestWithClient) WithInvoiceOptional

func (*AioOrderRequestWithClient) WithOptional

type ECPayClient

type ECPayClient struct {
	MerchantID      string
	AioCheckOutPath string
	ReturnURL       string
	PeriodReturnURL string
	HashKey         string
	HashIV          string
	// contains filtered or unexported fields
}

func NewECPayClient

func NewECPayClient(merchantID string, returnURL string, periodReturnURL string, hashKey string, hashIV string) *ECPayClient

func NewStageECPayClient

func NewStageECPayClient() *ECPayClient

func (ECPayClient) CreateOrder

func (e ECPayClient) CreateOrder(tradeNo string, tradeDate time.Time, amount int, description string, itemName string) *AioOrderRequestWithClient

func (ECPayClient) DefaultContext

func (e ECPayClient) DefaultContext() context.Context

func (ECPayClient) GenerateAutoSubmitHtmlForm

func (e ECPayClient) GenerateAutoSubmitHtmlForm(params map[string]string, targetUrl string) string

func (ECPayClient) GenerateCheckMacValue

func (e ECPayClient) GenerateCheckMacValue(params map[string]string) string

func (ECPayClient) GetCurrentServer

func (e ECPayClient) GetCurrentServer() string

func (ECPayClient) QueryCreditCardPeriodInfo

func (e ECPayClient) QueryCreditCardPeriodInfo(merchantID, merchantTradeNo string, timeStamp time.Time, cs ...context.Context) (base.CreditCardPeriodInfo, *http.Response, error)

func (ECPayClient) WithContext

func (e ECPayClient) WithContext(c context.Context) context.Context

type ECPayMode

type ECPayMode int
const (
	PRODUCTION_MODE ECPayMode = iota
	STAGE_MODE
)

func (ECPayMode) Index

func (e ECPayMode) Index() int

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    string
	Count   int
	Word    string
	Price   int
	TaxType *base.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 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