models

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Shipping Methods
	ShippingMethodOnline  = "online"
	ShippingMethodCourier = "courier"
	ShippingMethodNo      = "no"

	// Product Categories
	ProductCategoryElectronics = "Electronics"
	ProductCategoryClothing    = "Clothing"
	ProductCategoryDigital     = "Digital"

	// Product Profiles
	ProductProfileGeneral          = "general"
	ProductProfilePhysicalGoods    = "physical-goods"
	ProductProfileNonPhysicalGoods = "non-physical-goods"
	ProductProfileAirlineTickets   = "airline-tickets"
	ProductProfileTravelVertical   = "travel-vertical"
	ProductProfileTelecomVertical  = "telecom-vertical"

	// Payment Status
	PaymentStatusValid              = "VALID"
	PaymentStatusValidated          = "VALIDATED"
	PaymentStatusInvalidTransaction = "INVALID_TRANSACTION"

	PaymentStatusFailed      = "FAILED"
	PaymentStatusCancelled   = "CANCELLED"
	PaymentStatusUnattempted = "UNATTEMPTED"
	PaymentStatusExpired     = "EXPIRED"

	// Currencies
	CurrencyBDT = "BDT"
	CurrencyUSD = "USD"
	CurrencyEUR = "EUR"
	CurrencyGBP = "GBP"
)

Constants for PaymentRequest

Variables

This section is empty.

Functions

This section is empty.

Types

type CartProduct

type CartProduct struct {
	Product string `json:"product"`
	Amount  string `json:"amount"`
}

type Customer

type Customer struct {
	Name     string `json:"cus_name" url:"cus_name"`
	Email    string `json:"cus_email" url:"cus_email"`
	Add1     string `json:"cus_add1" url:"cus_add1"`
	Add2     string `json:"cus_add2" url:"cus_add2"`
	City     string `json:"cus_city" url:"cus_city"`
	State    string `json:"cus_state" url:"cus_state"`
	Postcode string `json:"cus_postcode" url:"cus_postcode"`
	Country  string `json:"cus_country" url:"cus_country"`
	Phone    string `json:"cus_phone" url:"cus_phone"`
	Fax      string `json:"cus_fax" url:"cus_fax,omitempty"`
}

type Extra

type Extra struct {
	ValueA string `json:"value_a" url:"value_a,omitempty"`
	ValueB string `json:"value_b" url:"value_b,omitempty"`
	ValueC string `json:"value_c" url:"value_c,omitempty"`
	ValueD string `json:"value_d" url:"value_d,omitempty"`
}

type FlexFloat added in v1.0.6

type FlexFloat float64

FlexFloat handles JSON fields that can be either a float or a string (e.g., "10.5" or 10.5)

func (*FlexFloat) UnmarshalJSON added in v1.0.6

func (f *FlexFloat) UnmarshalJSON(data []byte) error

type InitiateRefundRequest

type InitiateRefundRequest struct {
	BankTranId   string `json:"bank_tran_id" url:"bank_tran_id"`
	StoreId      string `json:"store_id" url:"store_id"`
	StorePasswd  string `json:"store_passwd" url:"store_passwd"`
	RefundAmount string `json:"refund_amount" url:"refund_amount"`
	RefeId       string `json:"refe_id" url:"refe_id"`
	Format       string `json:"format" url:"format"`
}

type InitiateRefundResponse

type InitiateRefundResponse struct {
	APIConnect  string `json:"APIConnect"`
	BankTranId  string `json:"bank_tran_id"`
	TransId     string `json:"trans_id"`
	RefundRefId string `json:"refund_ref_id"`
	Status      string `json:"status"`
	ErrorReason string `json:"errorReason"`
}

type IpnResponse

type IpnResponse struct {
	Status                string `json:"status"`
	TranDate              string `json:"tran_date"`
	TranId                string `json:"tran_id"`
	ValId                 string `json:"val_id"`
	Amount                string `json:"amount"`
	StoreAmount           string `json:"store_amount"`
	CardType              string `json:"card_type"`
	CardNo                string `json:"card_no"`
	Currency              string `json:"currency"`
	BankTranId            string `json:"bank_tran_id"`
	CardIssuer            string `json:"card_issuer"`
	CardBrand             string `json:"card_brand"`
	CardIssuerCountry     string `json:"card_issuer_country"`
	CardIssuerCountryCode string `json:"card_issuer_country_code"`
	CurrencyType          string `json:"currency_type"`
	CurrencyAmount        string `json:"currency_amount"`
	ValueA                string `json:"value_a"`
	ValueB                string `json:"value_b"`
	ValueC                string `json:"value_c"`
	ValueD                string `json:"value_d"`
	VerifySign            string `json:"verify_sign"`
	VerifyKey             string `json:"verify_key"`
	RiskLevel             string `json:"risk_level"`
	RiskTitle             string `json:"risk_title"`
}

