gopay

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

README

Go用PayPayクライアント

Goで書かれた非公式のPayPayクライアント

インストール

go get github.com/RabiesDev/gopay

使い方

import (
	"fmt"
	"github.com/RabiesDev/gopay"
	"os"
)

func main() {
	paypay, err := gopay.New(&gopay.Options{
		ClientUUID:  os.Getenv("CLIENT_UUID"),
		PhoneNumber: os.Getenv("PHONE_NUMBER"),
		Password:    os.Getenv("PASSWORD"),
	})
	if err != nil {
		panic(err)
	}

	err = paypay.SignIn()
	if err != nil {
		panic(err)
	}

	err = paypay.VerifyOTP("otp-code")
	if err != nil {
		panic(err)
	}

	fmt.Println("token", paypay.AccessToken)
}

貢献

プロジェクトへの貢献はいつでも歓迎しています

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FastJson       = jsoniter.ConfigCompatibleWithStandardLibrary
	BrowserAgent   = "" /* 157-byte string literal not displayed */
	BrowserHeaders = map[string]string{
		"pragma":                "no-cache",
		"cache-control":         "no-cache",
		"client-os-version":     "28.0.0",
		"accept":                "application/json, text/plain, */*",
		"client-app-load-start": "1705238512740",
		"client-os-type":        "ANDROID",
		"client-id":             "pay2-mobile-app-client",
		"client-type":           "PAYPAYAPP",
		"origin":                "https://www.paypay.ne.jp",
		"x-requested-with":      "jp.ne.paypay.android.app",
		"sec-fetch-site":        "same-origin",
		"sec-fetch-mode":        "cors",
		"sec-fetch-dest":        "empty",
		"accept-encoding":       "gzip, deflate",
		"accept-language":       "ja-JP,ja;q=0.9,en-US;q=0.8,en;q=0.7",
	}
	AppHeaders = map[string]string{
		"client-os-type":            "ANDROID",
		"device-name":               "SM-G977N",
		"client-os-version":         "28.0.0",
		"client-os-release-version": "9",
		"client-type":               "PAYPAYAPP",
		"accept-encoding":           "gzip",
	}
)

Functions

This section is empty.

Types

type MoneyLinkInfo

type MoneyLinkInfo struct {
	VerificationCode string
	ChatRoomId       string
	OrderId          string
	RequestId        string
	MessageId        string
	Status           string
	Sender           string
	Amount           int64
}

type Options

type Options struct {
	Proxy       string
	Language    string
	AppVersion  string
	ClientUUID  string
	PhoneNumber string
	Password    string
}

func (*Options) ParseProxy

func (o *Options) ParseProxy() *url.URL

type PayPay

type PayPay struct {
	HttpClient *http.Client
	Options    *Options

	BrowserAgent string
	AppAgent     string

	DeviceUUID   string
	ExtensionId  string
	Verifier     string
	Challenge    string
	AccessToken  string
	RefreshToken string
}

func New

func New(options *Options) (*PayPay, error)
func (paypay *PayPay) AcceptMoneyLink(info *MoneyLinkInfo, passcode *string) error
func (paypay *PayPay) CreateMoneyLink(amount int64, passcode *string) (*string, error)

func (*PayPay) GetLinkInfo

func (paypay *PayPay) GetLinkInfo(verificationCode string) (*MoneyLinkInfo, error)

func (*PayPay) GetWalletAmount

func (paypay *PayPay) GetWalletAmount() (int64, error)

func (*PayPay) OAuth2Authorize

func (paypay *PayPay) OAuth2Authorize(requestUri string) error

func (*PayPay) OAuth2Par

func (paypay *PayPay) OAuth2Par() (string, error)

OAuth2Par https://qiita.com/TakahikoKawasaki/items/97563be46b62a0e02fe6

func (*PayPay) OAuth2Token

func (paypay *PayPay) OAuth2Token(code string) (string, string, error)

func (*PayPay) SignIn

func (paypay *PayPay) SignIn() error

func (*PayPay) VerifyOTP

func (paypay *PayPay) VerifyOTP(otp string) error

Jump to

Keyboard shortcuts

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