xjtupay

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 6 Imported by: 0

README

XJTU Payment Platform

Go module for XJTU Payment

Usage
import (
    "github.com/endaytrer/xjtupay"
)
info := xjtupay.PaymentInfo {
    ...
}

payment, err := xjtupay.InitPayment(true, info)

if err != nil {
    // deal with error
}

var redir_client *http.Client

switch t := payment.(type) {

case *xjtupay.PayWithPasswd:
    redir_client, err = t.Pay("888888")

case *xjtupay.PayWithoutPasswd:
    redir_client, err = t.Pay()
}
if err != nil {
    // deal with error
}

// deal with redirection client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MoneyAmount

type MoneyAmount string

type Passcode

type Passcode string

type PayMethod

type PayMethod interface {
	// contains filtered or unexported methods
}

func InitPayment

func InitPayment(mobile bool, payment PaymentInfo) (PayMethod, error)

type PayWithPasswd

type PayWithPasswd generalPayment

func (*PayWithPasswd) Pay

func (t *PayWithPasswd) Pay(passcode Passcode) (*http.Client, error)

type PayWithoutPasswd

type PayWithoutPasswd generalPayment

func (*PayWithoutPasswd) Pay

func (t *PayWithoutPasswd) Pay() (*http.Client, error)

type PaymentError

type PaymentError int
const (
	RequirePassword PaymentError = iota
	RequestError
	InitFailed
	PaymentFailed
	Unimplemented
)

func (PaymentError) Error

func (t PaymentError) Error() string

type PaymentInfo

type PaymentInfo struct {
	TransactionAmount MoneyAmount `json:"tranamt"`
	Account           string      `json:"account"`
	Sno               string      `json:"sno"`
	ToAccount         string      `json:"toaccount"`
	ThirdSystem       string      `json:"thirdsystem"`
	ThirdOrderId      string      `json:"thirdorderid"`
	OrderType         string      `json:"ordertype"`
	Signature         string      `json:"sign"`
	OrderDesc         string      `json:"orderdesc"`
	Param1            string      `json:"praram1"`
	ThirdURL          string      `json:"thirdurl"`
}

Jump to

Keyboard shortcuts

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