func (*IpnResponse) IsValid added in v1.0.4

func (r *IpnResponse) IsValid() bool

IsValid checks if the transaction status is valid

type OrderValidateRequest

type OrderValidateRequest struct {
	ValId       string `json:"val_id" url:"val_id"`
	StoreId     string `json:"store_id" url:"store_id"`
	StorePasswd string `json:"store_passwd" url:"store_passwd"`
	Format      string `json:"format" url:"format"`
	V           string `json:"v" url:"v"`
}

type OrderValidateResponse

type OrderValidateResponse struct {
	Status                string    `json:"status"`
	TranDate              string    `json:"tran_date"`
	TranId                string    `json:"tran_id"`
	ValId                 string    `json:"val_id"`
	Amount                string    `json:"amount"`
	StoreAmount           string    `json:"store_amount"`
	Currency              string    `json:"currency"`
	BankTranId            string    `json:"bank_tran_id"`
	CardType              string    `json:"card_type"`
	CardNo                string    `json:"card_no"`
	CardIssuer            string    `json:"card_issuer"`
	CardBrand             string    `json:"card_brand"`
	CardIssuerCountry     string    `json:"card_issuer_country"`
	CardIssuerCountryCode string    `json:"card_issuer_country_code"`
	CurrencyType          string    `json:"currency_type"`
	CurrencyAmount        string    `json:"currency_amount"`
	CurrencyRate          string    `json:"currency_rate"`
	BaseFair              string    `json:"base_fair"`
	ValueA                string    `json:"value_a"`
	ValueB                string    `json:"value_b"`
	ValueC                string    `json:"value_c"`
	ValueD                string    `json:"value_d"`
	EmiInstalment         string    `json:"emi_instalment"`
	EmiAmount             string    `json:"emi_amount"`
	EmiDescription        string    `json:"emi_description"`
	EmiIssuer             string    `json:"emi_issuer"`
	AccountDetails        string    `json:"account_details"`
	RiskTitle             string    `json:"risk_title"`
	RiskLevel             string    `json:"risk_level"`
	APIConnect            string    `json:"APIConnect"`
	ValidatedOn           string    `json:"validated_on"`
	GwVersion             string    `json:"gw_version"`
	DiscountPercentage    string    `json:"discount_percentage,omitempty"`
	DiscountAmount        FlexFloat `json:"discount_amount,omitempty"`
	DiscountRemarks       string    `json:"discount_remarks,omitempty"`
	CartType              string    `json:"cart_type,omitempty"`
	CartQuantity          string    `json:"cart_quantity,omitempty"`
	AddressIsSame         string    `json:"address_is_same,omitempty"`
}

func (*OrderValidateResponse) IsValid added in v1.0.3

func (r *OrderValidateResponse) IsValid() bool

IsValid checks if the transaction status is valid

type PaymentRequest

type PaymentRequest struct {
	// Basic
	StoreId         string  `json:"store_id" url:"store_id"`
	StorePasswd     string  `json:"store_passwd" url:"store_passwd"`
	TotalAmount     float64 `json:"total_amount" url:"total_amount"`
	Currency        string  `json:"currency" url:"currency"` // default:"BDT"
	TranId          string  `json:"tran_id" url:"tran_id"`
	ProductCategory string  `json:"product_category" url:"product_category"`
	SuccessUrl      string  `json:"success_url" url:"success_url"`
	FailUrl         string  `json:"fail_url" url:"fail_url"`
	CancelUrl       string  `json:"cancel_url" url:"cancel_url"`
	IpnUrl          string  `json:"ipn_url" url:"ipn_url"`

	// Card Details
	MultiCardName    string `json:"multi_card_name" url:"multi_card_name,omitempty"`
	AllowedBin       string `json:"allowed_bin" url:"allowed_bin,omitempty"`
	EmiOption        string `json:"emi_option" url:"emi_option,omitempty"`
	EmiMaxInstOption string `json:"emi_max_inst_option" url:"emi_max_inst_option,omitempty"`
	EmiSelectedInst  string `json:"emi_selected_inst" url:"emi_selected_inst,omitempty"`
	EmiAllowOnly     string `json:"emi_allow_only" url:"emi_allow_only,omitempty"`

	// Nested Structs
	Customer `url:",squash"`
	Shipping `url:",squash"`
	Product  `url:",squash"`
	Extra    `url:",squash"`
}

