doubleclick

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoubleClickPricer

type DoubleClickPricer struct {
	// contains filtered or unexported fields
}

DoubleClickPricer implementing price encryption and decryption Specs : https://developers.google.com/ad-exchange/rtb/response-guide/decrypt-price

func NewDoubleClickPricer

func NewDoubleClickPricer(
	encryptionKey string,
	integrityKey string,
	isBase64Keys bool,
	keyDecodingMode helpers.KeyDecodingMode,
	scaleFactor float64,
	isDebugMode bool) (*DoubleClickPricer, error)

NewDoubleClickPricer returns a DoubleClickPricer struct. Keys are either base 64 websafe of hexa. keyDecodingMode should be used to specify how keys should be decoded. Factor the clear price will be multiplied by before encryption. from specs, scaleFactor is 1,000,000, but you can set something else. Be aware that the price is stored as an int64 so depending on the digits precision you want, picking a scale factor smaller than 1,000,000 may lead to price to be rounded and loose some digits precision.

func (*DoubleClickPricer) Decrypt

func (dc *DoubleClickPricer) Decrypt(encryptedPrice string, isDebugMode bool) (float64, error)

Decrypt decrypts an ecrypted price.

func (*DoubleClickPricer) Encrypt

func (dc *DoubleClickPricer) Encrypt(
	seed string,
	price float64,
	isDebugMode bool) (string, error)

Encrypt encrypts a clear price and a given seed.

Jump to

Keyboard shortcuts

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