Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Bump to version 1.7.10
Browse files Browse the repository at this point in the history
1. Update to Platform CRM API v3
  • Loading branch information
aaronhuisinga committed Nov 29, 2019
1 parent 2178849 commit 82ec6ba
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 39 deletions.
2 changes: 1 addition & 1 deletion assets/js/platform-email-validator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 14 additions & 17 deletions assets/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@ jQuery('document').ready(function ($) {
});

// Email Validation
if (DaysOnMarket.platformvalidator !== undefined && DaysOnMarket.platformvalidator !== '') {
$('#email').platform_email_validator({
api_key: DaysOnMarket.platformvalidator,
in_progress: function () {
$('#email').parent().removeClass('has-warning has-error');
$(".mailcheck-suggestion").remove();
$("[type=submit]").addClass("disabled").attr("disabled", "disabled");
},
success: function (data) {
$('#email').after(get_suggestion_str(data['is_valid'], data['did_you_mean']));
},
error: function () {
$("[type=submit]").removeClass("disabled").removeAttr("disabled");
}
});
}
$('#email').platform_email_validator({
in_progress: function () {
$('#email').parent().removeClass('has-warning has-error');
$(".mailcheck-suggestion").remove();
$("[type=submit]").addClass("disabled").attr("disabled", "disabled");
},
success: function (data) {
$('#email').after(get_suggestion_str(data['is_valid'], data['did_you_mean']));
},
error: function () {
$("[type=submit]").removeClass("disabled").removeAttr("disabled");
}
});

// Parse Mailgun Responses
// Parse email validation Responses
function get_suggestion_str(is_valid, alternate) {
if (is_valid) {
if (alternate) {
Expand Down
2 changes: 1 addition & 1 deletion classes/class-days-on-market-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function frontdesk_key_field()
$data = $option;

echo '<input id="frontdesk_key" type="text" name="' . $this->token . '_frontdesk_key" value="' . $data . '"/>
<label for="frontdesk_key"><span class="description">' . __('Enter your API key generated by Platform CRM. To access your API key, visit <a href="https://platformcrm.com/account/api" target="_blank">https://platformcrm.com/account/api</a>.', $this->token) . '</span></label>';
<label for="frontdesk_key"><span class="description">' . __('Enter your API key generated by Platform CRM. To access your API key, visit <a href="https://platformcrm.com" target="_blank">https://platformcrm.com</a>.', $this->token) . '</span></label>';

}

Expand Down
3 changes: 1 addition & 2 deletions classes/class-days-on-market.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,7 @@ public function enqueue_scripts()
wp_enqueue_script('platform-email-validator');

$localize = [
'ajaxurl' => admin_url('admin-ajax.php'),
'platformvalidator' => defined('MAILGUN_PUBLIC') ? MAILGUN_PUBLIC : ''
'ajaxurl' => admin_url('admin-ajax.php'),
];
wp_localize_script($this->token . '-js', 'DaysOnMarket', $localize);
}
Expand Down
40 changes: 25 additions & 15 deletions classes/class-frontdesk.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FrontDesk
*
* @param int $api_version
*/
public function __construct($api_version = 2)
public function __construct($api_version = 3)
{
$this->token = 'pf_days_on_market';
$this->api_key = get_option('pf_seller_quiz_frontdesk_key');
Expand Down Expand Up @@ -54,13 +54,15 @@ public function createCampaign($title, $permalink)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->post($this->api_base . 'campaigns/', [
'form_params' => [
'key' => $this->api_key,
'title' => $title,
'description' => 'Campaign for Platform Days on Market Funnel',
'type' => 'Platform',
'total_cost' => '10000',
'source' => $permalink
]
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);

add_filter('redirect_post_location', [$this, 'add_success_var'], 99);
Expand All @@ -85,10 +87,12 @@ public function updateCampaign($id, $title, $permalink)
if ($this->api_key != null || $this->api_key != '') {
$this->guzzle->patch($this->api_base . 'campaigns/' . $id, [
'form_params' => [
'key' => $this->api_key,
'title' => $title,
'source' => $permalink
]
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);
}
}
Expand All @@ -105,13 +109,15 @@ public function createProspect($data)
{
try {
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->post($this->api_base . 'subscribers/complete/', [
$response = $this->guzzle->post($this->api_base . 'subscribers/', [
'form_params' => [
'key' => $this->api_key,
'campaigns' => $data['campaign_id'],
'email' => $data['email'],
'first_name' => $data['first_name']
]
'campaigns' => $data['campaign_id'],
'email' => $data['email'],
'first_name' => $data['first_name']
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);

return json_decode($response->getBody(), true)['data']['id'];
Expand All @@ -138,7 +144,6 @@ public function updateProspect($id, $data)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->patch($this->api_base . 'subscribers/' . $id, [
'form_params' => [
'key' => $this->api_key,
'email' => $data['email'],
'last_name' => $data['last_name'],
'address' => $data['address'],
Expand All @@ -147,7 +152,10 @@ public function updateProspect($id, $data)
'state' => $data['state'],
'zip_code' => $data['zip_code'],
'phone' => $data['phone']
]
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);

return json_decode($response->getBody(), true)['data']['id'];
Expand All @@ -174,11 +182,13 @@ public function createNote($id, $title, $content)
if ($this->api_key != null || $this->api_key != '') {
$response = $this->guzzle->post($this->api_base . 'subscribers/notes/', [
'form_params' => [
'key' => $this->api_key,
'subscriber_id' => $id,
'title' => $title,
'content' => $content
]
],
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
],
]);

return json_decode($response->getBody(), true)['data']['id'];
Expand Down
4 changes: 2 additions & 2 deletions days-on-market.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/*
* Plugin Name: Days On Market
* Version: 1.7.9
* Version: 1.7.10
* Plugin URI: http://www.coldturkeygroup.com/
* Description: A form for prospective home sellers to fill out to figure out how long it might take them to sell their home.
* Author: Cold Turkey Group
Expand All @@ -26,7 +26,7 @@
}

if (!defined('DAYS_MARKET_PLUGIN_VERSION')) {
define('DAYS_MARKET_PLUGIN_VERSION', '1.7.9');
define('DAYS_MARKET_PLUGIN_VERSION', '1.7.10');
}

require_once('classes/class-days-on-market.php');
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: Aaron Huisinga
Tags: real estate, platform, days on market
Requires at least: 3.5
Tested up to: 5.1
Stable tag: 1.7.9
Stable tag: 1.7.10

A form for prospective home sellers to fill out to figure out how long it might take them to sell their home.

Expand Down

0 comments on commit 82ec6ba

Please sign in to comment.