harmonyos

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Server     = "https://iap.cloud.huawei.com"
	QueryOrder = Server + "/order/harmony/v1/application/order/status/query"
)

Variables

This section is empty.

Functions

func Base64RawStdDecode added in v1.1.3

func Base64RawStdDecode(s string) string

func Base64RawStdEncode added in v1.1.3

func Base64RawStdEncode(s string) string

func LoadCertificate added in v1.1.3

func LoadCertificate(key string) (*x509.Certificate, error)

Types

type Client

type Client struct {
	PrivateKey string `json:"private_key"`
	KeyID      string `json:"key_id"`
	IssuerID   string `json:"issuer_id"`
	AppID      string `json:"app_id"`
	// contains filtered or unexported fields
}

func NewClient

func NewClient(privateKey, keyID, issuerID, appID string) *Client

func (*Client) Check added in v1.1.3

func (c *Client) Check(purchaseToken, purchaseOrderID string) (err error)

func (*Client) GetToken

func (c *Client) GetToken(body any) (s string, err error)

func (*Client) Hash

func (c *Client) Hash(body any) (s string, err error)

func (*Client) QueryOrder

func (c *Client) QueryOrder(purchaseToken, purchaseOrderID string) (r *Response, err error)

func (*Client) Verify

func (c *Client) Verify(token string) (err error)
type Header struct {
	X5C []string `json:"x5c"`
	Alg string   `json:"alg"`
	Typ string   `json:"typ"`
}

func GetHeader added in v1.1.3

func GetHeader(s string) (*Header, error)

func (*Header) String added in v1.1.3

func (h *Header) String() string

type Payload added in v1.1.3

type Payload struct {
	PurchaseOrderId  string `json:"purchaseOrderId"`
	PurchaseToken    string `json:"purchaseToken"`
	ApplicationId    string `json:"applicationId"`
	ProductId        string `json:"productId"`
	PurchaseTime     int64  `json:"purchaseTime"`
	ProductType      string `json:"productType"`
	DeveloperPayload string `json:"developerPayload"`
	SignedTime       int64  `json:"signedTime"`
	Environment      string `json:"environment"`
	CountryCode      string `json:"countryCode"`
	Price            int    `json:"price"`
	Currency         string `json:"currency"`
	FinishStatus     string `json:"finishStatus"`
	NeedFinish       bool   `json:"needFinish"`
}

func GetPayload added in v1.1.3

func GetPayload(s string) (*Payload, error)

func (*Payload) String added in v1.1.3

func (p *Payload) String() string

type Response added in v1.1.3

type Response struct {
	ResponseCode     string `json:"responseCode"`
	ResponseMessage  string `json:"responseMessage"`
	JWSPurchaseOrder string `json:"jwsPurchaseOrder"`
}

func (*Response) ResponseOK added in v1.1.3

func (r *Response) ResponseOK() bool

func (*Response) String added in v1.1.3

func (r *Response) String() string

Jump to

Keyboard shortcuts

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