I have been asked to set up an application fee of zero as per my Client's request. I was successfully able to do it using Stripe:Charge create by simply not passing the application fee.
However, with recurring payment we use a different API which is Stripe::Plan.create. This does not allow me to set the application fee to zero, so my recurring payments are been charged a certain amount of fee
Shared below is the code for recurring payment:
# on recurring retrieve application fee
def retrieve_invoice_application_fee(invoice_id)
begin
invoice_response = Stripe::Invoice.retrieve(invoice_id, :stripe_account => candidate.stripe_gateway_id, stripe_version: '2019-12-03')
application_fee = 0
rescue StandardError => e
puts "************ Invoice retrieve #{e} ************"
end
application_fee
end
def create_or_find_stripe_plan
begin
response = Stripe::Plan.retrieve("#{candidate.stripe_gateway_id}-#{amount}",{:stripe_account => candidate.stripe_gateway_id, stripe_version: '2019-12-03',})
rescue => e
response = e
end
if response.inspect.to_s.downcase.include?("no such plan")
response = Stripe::Plan.create({
:amount => amount_cents,
:interval => 'month',
:interval_count => 1,
:currency => candidate.candidate_country[candidate.country.to_s.to_sym][:currency],
product: {name: "#{candidate.stripe_gateway_id}-#{amount}", statement_descriptor: "test statement", },
},
:stripe_account => candidate.stripe_gateway_id, stripe_version: '2019-12-03',
)
end
response
end
I suppose the billing_scheme parameter can help me fix this. Shared below are the debugged logs for a test paument
=> #<Stripe::Plan:0x3fb492612ffc id=plan_LxGnco3QDxIUyR> JSON: {
"id": "plan_LxGnco3QDxIUyR",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 5000,
"amount_decimal": "5000",
"billing_scheme": "per_unit",
"created": 1656352923,
"currency": "usd",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"nickname": null,
"product": "prod_LxGnqDEOfY6Z8a",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": null,
"usage_type"
I have a list of records that I have displayed on an index page. (they are displayed in a table form). Because there are a number of them I am trying to divide them up to about 30 records per page. I've created a search params functionality with the index displayed beneath it.
The problem that I am having is that I am having trouble getting more than one page to render on my list. As of right now I have about 150 records. However I only have one page listed with only 30 records on it and am not able to sort through them. Would anybody have any idea what I could be missing?
Here is the segment in my code where this gets addresssed.
def search_params
default_index_params.merge(params.fetch(:record_collection, {})).with_indifferent_access
end
def default_index_params
{
per: 30,
page: 1,
sort_by: "created_at",
sort_direction: "desc",
customer_id: 0
}
end
In my view, I do have a little bit of coffee-script that plays a role in the table itself. I don't know if it is the root of my problem, but I have it here as well.
:coffeescript
$('#record_table').dataTable
aaSorting: [[1, 'asc']]
bPaginate: false
bFilter: false,
aoColumns:[null, null, null, null, null, { bSortable: false }, null, { bSortable: false }]
My record collection is used for defining the params, i don't think that it is useful for this problem. (but could certainly post if needed)
Thanks in advance to anybody who is able to help figure out what is going on with this.
You need to pass paging: true and pageLength: 30 in coffescript, and just remove page: 1,per: 30 from default_index_params method. So your coffeescript will look like this:
:coffeescript
$('#record_table').dataTable
aaSorting: [[1, 'asc']]
paging: true
pageLength: 30
bFilter: false,
aoColumns:[null, null, null, null, null, { bSortable: false }, null, { bSortable: false }]
your default_index_params will looks like this:
def default_index_params
{
sort_by: "created_at",
sort_direction: "desc",
customer_id: 0
}
end
Well i'm using HybridAuth for google, FB and Twitter, and for FB works just fine, google returns empty user profile.
AccessToken is OK
getUserProfile() data is set NULL:
object(Hybrid_User)#8 (3) { ["providerId"]=> string(6) "Google" ["timestamp"]=> int(1452502079) ["profile"]=> object(Hybrid_User_Profile)#9 (22) { ["identifier"]=> NULL ["webSiteURL"]=> NULL ["profileURL"]=> NULL ["photoURL"]=> NULL ["displayName"]=> NULL ["description"]=> NULL ["firstName"]=> NULL ["lastName"]=> NULL ["gender"]=> NULL ["language"]=> NULL ["age"]=> NULL ["birthDay"]=> NULL ["birthMonth"]=> NULL ["birthYear"]=> NULL ["email"]=> NULL ["emailVerified"]=> NULL ["phone"]=> NULL ["address"]=> NULL ["country"]=> NULL ["region"]=> NULL ["city"]=> NULL ["zip"]=> NULL } } } }
Any idea what to check?
just pointing for other user that experienced with same behaviour.
you can enable debug mode by adding parameters on config file, just like this
array(
"base_url" => "",
"providers" => array (
"Google" => array (
"enabled" => true,
"keys" => array ( "id" => "", "secret" => "" )
),
"Facebook" => array (
"enabled" => true,
"keys" => array ( "id" => "", "secret" => "" )
),
"Twitter" => array (
"enabled" => true,
"keys" => array ( "key" => "", "secret" => "" ),
"includeEmail" => true
),
),
// if you want to enable logging, set 'debug_mode' to true
"debug_mode" => false,
// then provide a writable file by the web server on "debug_file"
"debug_file" => "log.txt"
);
then you can check log, that's correct to use google user data we need to enable google+ api on google developer console,
and need to wait a while during propagation
I use the jdbc-river to fill my Elasticsearch instance from a PostgreSQL database. The river's record is created with the following ruby's code (since I query ES from a Rails app):
require 'elasticsearch'
client = Elasticsearch::Client.new
client.create :index => "_river", :type => "ldi", :id => "_meta", :body =>
{
:type => :jdbc,
:jdbc => {
:driver => "org.postgresql.Driver",
:url => "jdbc:postgresql://localhost:5432/" + ENV['DB_NAME'],
:user => ENV['DB_USER'],
:password => ENV['DB_PASS'],
:index => ENV['DB_NAME'],
:type => "ldi",
:sql => "select id as _id, * from ldis"
}
}
I'm using envirnoment variables for the database credentials to avoid showing the actual ones. The problem is that once the record is added to ES, actual credentials are unveiled. Thus, you can query ES and obtain something like this:
"hits": {
"total": 6,
"max_score": 1,
"hits": [
{
"_index": "_river",
"_type": "ldi",
"_id": "_meta",
"_score": 1,
"_source": {
"type": "jdbc",
"jdbc": {
"driver": "org.postgresql.Driver",
"url": "jdbc:postgresql://localhost:5432/any_dbname",
"user": "any_dbuser",
"password": "any_dbpass",
"index": "any_index",
"type": "ldi",
"sql": "select id as _id, * from ldis"
}
}
}
....
Is there any way to keep them in secret?
I have a Google LineChart with multiple lines. These points do not share the same X value's so i have to format my data in a certain way to make it work:
var data = google.visualization.arrayToDataTable([
["Y", "Your X & Y", "Product 1", "Product 2", "Product 3"],
[419, 589, null, null, null],
[386, null, 504, null, null],
[386, null, 526, null, null],
[387, null, 543, null, null],
[395, null, 564, null, null],
[402, null, 591, null, null],
[408, null, 612, null, null],
[378, null, null, 501, null],
[398, null, null, null, 600],
[460, null, null, null, 500]
]);
Now i want to add custom tooltips to these lines, i've tried adding an extra column and setting the role to tooltip.. but this only affects the first line.
see both charts (with and without tooltip): http://jsfiddle.net/TD92C/8/
How do i add custom tooltips for all lines? Thanks
SOLVED:
http://jsfiddle.net/asgallant/TD92C/14/
you have to make your variable like this
var data = google.visualization.arrayToDataTable([
//Columns
["Y", //Name of the X-axis marker
"Your X & Y",{type: 'string', role: 'tooltip'},
"Product 1",{type: 'string', role: 'tooltip'},
"Product 2",{type: 'string', role: 'tooltip'},
"Product 3",{type: 'string', role: 'tooltip'},],
//Rows
//Add tooltip column after every value in each row
[419,589,"tooltip info about your x & y",null,'',null,'',null,''],
[386,null,'',504,'','Custom Tooltip',null,'',null,''],
[386,null,'',526,'Custom Tooltip',null,'',null,''],
[387,null,'',543,'Custom Tooltip',null,'',null,''],
[378,null,'',null,'',501,'Custom Tooltip',null,''],
[383,null,'',null,'',511,'Custom Tooltip',null,''],
[368,null,'',null,'',null,'',526,'Custom Tooltip'],
[373,null,'',null,'',null,'',547,'Custom Tooltip'],
]);
Fiddle
Data is looking different but if you correct the first element to a string which is exactly as the columns displayed in 1st column index it will be correct