trustpilot

package
v1.4.5-alpha1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package trustpilot implements trust pilot functions

Index

Constants

View Source
const (
	ConstEmailSubject = "Purchase feedback"

	ConstErrorModule = "trustpilot"
	ConstErrorLevel  = 1 // if i tell you to log, then do it

	ConstOrderCustomInfoLinkKey = "trustpilot_link"
	ConstOrderCustomInfoSentKey = "trustpilot_sent"

	ConstConfigPathTrustPilot               = "general.trustpilot"
	ConstConfigPathTrustPilotEnabled        = "general.trustpilot.enabled"
	ConstConfigPathTrustPilotAPIKey         = "general.trustpilot.apiKey"
	ConstConfigPathTrustPilotAPISecret      = "general.trustpilot.apiSecret"
	ConstConfigPathTrustPilotBusinessUnitID = "general.trustpilot.businessUnitID"
	ConstConfigPathTrustPilotUsername       = "general.trustpilot.username"
	ConstConfigPathTrustPilotPassword       = "general.trustpilot.password"
	ConstConfigPathTrustPilotEmailTemplate  = "general.trustpilot.emailTemplate"
	ConstConfigPathTrustPilotProductBrand   = "general.trustpilot.productBrand"

	ConstRatingSummaryURL = "https://api.trustpilot.com/v1/private/product-reviews/business-units/{businessUnitId}/summaries"
)

Package global constants

Variables

This section is empty.

Functions

func APIGetTrustpilotProductsSummaries

func APIGetTrustpilotProductsSummaries(context api.InterfaceApplicationContext) (interface{}, error)

APIGetTrustpilotProductsSummaries Makes a request to Trustpilot api to obtain a list of reviews summaries for every product, caches the response https://developers.trustpilot.com/product-reviews-api#Get product reviews summaries list

func SendOrderInfo

func SendOrderInfo(checkoutOrder order.InterfaceOrder, currentCart cart.InterfaceCart) error

SendOrderInfo Makes requests to the trustpilot api to obtain an access token, then a product review url, then a service review url. This last url is then saved to the order so that we can setup a cronjob to email customers at any given time.

Types

type ProductReview

type ProductReview struct {
	ReferenceID string                 `json:"referenceId"`
	Locale      string                 `json:"locale"`
	Consumer    ProductReviewConsumer  `json:"consumer"`
	Products    []ProductReviewProduct `json:"products"`
}

ProductReview is a container for TrustPilot product reviews

type ProductReviewConsumer

type ProductReviewConsumer struct {
	Email string `json:"email"`
	Name  string `json:"name"`
}

ProductReviewConsumer is a container for the TrustPilot reviewer's personal information

type ProductReviewProduct

type ProductReviewProduct struct {
	ProductURL string `json:"productUrl"`
	ImageURL   string `json:"imageUrl"`
	Name       string `json:"name"`
	Sku        string `json:"sku"`
	Brand      string `json:"brand"`
}

ProductReviewProduct is a container object for a TrustPilot Product Review request based on items purchased by the consumer.

type ServiceReview

type ServiceReview struct {
	ReferenceID string `json:"referenceId"`
	Email       string `json:"email"`
	Name        string `json:"name"`
	Locale      string `json:"locale"`
	RedirectURI string `json:"redirectUri"`
}

ServiceReview is a container object for the TrustPilot Service Review. This is the first link the consumer will receive in an email request to review a TrustPilot registered service.

Jump to

Keyboard shortcuts

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