Documentation
¶
Index ¶
Constants ¶
View Source
const ( EndpointProduction = "https://sis.redsys.es/sis/realizarPago" EndpointDebug = "https://sis-t.redsys.es:25443/sis/realizarPago" )
View Source
const ( LangES = Lang("001") LangEN = Lang("002") LangCA = Lang("003") LangFR = Lang("004") LangDE = Lang("005") LangIT = Lang("007") LangPT = Lang("009") )
View Source
const ( PaymentMethodCreditCard = PaymentMethod("C") PaymentMethodBizum = PaymentMethod("z") PaymentMethodPaypal = PaymentMethod("P") )
View Source
const ( // StatusUnknown means the transaction has not been correctly detected. You can error out as a cancellation // or as an error depending on the context. StatusUnknown = Status("") // StatusApproved means the transaction was approved by the bank and the money was transferred. StatusApproved = Status("approved") // StatusCancelled means the transaction was cancelled by the user. StatusCancelled = Status("cancelled") // StatusRepeated means the transaction has been sent repeatedly to the bank. It is a programming error that should // not happen if a different Order code is used for each retry. StatusRepeated = Status("repeated") )
View Source
const (
CurrencyEuros = Currency(978)
)
View Source
const (
TransactionTypeSimpleAuthorization = TransactionType(0)
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Merchant ¶
type Merchant struct { // Merchant code assigned by the bank. Code string // Merchant name to show in the receipt. You can freely use any appropiate name. Name string // Terminal number assigned by the bank. Terminal int64 // Secret to sign transactions assigned by the bank. Secret string // URL where the asynchronous background notification will be sent. URLNotification string // Send the data to the test endpoint of the bank. Debug bool }
Merchant data provided by the bank itself during the integration.
type Operation ¶
type Operation struct { // Status of the operation. Status Status // Sent date of the operation. Sent time.Time // All the parsed parameters of the transaction. Params Params // True if the transaction was a credit card payment. IsCreditCard bool // Raw response code of the bank. ResponseCode int64 }
Operation represents the result of a payment operation.
type Params ¶
type Params struct { // Response code of the bank. Response int64 `json:"-"` // Order code of the transaction. Order string `json:"Ds_Order"` // Original order code as a string that sometimes comes back empty. RawResponse string `json:"Ds_Response"` // Date of the transaction in the format "02/01/2006". Date string `json:"Ds_Date"` // Hour of the transaction in the format "15:04". Time string `json:"Ds_Hour"` // Country code of the card. Country string `json:"Ds_Card_Country"` // Authorization code of the card. Should be stored to have a reference to the transaction. AuthCode string `json:"Ds_AuthorisationCode"` // Card type: MasterCard, Visa, etc. CardType string `json:"Ds_Card_Type"` // Custom data previously sent that comes back in the confirmation. Data string `json:"Ds_MerchantData"` }
Parsed parameters of the transaction.
func ParseParams ¶
ParseParams reads the response from the bank and returns the parsed parameters if the signature is valid. If an error is returned the input data is compromised and should not be used, the returned params will also be empty.
type PaymentMethod ¶ added in v0.6.0
type PaymentMethod string
type Session ¶
type Session struct { // Code of the session. It should have 4 digits and 8 characters. It should be unique for each retry of the payment. Order string // Language code. Use English if unknown. Lang Lang // Name of the client to show in the receipt. Use any appropiate info available. Client string // Amount in cents to pay. Amount int32 // Product name to show in the receipt. Product string // URL to return the user to when the transaction is approved. URLOK string // URL to return the user to when the transaction is cancelled. URLKO string // Raw custom data that will be sent back in the confirmation when the transaction finishes. You can use it to store // identifiers or any other data that facilitates the verification afterwards. Data string // Payment method to use. By default it will be credit card if empty. PaymentMethod PaymentMethod }
Session data that changes for each payment the merchant wants to make.
type Signed ¶
type Signed struct { // Signature of the parameters. Assign to Ds_Signature. Signature string // Version of the signature. Assign to Ds_SignatureVersion. SignatureVersion string // Params to send. Assign to Ds_MerchantParameters. Params string // Output only. It will return the endpoint of the call where the info should be sent. Endpoint string }
Signed TPV transaction to send to the bank.
type TransactionType ¶
type TransactionType int64
Click to show internal directories.
Click to hide internal directories.