View netsuite_pull_inventory_transfer_custom_field_list.rb
# NOTE that although the `customFieldList` exists in the InventoryTransfer search, the customFieldList won't appear in the search results :(
require 'netsuite'
ns_inventory_transfer_id = 123
search = NetSuite::Records::InventoryTransfer.search(
criteria: {
basic: [
{
View monkeypatch_stripe_ruby.rb
Stripe.max_network_retries = 100
# https://github.com/stripe/stripe-ruby/pull/501
Stripe.class_eval do
def self.should_retry?(e, retry_count)
retry_count < self.max_network_retries &&
(
Stripe::RETRY_EXCEPTIONS.any? { |klass| e.is_a?(klass) } ||
(e.is_a?(RestClient::ExceptionWithResponse) && e.response.include?('Error while communicating with one of our backends.'))
)
View stripe_auto_match_payment_to_invoice.rb
# Michael Bianco <mike@suitesync.io>
# Description: Example of using SuiteSync's auto-match functionality to apply payments
# to NetSuite invoices.
# Usage:
#
# export STRIPE_KEY=sk_test NETSUITE_EMAIL=user@company.com NETSUITE_PASSWORD=password NETSUITE_ACCOUNT=
# gem install stripe netsuite
# ruby stripe_auto_match_payment_to_invoice.rb
#
View stripe_migrate_customers_by_card_attributes.rb
# Michael Bianco <mike@suitesync.io>
# NOTE tabs are used for easy copy/paste into google sheets
require 'stripe'
require 'csv'
require 'pry'
Stripe.api_key = 'sk_live_'
View stripe_transaction_cut_off_report.rb
# Michael Bianco <mike@suitesync.io>
# Description: Get a report of all Stripe transactions associated with other Stripe records
# that were created before a specific date
require 'stripe'
Stripe.api_key = ENV['STRIPE_KEY']
def date_from_stripe_resource(stripe_resource)
if [ Stripe::Invoice, Stripe::Transfer ].include?(stripe_resource.class)
View stripe_authorized_charge_with_checkout.rb
# Michael Bianco <mike@suitesync.io>
# Description: Example of authorizing a charge with Stripe checkout
# Usage:
#
# export STRIPE_KEY=sk_test STRIPE_PUBLIC_KEY=pk_test_
# gem install sinatra stripe pry
# ruby stripe_authorized_charge_with_checkout.rb
# open http://localhost:4567
View suitescript_dynamic_customer_invoice_fields_on_create.js
// Mike Bianco: <mike@suitesync.io>
// Name: _set_default_warehouse.js
// Description: Sets a "warehouse" (custom field) on invoices and customers if one is not provided
// Custom transaction forms:
// https://debugger.sandbox.netsuite.com/app/common/custom/custforms.nl?whence=
// Standard invoice form:
// https://system.sandbox.netsuite.com/app/common/custom/custform.nl?id=125&nl=F&ft=TRANSACTION&tt=CustInvc&ol=F&e=T
View netsuite_order_workflow_with_stripe.rb
# Michael Bianco <mike@suitesync.io>
# Description: Example of automating an order workflow with Stripe and NetSuite
require 'stripe'
require 'netsuite'
# == Configuration
# Replace this test mode key and run this example on your account
Stripe.api_key = ENV['STRIPE_TEST_KEY']
View stripe_zero_decimal_currency.rb
# Michael Bianco <mike@suitesync.io>
# https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support
# ex: stripe_cents_to_decimal('jpy', "123") => 123
# ex: stripe_cents_to_decimal('usd', "100.23") => 10023
def decimal_to_stripe_cents(currency, string_float_amount)
zero_decimal_currencies = %w(
BIF
CLP
View stripe_country_customers_to_netsuite.rb
# Michael Bianco <mike@suitesync.io>
# Description: Script to create subscriptions against customers who have billing
# addresses in different countries. Helpful for testing tax calculation
# in NetSuite.
require 'stripe'
Stripe.api_key = 'sk_test'