Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook chnages #179

Closed
wants to merge 13 commits into from
Closed
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '4697b2445a35ed2572dc');
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'bf32d18497e5b84faa45');
50 changes: 25 additions & 25 deletions composer.lock

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

1 change: 1 addition & 0 deletions includes/ECommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ECommerce {
'woocommerce_cheque_settings',
'onboarding_experience_level',
'yoast_seo_signup_status',
'fb_token'
);

/**
Expand Down
25 changes: 25 additions & 0 deletions includes/RestApi/IntegrationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use NewfoldLabs\WP\Module\ECommerce\Permissions;
use NewfoldLabs\WP\Module\Installer\Services\PluginInstaller;
use NewfoldLabs\WP\ModuleLoader\Container;
use NewfoldLabs\WP\Module\Data\HiiveConnection;

class IntegrationsController {

Expand Down Expand Up @@ -53,6 +54,17 @@ public function register_routes() {
),
)
);
\register_rest_route(
$this->namespace,
$this->rest_base . '/hiive',
array(
array(
'methods' => \WP_REST_Server::READABLE,
'callback' => array( $this, 'get_hiive_token' ),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are we using this API? I'm uneasy about passing a Hiive token to the front end.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this endpoint we're using it in facebook module to store facebook token against hiive token as key-value pair in cloudflare

'permission_callback' => array( Permissions::class, 'rest_is_authorized_admin' ),
),
)
);
}

private function get_plugin_details( $plugin ) {
Expand Down Expand Up @@ -138,4 +150,17 @@ public function get_razorpay_status() {
200
);
}

public function get_hiive_token() {
$hiive_token = HiiveConnection::get_auth_token();

if ( ! $hiive_token ) {}
return new \WP_REST_Response(
array(
'token' => $hiive_token ? $hiive_token : 'test2',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably just return an empty string instead of test2?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're storing it as Key value pair in cloudflare and as key can't be blank. In local, as we don't have a hiiive_token .So, we've added a placeholder variable as test2

),
200
);
}

}
Loading