primetrust

package module
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

README

PrimeTrust Go Library

Running the Example

PRIMETRUST_LOGIN=user@example.com PRIMETRUST_PASSWORD=password PRIMETRUST_ACCOUNT_ID=00000000-0000-0000-0000-000000000000 go run examples/account-types/*.go
Environment Variables

Please specify appropriate variables when running examples according to source code.

  • PRIMETRUST_LOGIN - email of existing PrimeTrust user
  • PRIMETRUST_PASSWORD - password
  • PRIMETRUST_ACCOUNT_ID - uuid of custodial account-id
  • PRIMETRUST_CONTACT_ID - uuid of KYC contact
  • PRIMETRUST_WEBHOOK_ID - uuid of webhook
  • PRIMETRUST_WEBHOOK_URL
  • PRIMETRUST_WEBHOOK_EMAIL
  • PRIMETRUST_WEBHOOK_SECRET

Usage In Own Application

package main

import (
	"github.com/BANKEX/go-primetrust"
	"log"
	"os"
)

func main() {
	primetrust.Init(true, os.Getenv("PRIMETRUST_LOGIN"), os.Getenv("PRIMETRUST_PASSWORD"))

	if accountTypes, err := primetrust.GetAccountTypes(); err != nil {
		log.Println("Error getting account types:", err.Error())
	} else {
		log.Printf("Account Types: %d", len(accountTypes.Data))
		if accountType, err := primetrust.GetAccountType(accountTypes.Data[0].ID); err != nil {
			log.Printf("Error getting \"%s\" account type:", accountTypes.Data[0].ID, err.Error())
		} else {
			log.Printf("Account Type \"%s\": %+v", accountTypes.Data[0].ID, accountType)
		}
	}
}

Documentation

Index

Constants

View Source
const (
	Version             = "1.0.17"
	SandboxAPIPrefix    = "https://sandbox.primetrust.com/v2"
	ProductionAPIPrefix = "https://api.primetrust.com/v2"
)

Variables

This section is empty.

Functions

func CreateNewContact

func CreateNewContact(contact *models.Contact) (*models.Contact, error)

func CreateNewWebhook

func CreateNewWebhook(webhook *models.Webhook) (*models.Webhook, error)

func GetAccount

func GetAccount(accountId string) (*models.Account, error)

func GetAccountType

func GetAccountType(accountTypeId string) (*models.AccountType, error)

func GetAccountTypes

func GetAccountTypes() (*models.AccountTypesResponse, error)

func GetAccounts

func GetAccounts() (*models.AccountsResponse, error)

func GetCashTransactions

func GetCashTransactions() (*models.CashTransactionsResponse, error)

func GetContact

func GetContact(contactId string) (*models.Contact, error)

func GetContacts

func GetContacts() (*models.ContactsResponse, error)

func GetLastWebhook

func GetLastWebhook(accountId string) (*models.Webhook, error)

func GetWebhook

func GetWebhook(webhookId string) (*models.Webhook, error)

func GetWebhookPayload added in v1.0.5

func GetWebhookPayload(r *http.Request, secret string) (*models.WebhookPayload, error)

func Init

func Init(sandbox bool, login string, password string)

func UpdateWebhook

func UpdateWebhook(webhook *models.Webhook) (*models.Webhook, error)

func UploadDocument

func UploadDocument(file multipart.File, fileHeader multipart.FileHeader, contactId string, label string, description string) (*models.DocumentResponse, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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