rm-go-client

module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT

README ยถ

RevenueMonster Go Client

Build Release Go Report Go Coverage LICENSE FOSSA Status

Simplified version of rm sdk.

Apart from the official rm-sdk-go doesn't support context.Context and opentracing, and this repository is mainly to cover this two core elements.

โœจ Features

  • simple and mininal (no extra functions other than payment)
  • support Jaeger
  • support context.Context
  • support decentralize access token store
  • include test

๐Ÿ“ How to use?

import (
	"context"
	"io/ioutil"
	"testing"

	"github.com/dchest/uniuri"
	rm "github.com/si3nloong/rm-go-client/v3"
)

func main() {
    ctx := context.Background()
    pk, _ := ioutil.ReadFile("../test/pk.pem")
    pub, _ := ioutil.ReadFile("../test/server_pub.pem")

    client := rm.NewClient(
		rm.Config{
			ClientID:     "1599646279297591629",
			ClientSecret: "NekiDbnNHbHLWdRmbqtwBCqywfYkVVnE",
			PrivateKey:   pk,
			PublicKey:    pub,
			Sandbox:      true, // determine whether it's using sandbox environment
		},
    )

    req := rm.CreatePaymentCheckoutRequest{}
    req.Order.ID = uniuri.NewLen(10)
    req.Order.Title = "Testing #" + req.Order.ID
    req.Order.Amount = 1000
    req.NotifyURL = "https://www.google.com"
    req.RedirectURL = "https://www.google.com"

    res, err := client.CreatePaymentCheckout(ctx, req)
    if err != nil {
        panic(err)
    }
}

๐Ÿ“„ License

MIT

Copyright (c) 2021-present, SianLoong Lee

FOSSA Status

Directories ยถ

Path Synopsis

Jump to

Keyboard shortcuts

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