PaymentRequest represents the body of the payment request

func (*PaymentRequest) SetCart

func (p *PaymentRequest) SetCart(products []CartProduct) error

SetCart sets the cart parameter by marshaling a slice of CartProduct

type PaymentResponse

type PaymentResponse struct {
	Status       string `json:"status"`
	Failedreason string `json:"failedreason"`
	Sessionkey   string `json:"sessionkey"`
	Gw           struct {
		Visa            string `json:"visa"`
		Master          string `json:"master"`
		Amex            string `json:"amex"`
		Othercards      string `json:"othercards"`
		Internetbanking string `json:"internetbanking"`
		Mobilebanking   string `json:"mobilebanking"`
	} `json:"gw"`
	RedirectGatewayURL       string `json:"redirectGatewayURL"`
	DirectPaymentURLBank     string `json:"directPaymentURLBank"`
	DirectPaymentURLCard     string `json:"directPaymentURLCard"`
	DirectPaymentURL         string `json:"directPaymentURL"`
	RedirectGatewayURLFailed string `json:"redirectGatewayURLFailed"`
	GatewayPageURL           string `json:"GatewayPageURL"`
	StoreBanner              string `json:"storeBanner"`
	Desc                     []struct {
		Name               string `json:"name"`
		Type               string `json:"type"`
		Logo               string `json:"logo"`
		Gw                 string `json:"gw"`
		RFlag              string `json:"r_flag,omitempty"`
		RedirectGatewayURL string `json:"redirectGatewayURL,omitempty"`
	} `json:"desc"`
	IsDirectPayEnable string `json:"is_direct_pay_enable"`
}

type Product

type Product struct {
	Name               string `json:"product_name" url:"product_name"`
	Profile            string `json:"product_profile" url:"product_profile"`
	HoursTillDeparture string `json:"hours_till_departure" url:"hours_till_departure,omitempty"`
	FlightType         string `json:"flight_type" url:"flight_type,omitempty"`
	Pnr                string `json:"pnr" url:"pnr,omitempty"`
	JourneyFromTo      string `json:"journey_from_to" url:"journey_from_to,omitempty"`
	ThirdPartyBooking  string `json:"third_party_booking" url:"third_party_booking,omitempty"`
	HotelName          string `json:"hotel_name" url:"hotel_name,omitempty"`
	LengthOfStay       string `json:"length_of_stay" url:"length_of_stay,omitempty"`
	CheckInTime        string `json:"check_in_time" url:"check_in_time,omitempty"`
	HotelCity          string `json:"hotel_city" url:"hotel_city,omitempty"`
	Type               string `json:"product_type" url:"product_type,omitempty"`
	TopupNumber        string `json:"topup_number" url:"topup_number,omitempty"`
	CountryTopup       string `json:"country_topup" url:"country_topup,omitempty"`
	Cart               string `json:"cart" url:"cart,omitempty"`
	Amount             string `json:"product_amount" url:"product_amount,omitempty"`
	Vat                string `json:"vat" url:"vat,omitempty"`
	DiscountAmount     string `json:"discount_amount" url:"discount_amount,omitempty"`
	ConvenienceFee     string `json:"convenience_fee" url:"convenience_fee,omitempty"`
}

type RefundQueryURLRequest

type RefundQueryURLRequest struct {
	RefundRefId string `json:"refund_ref_id" url:"refund_ref_id"`
	StoreId     string `json:"store_id" url:"store_id"`
	StorePasswd string `json:"store_passwd" url:"store_passwd"`
}

type RefundQueryURLResponse

type RefundQueryURLResponse struct {
	APIConnect  string `json:"APIConnect"`
	BankTranId  string `json:"bank_tran_id"`
	TranId      string `json:"tran_id"`
	InitiatedOn string `json:"initiated_on"`
	RefundedOn  string `json:"refunded_on"`
	Status      string `json:"status"`
	RefundRefId string `json:"refund_ref_id"`
}

type Shipping

