cloudpayments

package module
v0.0.0-...-8bbbd08 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 8 Imported by: 0

README

Cloudpayments SDK

Installation

go get -u github.com/onemgvv/cloudpayments

Usage

sdk := cloudpayments.New("secret-from-lk", "your-public-id")

params := cloudpayments.CryptoPayRequest{
  Amount: 500.3,
  Currency: cloudpayments.RUB,
  IpAddress: "127.0.0.1",
  CardCryptogramPacket: "eyJUeXBlIjoiQ2xvdWRDYXJkIiwi...",
  Name: "Michael",
  PaymentUrl: "https://my-site.com/payment/cb",
  InvoiceId: "invoice12-333",
  CultureName: "ru-RU",
  AccountId: "10",
  Email: "mail@example.com",
}

resp, err := sdk.PayByCryptogram(params)
if err != nil {
  // handle error
}

// use response

Documentation

Index

Constants

View Source
const (
	HeaderXContentHMAC = "X-Content-HMAC"
	HeaderContentHMAC  = "Content-HMAC"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudPayments

type CloudPayments interface {
	SetSecret(secret string)
	SetPublicID(pubID string)

	Post3ds(params Post3dsRequest) (*PaymentResponse, error)
	PayByCryptogram(params CryptoPayRequest) (*PaymentResponse, error)
	Subscribe(params CreateSubscribeRequest) (*PaymentResponse, error)
	UpdateSubscribe(params UpdateSubscribeRequest) (*PaymentResponse, error)
	GetSubscription(params SubscribeRequest) (*PaymentResponse, error)
	FindSubscriptions(params FindSubscriptionsRequest) (*FindSubscriptionsResponse, error)
	Unsubscribe(params SubscribeRequest) (*PaymentResponse, error)
}

func New

func New(secret, publicID string) CloudPayments

type CreateSubscribeRequest

type CreateSubscribeRequest struct {
	Token               string
	AccountId           string
	Description         string
	Email               string
	Amount              float32
	Currency            Currency
	RequireConfirmation bool
	StartDate           time.Time
	Interval            Interval
	Period              int
}

type CryptoPayRequest

type CryptoPayRequest struct {
	Amount               float32
	Currency             Currency
	IpAddress            string
	CardCryptogramPacket string
	Name                 string
	PaymentUrl           string
	InvoiceId            string
	CultureName          string
	AccountId            string
	Email                string
}

type Currency

type Currency string
const (
	RUB Currency = "RUB"
	USD Currency = "USD"
	EUR Currency = "EUR"
)

type DefaultResponse

type DefaultResponse struct {
	Success bool
	Message null.String
}

type FindSubscriptionsRequest

type FindSubscriptionsRequest struct {
	AccountId string
}

type FindSubscriptionsResponse

type FindSubscriptionsResponse struct {
	DefaultResponse
	Model []Model
}

type Interval

type Interval string
const (
	Day   Interval = "Day"
	Week  Interval = "Week"
	Month Interval = "Month"
)

type Model

type Model map[string]interface{}

type PaymentResponse

type PaymentResponse struct {
	DefaultResponse
	Model
}

type Post3dsRequest

type Post3dsRequest struct {
	TransactionId int
	PaRes         string
}

type SubscribeRequest

type SubscribeRequest struct {
	Id string
}

type UpdateSubscribeRequest

type UpdateSubscribeRequest struct {
	Id                  string
	Description         string
	Email               string
	Amount              float32
	Currency            Currency
	RequireConfirmation bool
	StartDate           time.Time
	Interval            Interval
	Period              int
}

Jump to

Keyboard shortcuts

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