Closes #251 - Added endpoints for registration and purchase confirmation

This commit is contained in:
Chris Cowan 2014-05-28 10:11:57 -07:00
parent a91ef45ec2
commit a717a0709b
3 changed files with 29 additions and 3 deletions

View file

@ -23,6 +23,14 @@ module.exports = function (grunt) {
dev: 'http://'+(grunt.option('host') || 'localhost')+':'+ (grunt.option('es_port') || 9200) +'/.marvel_cluster_report/report',
dist: 'https://marvel-stats.elasticsearch.com/'
},
registrationUrl: {
dev: 'http://'+(grunt.option('host') || 'localhost')+':'+ (grunt.option('es_port') || 9200) +'/.marvel_cluster_report/registration',
dist: 'https://marvel-stats.elasticsearch.com/registration'
},
purchaseConfirmationUrl: {
dev: 'http://'+(grunt.option('host') || 'localhost')+':'+ (grunt.option('es_port') || 9200) +'/.marvel_cluster_report/purchase_confirmation',
dist: 'https://marvel-stats.elasticsearch.com/purchase_confirmation'
},
kibanaPort: grunt.option('port') || 5601,
kibanaHost: grunt.option('host') ||'localhost'
};

View file

@ -2,6 +2,8 @@ define(function (require) {
'use strict';
var statsReportURL = '@@stats_report_url';
var registrationUrl = '@@registration_url';
var purchaseConfirmationUrl = '@@purchase_confirmation_url';
var _ = require('lodash');
var $ = require("jquery");
@ -194,16 +196,16 @@ define(function (require) {
var regData;
var registrationData = this.get('registrationData');
var data = this.get('data');
var url = registrationUrl;
if (!this.get('registrationSent') && registrationData && data && data.uuid ) {
registrationData.uuid = data.uuid;
regData = { type: 'registration', data: registrationData };
if (this.get('status') === 'purchased') {
regData.type = 'purchase_confirmation';
url = purchaseConfirmationUrl;
}
return this.client.post(statsReportURL, regData).then(function () {
return this.client.post(url, registrationData).then(function () {
self.set('registrationSent', true);
self.saveToBrowser();
});

View file

@ -12,6 +12,14 @@ module.exports = function (config) {
match: 'stats_report_url',
replacement: '<%= statsReportUrl.dev %>',
},
{
match: 'registration_url',
replacement: '<%= registrationUrl.dev %>',
},
{
match: 'purchase_confirmation_url',
replacement: '<%= purchaseConfirmationUrl.dev %>',
},
{
match: 'ga_tracking_code',
replacement: '<%= ga_tracking_code.dev %>',
@ -35,6 +43,14 @@ module.exports = function (config) {
match: 'stats_report_url',
replacement: '<%= statsReportUrl.dist %>',
},
{
match: 'registration_url',
replacement: '<%= registrationUrl.dist %>',
},
{
match: 'purchase_confirmation_url',
replacement: '<%= purchaseConfirmationUrl.dist %>',
},
{
match: 'ga_tracking_code',
replacement: '<%= ga_tracking_code.dist %>',