Skip to content
View create_stripe_subscription_with_existing_netsuite_items.rb
# Michael Bianco <mike@suitesync.io>
require 'stripe'
Stripe.api_key = 'sk_test'
customer = Stripe::Customer.create({
:description => "Sample Customer"
})
View rails_class_configuration.rb
module ClassConfiguration
extend ActiveSupport::Concern
module ClassMethods
def class_configuration(key, default = nil)
class_attribute :"_#{key}"
define_singleton_method(key) do |*args|
if args.empty?
View pay_netsuite_invoice_with_stripe.rb
# Michael Bianco <mike@suitesync.io>
require 'stripe'
# Replace this test mode key and run this example on your account
Stripe.api_key = 'sk_test_123'
# Create a card token to be associated with a customer. This is normally done
# on your payment frontend using Stripe.js https://stripe.com/docs/custom-form
card_token = Stripe::Token.create(
View target_blank_external_links_filter.rb
View image_asset_path_filter.rb
module HTML
class Pipeline
class ImageAssetPathFilter < HTML::Pipeline::Filter
def call
doc.search("img").each do |img|
next if img['src'].nil?
src = img['src'].strip
View stripe_transfer_containing_charge.rb
# NOTE `auto_paging_each` requires a recent stripe ruby gem version
def stripe_transfer_containing_charge(stripe_charge, limit: 100)
txn = stripe_charge.balance_transaction
Stripe::Transfer.list({ limit: 100, created: { gt: stripe_charge.created }}).auto_paging_each do |transfer|
Stripe::BalanceTransaction.list({ limit: 100, transfer: transfer.id }).auto_paging_each do |bt|
if bt.id == stripe_charge.balance_transaction
return transfer
end
View stripe_netsuite_metadata_example.rb
# Michael Bianco <mike@suitesync.io>
require 'stripe'
# Replace this test mode key and run this example on your account
Stripe.api_key = 'sk_test_123'
# Create a new Stripe customer, and prevent the creation of a new NetSuite customer
# by linking the Stripe customer with a NetSuite Customer internalID using the Stripe
View stripe_create_dispute_for_netsuite.rb
# Michael Bianco <mike@suitesync.io>
require 'stripe'
Stripe.api_key = 'sk_test_xxx'
customer = Stripe::Customer.create({
:description => "Sample customer for dispute test",
:email => "dispute-#{Time.now.to_i}@example.com",
})
View stripe_bitcoin_charge_in_netsuite.rb
# Michael Bianco <mike@suitesync.io>
require 'stripe'
Stripe.api_key = 'sk_test_xxx'
customer = Stripe::Customer.create(
:description => "Sample customer for bitcoin test",
:email => "bitcoin-#{Time.now.to_i}@example.com",
)
View configure_heroku_app_name.sh
#!/bin/bash
# For use in a `bin/setup` script to make onboarding new devs painless
# by configuring the current directory to link to a hard coded heroku app name
# test if heroku is configured for the app
if ! heroku config 2>&1 > /dev/null; then
echo $'\nHeroku is not configured. Configuring Heroku...'
# NOTE heroku app name hardcoded here
Something went wrong with that request. Please try again.