Skip to content

Instantly share code, notes, and snippets.

View cafeasp's full-sized avatar

Victor Pacheco cafeasp

View GitHub Profile
@cafeasp
cafeasp / parse-edi-file.cs
Created February 23, 2023 14:33
.net to parse an edi file
using System.Text;
using EdiEngine;
using EdiEngine.Runtime;
using Newtonsoft.Json;
namespace ParseEDI;
class Program
{
static async Task Main(string[] args)
{
@cafeasp
cafeasp / AppSettings.config
Created October 22, 2022 01:32
This is an xml file that will get merge with Web.config file in Visual Studio
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<add key="Scope" value="read_products"/>
<add key="ShopifyApiVersion" value="2020-10"/>
<add key="Secret" value="secret_key"/>
<add key="AppId" value="api_key"/>
</appSettings>
@cafeasp
cafeasp / Google Drive API C#
Last active November 9, 2023 10:59
Google Drive API Demo. For this to work you need to get the credentials.
using Google.Apis.Auth.OAuth2;
using Google.Apis.Drive.v3;
using Google.Apis.Services;
using Google.Apis.Util.Store;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
@cafeasp
cafeasp / Suitelet-CloseSalesOrder.js
Created July 24, 2019 10:11
NetSuite-Suitelet Suite Script Close Sales Order
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
* @NModuleScope SameAccount
*/
define(['N/file', 'N/record', 'N/redirect', 'N/search', 'N/ui/serverWidget', 'N/runtime', 'N/email'],
/**
* @param {file} file
* @param {record} record
* @param {redirect} redirect
@cafeasp
cafeasp / CloseSalesOrder.js
Created July 19, 2019 22:21
Sales Order - Close Sales Order
function closeSalesOrder(salesOrderInternalId) {
try {
var order = record.load({
id: salesOrderInternalId,
type: record.Type.SALES_ORDER,
isDynamic: true
});
var itemIndex = 0;
@cafeasp
cafeasp / LoadSaveSearch.js
Created July 15, 2019 19:14
NetSuite Load Save Search
function RunSaveSearch() {
var mySearch = search.load({
id: '111111'
});
var array = [];
mySearch.run().each(function (result) {
log.debug('result', result);
var netamount = result.getValue({
name: 'netamount'
@cafeasp
cafeasp / restlet_item_fulfillment.js
Created July 15, 2019 17:08
NetSuite - Suite Script Create Item Fulfillment
/**
* @NApiVersion 2.x
* @NScriptType Restlet
* @NModuleScope SameAccount
*/
define(['N/search', 'N/record', 'N/util', './momentjs.js', './cafeaspMagento.js'],
/**
* @param {search} search
* @param {record} record
* @param {util} util
@cafeasp
cafeasp / CheckDuplicateValue.js
Last active July 15, 2019 16:23
NetSuite SuiteScript 2.0
function IsNewOrder(orderId) {
var s = search.create({
type: search.Type.SALES_ORDER,
filters: [
['mainline', 'is', 'T'], 'and',
['trandate', 'onorafter', '04/01/2019'], 'and',
['otherrefnum', 'equalto', orderId]
],
columns: ['otherrefnum']
}).run().getRange({
@cafeasp
cafeasp / CreateCustomerDeposit.js
Created July 12, 2019 00:10
NetSuite - Create Customer Deposit
function CreateCustomerDeposit(salesOrderId, paymentMethod) {
try {
if (paymentMethod != 'free') {
var order = record.load({
id: salesOrderId,
type: record.Type.SALES_ORDER,
isDynamic: true
});
@cafeasp
cafeasp / index.js
Created May 24, 2019 02:38
Node js - Quickstart
const fs = require('fs');
const readline = require('readline');
const { google } = require('googleapis');
//Drive API, v3
//https://www.googleapis.com/auth/drive See, edit, create, and delete all of your Google Drive files
//https://www.googleapis.com/auth/drive.file View and manage Google Drive files and folders that you have opened or created with this app
//https://www.googleapis.com/auth/drive.metadata.readonly View metadata for files in your Google Drive
//https://www.googleapis.com/auth/drive.photos.readonly View the photos, videos and albums in your Google Photos
//https://www.googleapis.com/auth/drive.readonly See and download all your Google Drive files
// If modifying these scopes, delete token.json.