assign currency in invoice using quickbook online api in rails - ruby-on-rails-3

I am creating rails app which are integrate with Quick book account.
My problem is when i am create invoice that same invoice need to create in quick book account but how to pass currency for quick book using API.
I tried to found solutions but not success yet.
Any one have a idea?

Please refer Invoice entity doc - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/invoice
Invoice entity has an attribute with name CurrencyRef ( DataType - CurrencyRef).
Ex -
<Invoice>
...
<CurrencyRef name="Canadian Dollar">CAD</CurrencyRef>
...
</Invoice>
Thanks

In your comment you mentioned you are using the quickbooks-ruby gem.
I recently added this feature to the gem for invoices via this PR.
In short do this:
invoice = Quickbooks::Model::Invoice.new
invoice.currency_id = 'CAD'
invoice.currency_ref.name = 'Canadian Dollar'

Related

How to use Prestashop Customer website field for cc email

Some customers require order emails to be sent for one more recipient (ie. accounting). So, as customer website field not used in shop, planned to use this. However, have trouble for getting data for classes/Mail.php
$website = Context::getContext()->customer->website;
does not get the data stored in customer website field. How to get this data from customer table website field correctly?
PS 1.7.8.7
All the rest seems doable, just set the value for cc field and it works.
So, found some solution. Not the nice one, as there will be extra query to DB, but it works.
$website = Db::getInstance()->getValue('SELECT `website` FROM `'._DB_PREFIX_.'customer` WHERE `email` = \''.($to).'\' ');

Shopify API - Can't find orders created by another application

I'm trying to find all of my store's orders, and found out that I can only received list of manually created orders, but not orders created by another applications throughout APIs.
Here my current orders list:
And here my code to find all orders
temp = ShopifyAPI::Order.find(:all, :params=>{:status => 'any', :fields => 'name'})
or find single order with order_id
order = ShopifyAPI::Order.find(show_params['order_id'])
The 1st line of code return only 1 order (#1013) created by me
[#<ShopifyAPI::Order:0x0000000c6ae170 #attributes={"name"=>"#1013"}, #prefix_options={}, #persisted=true>]
The 2nd line of code raised error:
#<ActiveResource::ResourceNotFound: Failed. Response code = 404. Response message = Not Found (Not Found).>
Note that all of my other orders except #1013 created by 3rd-application:
What should I do now to find all my orders?
Thank in advance.
P/s: I use 2020-01 api version.
By default, read_orders scope grants you access to get orders created not earlier than 60 days ago.
You have to request read_all_orders scope to be able to fetch all orders now.

Cant get ShopifyAPI::Address destroy working

I have a piece of code in my controller:
customer = ShopifyAPI::Customer.find(custid)
customer.addresses.each do |address|
if address.id.to_s == params[:addressid]
address.destroy
end
end
This returns in the log file response code 406
Ive also tried variations on ShopifyAPI::Address.delete(address.id) but that doesn't work either.
What am I doing wrong?
Ok, answering my own question so other people don't spend hours trying to find an answer. To delete a customer address you need to use activeresource custom methods and do something like below
customer = ShopifyAPI::Customer.find(custid)
customer.delete("addresses/"+params[:addressid])
where params[:addressid] is an address.id you are passing in from a view

Evernote/Ruby on Rails: How do I create a new NoteFilter and NotesMetadataResultSpec?

Hi I'm trying to fetch notes from my Evernote notebook for my Rails app using https://github.com/cgs/evernote. I can fetch individual notes fine but I'm having a problem using findNotesMetadata because I don't know how to create a new NoteFilter or NotesMetadataResultSpec using this gem or the ruby wrappers.
It's as simple as
noteFilter = Evernote::EDAM::NoteStore::NoteFilter.new
You can then populate the attributes like so
noteFilter.tagGuids = ["<tag guid>"]

rails ajax currency

How to create the following:
I want make ajax currency switcher with rails
[usd|rub|eur]
In db I have only usd value
What gem suitable for this purpose? Or maybe browser-side solution is better?
Who has experience please give me advise
we use the Money Gem you can specify a Money column in your model to make the handling easier.
# Get exchange rates
Money.default_bank = ExchangeBankWhichScrapesXeDotCom.new
# new money object in USD
usd = Money.new(1000, "USD")
# exchange to rubel
rub = usd.exchange_to("RUB")