47 lines
1.6 KiB
Go
47 lines
1.6 KiB
Go
package event
|
|
|
|
func RealPayment(timestamp int64, level int, productID, orderID string, price float64, currencyCode string, fields map[string]interface{}) (map[string]interface{}, error) {
|
|
event := map[string]interface{}{
|
|
"code": "rp",
|
|
"timestamp": timestamp,
|
|
"level": level,
|
|
"productId": productID,
|
|
"orderId": orderID,
|
|
"price": price,
|
|
"currencyCode": currencyCode,
|
|
}
|
|
if err := addFields(event, fields, "code", "timestamp", "level", "productId", "orderId", "price", "currencyCode"); err != nil {
|
|
return nil, err
|
|
}
|
|
return event, nil
|
|
}
|
|
|
|
func VirtualCurrencyPayment(timestamp int64, level int, purchaseAmount int, purchasePrice map[string]float64, purchaseType, purchaseID string, fields map[string]interface{}) (map[string]interface{}, error) {
|
|
event := map[string]interface{}{
|
|
"code": "vp",
|
|
"timestamp": timestamp,
|
|
"level": level,
|
|
"purchaseAmount": purchaseAmount,
|
|
"purchasePrice": purchasePrice,
|
|
"purchaseType": purchaseType,
|
|
"purchaseId": purchaseID,
|
|
}
|
|
if err := addFields(event, fields, "code", "timestamp", "level", "purchaseAmount", "purchasePrice", "purchaseType", "purchaseId"); err != nil {
|
|
return nil, err
|
|
}
|
|
return event, nil
|
|
}
|
|
|
|
func AdImpression(timestamp int64, adNetwork string, revenue float64, fields map[string]interface{}) (map[string]interface{}, error) {
|
|
event := map[string]interface{}{
|
|
"code": "adrv",
|
|
"timestamp": timestamp,
|
|
"ad_network": adNetwork,
|
|
"revenue": revenue,
|
|
}
|
|
if err := addFields(event, fields, "code", "timestamp", "ad_network", "revenue"); err != nil {
|
|
return nil, err
|
|
}
|
|
return event, nil
|
|
}
|