mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-04-02 16:21:58 -04:00
Compare commits
4 Commits
eacdecd65b
...
1dcccd7b98
| Author | SHA1 | Date | |
|---|---|---|---|
| 1dcccd7b98 | |||
| f73973a4e1 | |||
| 7cd388dbd4 | |||
| 7149e85d37 |
@@ -14,7 +14,7 @@ class QboWebhookProcessor
|
|||||||
def self.process!(request:)
|
def self.process!(request:)
|
||||||
body = request.raw_post
|
body = request.raw_post
|
||||||
signature = request.headers['intuit-signature']
|
signature = request.headers['intuit-signature']
|
||||||
secret = Setting.plugin_redmine_qbo['settingsWebhookToken']
|
secret = RedmineQbo.webhook_token_secret
|
||||||
|
|
||||||
raise "Invalid signature" unless valid_signature?(body, signature, secret)
|
raise "Invalid signature" unless valid_signature?(body, signature, secret)
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class WebhookProcessJob < ActiveJob::Base
|
|||||||
Redmine::Hook.call_hook( :qbo_additional_entities ).each do |context|
|
Redmine::Hook.call_hook( :qbo_additional_entities ).each do |context|
|
||||||
next unless context
|
next unless context
|
||||||
Array(context).each do |entity|
|
Array(context).each do |entity|
|
||||||
jobs.push(entity)
|
entities.push(entity)
|
||||||
log "Added additional QBO entity #{entity}"
|
log "Added additional QBO entity #{entity}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -75,11 +75,8 @@ module QuickbooksOauth
|
|||||||
# This method will construct and return an instance of the OAuth2::Client class that is configured with the consumer key, consumer secret and the appropriate URLs for the Intuit OAuth2 service. It will also set the sandbox mode based on the plugin settings. This method is used by the instance method oauth_client to create a new OAuth2 client for each instance of the model that includes this concern.
|
# This method will construct and return an instance of the OAuth2::Client class that is configured with the consumer key, consumer secret and the appropriate URLs for the Intuit OAuth2 service. It will also set the sandbox mode based on the plugin settings. This method is used by the instance method oauth_client to create a new OAuth2 client for each instance of the model that includes this concern.
|
||||||
def construct_oauth2_client
|
def construct_oauth2_client
|
||||||
|
|
||||||
oauth_consumer_key = Setting.plugin_redmine_qbo['settingsOAuthConsumerKey']
|
|
||||||
oauth_consumer_secret = Setting.plugin_redmine_qbo['settingsOAuthConsumerSecret']
|
|
||||||
|
|
||||||
# Are we are playing in the sandbox?
|
# Are we are playing in the sandbox?
|
||||||
Quickbooks.sandbox_mode = Setting.plugin_redmine_qbo[:sandbox] ? true : false
|
Quickbooks.sandbox_mode = RedmineQbo.sandbox_mode?
|
||||||
log "Sandbox mode: #{Quickbooks.sandbox_mode}"
|
log "Sandbox mode: #{Quickbooks.sandbox_mode}"
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
@@ -87,7 +84,7 @@ module QuickbooksOauth
|
|||||||
authorize_url: "https://appcenter.intuit.com/connect/oauth2",
|
authorize_url: "https://appcenter.intuit.com/connect/oauth2",
|
||||||
token_url: "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer"
|
token_url: "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer"
|
||||||
}
|
}
|
||||||
OAuth2::Client.new(oauth_consumer_key, oauth_consumer_secret, options)
|
OAuth2::Client.new(RedmineQbo.oauth_consumer_key, RedmineQbo.oauth_consumer_secret, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<h2><%=t(:field_customer)%> #<%= @customer.id %> - <%= link_to @customer.to_s, "https://#{Setting.plugin_redmine_qbo[:sandbox] ? "sandbox" : "app"}.qbo.intuit.com/app/customerdetail?nameId=#{@customer.id}", target: :_blank %> </h2>
|
<h2><%=t(:field_customer)%> #<%= @customer.id %> - <%= link_to @customer.to_s, "https://#{RedmineQbo.sandbox_mode? ? "sandbox" : "app"}.qbo.intuit.com/app/customerdetail?nameId=#{@customer.id}", target: :_blank %> </h2>
|
||||||
<div class="issue">
|
<div class="issue">
|
||||||
|
|
||||||
<div class="splitcontent">
|
<div class="splitcontent">
|
||||||
|
|||||||
@@ -6,17 +6,17 @@
|
|||||||
<div class="box tabular">
|
<div class="box tabular">
|
||||||
<p>
|
<p>
|
||||||
<label><%= t(:label_client_id) %></label>
|
<label><%= t(:label_client_id) %></label>
|
||||||
<%= text_field_tag 'settings[settingsOAuthConsumerKey]', settings['settingsOAuthConsumerKey'], size: 50 %>
|
<%= text_field_tag 'settings[oauth_consumer_key]', settings[:oauth_consumer_key], size: 50 %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label><%= t(:label_client_secret) %></label>
|
<label><%= t(:label_client_secret) %></label>
|
||||||
<%= password_field_tag 'settings[settingsOAuthConsumerSecret]', settings['settingsOAuthConsumerSecret'], size: 50 %>
|
<%= password_field_tag 'settings[oauth_consumer_secret]', settings[:oauth_consumer_secret], size: 50 %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<label><%= t(:label_webhook_token) %></label>
|
<label><%= t(:label_webhook_token) %></label>
|
||||||
<%= text_field_tag 'settings[settingsWebhookToken]', settings['settingsWebhookToken'], size: 50 %>
|
<%= text_field_tag 'settings[webhook_token]', settings[:webhook_token], size: 50 %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
2
init.rb
2
init.rb
@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo do
|
|||||||
name 'Redmine QBO plugin'
|
name 'Redmine QBO plugin'
|
||||||
author 'Rick Barrette'
|
author 'Rick Barrette'
|
||||||
description 'A pluging for Redmine to connect with QuickBooks Online to create Time Activity Entries for billable hours logged when an Issue is closed'
|
description 'A pluging for Redmine to connect with QuickBooks Online to create Time Activity Entries for billable hours logged when an Issue is closed'
|
||||||
version '2026.3.13'
|
version '2026.3.14'
|
||||||
url 'https://github.com/rickbarrette/redmine_qbo'
|
url 'https://github.com/rickbarrette/redmine_qbo'
|
||||||
author_url 'https://barrettefabrication.com'
|
author_url 'https://barrettefabrication.com'
|
||||||
settings default: {empty: true}, partial: 'qbo/settings'
|
settings default: {empty: true}, partial: 'qbo/settings'
|
||||||
|
|||||||
@@ -30,4 +30,26 @@ module RedmineQbo
|
|||||||
RedmineQbo::Hooks::UsersShowHookListener
|
RedmineQbo::Hooks::UsersShowHookListener
|
||||||
RedmineQbo::Hooks::ViewHookListener
|
RedmineQbo::Hooks::ViewHookListener
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.settings
|
||||||
|
Setting.plugin_redmine_qbo
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.oauth_consumer_key
|
||||||
|
settings[:oauth_consumer_key]
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.oauth_consumer_secret
|
||||||
|
settings[:oauth_consumer_secret]
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.sandbox_mode?
|
||||||
|
settings[:sandbox] ? true : false
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.webhook_token_secret
|
||||||
|
settings[:webhook_token]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user