type Shipping struct {
	Method   string `json:"shipping_method" url:"shipping_method"`
	NumItems int    `json:"num_of_item" url:"num_of_item"`
	Name     string `json:"ship_name" url:"ship_name"`
	Add1     string `json:"ship_add1" url:"ship_add1"`
	Add2     string `json:"ship_add2" url:"ship_add2"`
	City     string `json:"ship_city" url:"ship_city"`
	State    string `json:"ship_state" url:"ship_state"`
	Postcode string `json:"ship_postcode" url:"ship_postcode"`
	Country  string `json:"ship_country" url:"ship_country"`
}

type TransactionQueryBySessionKeyRequest

type TransactionQueryBySessionKeyRequest struct {
	Sessionkey  string `json:"sessionkey" url:"sessionkey"`
	StoreId     string `json:"store_id" url:"store_id"`
	StorePasswd string `json:"store_passwd" url:"store_passwd"`
}

type TransactionQueryBySessionKeyResponse

type TransactionQueryBySessionKeyResponse struct {
	Status                string `json:"status"`
	Sessionkey            string `json:"sessionkey"`
	TranDate              string `json:"tran_date"`
	TranId                string `json:"tran_id"`
	ValId                 string `json:"val_id"`
	Amount                string `json:"amount"`
	StoreAmount           string `json:"store_amount"`
	BankTranId            string `json:"bank_tran_id"`
	CardType              string `json:"card_type"`
	CardNo                string `json:"card_no"`
	CardIssuer            string `json:"card_issuer"`
	CardBrand             string `json:"card_brand"`
	CardIssuerCountry     string `json:"card_issuer_country"`
	CardIssuerCountryCode string `json:"card_issuer_country_code"`
	CurrencyType          string `json:"currency_type"`
	CurrencyAmount        string `json:"currency_amount"`
	CurrencyRate          string `json:"currency_rate"`
	BaseFair              string `json:"base_fair"`
	ValueA                string `json:"value_a"`
	ValueB                string `json:"value_b"`
	ValueC                string `json:"value_c"`
	ValueD                string `json:"value_d"`
	RiskTitle             string `json:"risk_title"`
	RiskLevel             string `json:"risk_level"`
	APIConnect            string `json:"APIConnect"`
	ValidatedOn           string `json:"validated_on"`
	GwVersion             string `json:"gw_version"`
}

type TransactionQueryByTransactionIdRequest

type TransactionQueryByTransactionIdRequest struct {
	Sessionkey  string `json:"sessionkey" url:"sessionkey"`
	StoreId     string `json:"store_id" url:"store_id"`
	StorePasswd string `json:"store_passwd" url:"store_passwd"`
}

type TransactionQueryByTransactionIdResponse

type TransactionQueryByTransactionIdResponse struct {
	APIConnect     string `json:"APIConnect"`
	NoOfTransFound int    `json:"no_of_trans_found"`
	Element        []struct {
		ValId                 string `json:"val_id"`
		Status                string `json:"status"`
		ValidatedOn           string `json:"validated_on"`
		CurrencyType          string `json:"currency_type"`
		CurrencyAmount        string `json:"currency_amount"`
		CurrencyRate          string `json:"currency_rate"`
		BaseFair              string `json:"base_fair"`
		ValueA                string `json:"value_a"`
		ValueB                string `json:"value_b"`
		ValueC                string `json:"value_c"`
		ValueD                string `json:"value_d"`
		TranDate              string `json:"tran_date"`
		TranId                string `json:"tran_id"`
		Amount                string `json:"amount"`
		StoreAmount           string `json:"store_amount"`
		BankTranId            string `json:"bank_tran_id"`
		CardType              string `json:"card_type"`
		RiskTitle             string `json:"risk_title"`
		RiskLevel             string `json:"risk_level"`
		Currency              string `json:"currency"`
		BankGw                string `json:"bank_gw"`
		CardNo                string `json:"card_no"`
		CardIssuer            string `json:"card_issuer"`
		CardBrand             string `json:"card_brand"`
		CardIssuerCountry     string `json:"card_issuer_country"`
		CardIssuerCountryCode string `json:"card_issuer_country_code"`
		GwVersion             string `json:"gw_version"`
		EmiInstalment         string `json:"emi_instalment"`
		EmiAmount             string `json:"emi_amount"`
		EmiDescription        string `json:"emi_description"`
		EmiIssuer             string `json:"emi_issuer"`
		Error                 string `json:"error"`
	} `json:"element"`
}

Jump to

Keyboard shortcuts

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