Skip to content

Instantly share code, notes, and snippets.

Michael Bianco iloveitaly

View GitHub Profile
View map_stripe_coupons_to_netsuite.rb
# Mike Bianco <mike@suitesync.io>
# Description: Connect Stripe coupons to existing NetSuite discount items
# Usage: map_stripe_coupons_to_netsuite.rb mapping.csv
# Link: https://gist.github.com/iloveitaly/eed7602d055d5402dd34d0ba79de6ca2
require 'stripe'
require 'csv'
Stripe.api_key = ENV['STRIPE_KEY']
View update_stripe_customer_from_netsuite.js
// Link: https://gist.github.com/iloveitaly/0e6d012d8dffa2444e0b36c0ec7b5781
define([ 'N/search', 'N/record', 'N/runtime', 'N/error', 'N/https' ],
function(search, record, runtime, error, https) {
var STRIPE_KEY = 'sk_test_123';
var STRIPE_ENDPOINT = 'https://api.stripe.com/v1/';
function afterSubmit(context) {
if(context.type !== context.UserEventType.UPDATE) {
View netsuite_gift_card_code_using_external_service.js
/*
Author: Mike Bianco <mike@suitesync.io>
Description: Generate a gift card code using an external service when a sales order is created
Link:
# Setup Instructions
## Upload Script
https://system.sandbox.netsuite.com/app/common/scripting/uploadScriptFile.nl
File Name: gift_card_generate_before_submit.js
@iloveitaly
iloveitaly / create_standalone_payment_with_custom_metadata.rb
Created Dec 7, 2018
Use a standalone Stripe payment to create an invoice in NetSuite with custom data http://SuiteSync.io/
View create_standalone_payment_with_custom_metadata.rb
# Michael Bianco <mike@suitesync.io>
# Description: Use a standalone payment to create an invoice in NetSuite with customized metadata
# https://dashboard.suitesync.io/docs/standalone-charges
# Link:
#
# Usage:
#
# export STRIPE_KEY=sk_test
# gem install stripe netsuite
# ruby create_standalone_payment_with_custom_metadata.rb
@iloveitaly
iloveitaly / stripe_invoice_with_custom_rev_rec.rb
Last active Nov 21, 2018
Create a Stripe invoice with a custom revenue recognition schedule. http://SuiteSync.io/
View stripe_invoice_with_custom_rev_rec.rb
# Michael Bianco <mike@suitesync.io>
# Description: Create a Stripe invoice with a custom rev rec schedule
require 'stripe'
Stripe.api_key = ENV['STRIPE_KEY']
customer = Stripe::Customer.create
customer.sources.create(card: 'tok_visa')
@iloveitaly
iloveitaly / map_custom_field_to_netsuite_field.js
Created Nov 14, 2018
Translate one field value on a NetSuite transaction to a value or record reference on another record. http://SuiteSync.io/
View map_custom_field_to_netsuite_field.js
/*
Author: <mike@suitesync.io>
Description: Maps an ID passed to a custom field on the NetSuite invoice to a
class record reference in Netsuite.
Link: https://gist.github.com/iloveitaly/da9b88e318025ec53f5bc36ff4dafdcf
Installation:
1. https://system.netsuite.com/app/common/scripting/uploadScriptFile.nl
2. User Event
3. Name: Map Custom Field to Class
View close_old_invoices_in_stripe.rb
# Author: <mike@suitesync.io>
# Description: batch close old invoices in Stripe
# Link: https://gist.github.com/iloveitaly/e3c9eb87aa70f350977c22215304079c
require 'stripe'
Stripe.api_key = ENV['STRIPE_KEY']
close_invoices_before_date = Date.new(2016, 05, 15).to_time.to_i
View adjust_inferred_invoice.js
/*
Author: <mike@suitesync.io>
Description: Modifies data on an "inferred" NetSuite invoice created from a standalone Stripe charge
Link: https://gist.github.com/iloveitaly/350363f07b13d7ac81bf81784c1417c9
Installation:
1. https://system.sandbox.netsuite.com/app/common/scripting/uploadScriptFile.nl
2. User Event
3. Name: SuiteSync Inferred Invoice Customization
4. ID: _suitesync_inferred_invoice
View remove_cards_on_stripe_customers.rb
# Michael Bianco <mike@suitesync.io>
# Description: An example script demonstrating how to remove customer cards. This
# is helpful for keeping a card around temporarily for reauthorizing a
# expired card authorization. More information:
# https://dashboard.suitesync.io/docs/auth-fulfill-capture#id-like-to-create-an-authorization-for-more-than-7-
# Link: https://gist.github.com/iloveitaly/683a4664708ea972ca2e081e55b7c547
# Usage:
#
# export STRIPE_KEY=sk_test NETSUITE_EMAIL=user@company.com NETSUITE_PASSWORD=password NETSUITE_ACCOUNT=
View netsuite_generate_stripe_payment_for_estimates.js
/*
Author: <mike@suitesync.io>
Description: Generates the Stripe Payment Link for Estimates, or other records in NetSuite
Link:
Installation:
Create Custom Field:
1. https://dashboard.suitesync.io/docs/netsuite-configuration#creating-the-stripe-quote-payment-link-custom-field
2. Make sure the field has `Store Value` checked and is a free-form text field
You can’t perform that action at this time.