npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

auth-net-cim

v2.4.0

Published

Authorize.net CIM bindings for Node.JS

Downloads

250

Readme

Authorize.net CIM

Dependency Status devDependency Status

Authorize.net CIM bindings for Node.JS

Install

npm install auth-net-cim

Tests

AUTH_CONFIG=/path/to/config.json make tests

config.json

{
  "api": "123",
  "key": "1234",
  "sandbox": true
}

Usage

Assuming we're doing:

var Authorize = require('auth-net-types')
  , _AuthorizeCIM = require('auth-net-cim')
  , AuthorizeCIM = new _AuthorizeCIM({
    api: '123',
    key: '124',
    sandbox: true // false
  });

createCustomerProfile

AuthorizeNetCIM.createCustomerProfile({customerProfile: {
  merchantCustomerId: 123,
  description: 'A customer with a lot of cash.',
  email: '[email protected]',
  customerProfileId: 1234
}}, function(err, response){})
var profile = {
  merchantCustomerId: 123,
  description: 'A customer with a lot of cash.',
  email: '[email protected]',
  customerProfileId: 1234
}

var bankAccount = new Authorize.BankAccount({
  accountType: 'businessChecking',
  routingNumber: '121042882',
  accountNumber: '123456789123',
  nameOnAccount: 'Jane Doe',
  bankName: 'Pandora Bank'
})
, payment = new Authorize.Payment({
  bankAccount: bankAccount
});

profile.paymentProfiles = new Authorize.PaymentProfiles({
  customerType: 'business',
  payment: payment
});

AuthorizeNetCIM.createCustomerProfile({customerProfile: profile}, function(err, response){});

createCustomerPaymentProfile

var options = {
  customerType: 'individual',
  payment: {
    creditCard: new Authorize.CreditCard({
      cardNumber: '4111111111111111',
      expirationDate: '2012-10'
    })
  }
}

AuthorizeCIM.createCustomerPaymentProfile({
  customerProfileId: '123',
  paymentProfile: options
}, function(err, response) {});

createCustomerProfileFromTransaction

AuthorizeNetCIM.createCustomerProfileFromTransaction({customerProfile: {
  transactionId: 1234
}}, function(err, response){})

createCustomerShippingAddress

AuthorizeCIM.createCustomerShippingAddress({
  customerProfileId: '123',
  shippingAddress: new Authorize.ShippingAddress({
    firstName: 'Bob',
    lastName: 'Smith',
    address: '123 Sesame St',
    city: 'Gainesville',
    state: 'FL',
    zip: 32601,
    country: 'us'
  })
}, function(err, response) {});

updateCustomerProfile

AuthorizeCIM.updateCustomerProfile(new Authorize.CustomerBasic({
  email: '[email protected]',
  merchantCustomerId: 1234,
  description: 'New description!',
  customerProfileId: this.customerProfileId
}), function(err, response) {});

updateCustomerPaymentProfile

AuthorizeCIM.updateCustomerPaymentProfile({
  customerProfileId: '123',
  paymentProfile: new Authorize.PaymentProfile({
    customerPaymentProfileId: 444,
    customerType: 'business',
    payment: new Authorize.Payment({
      creditCard: new Authorize.CreditCard({
        cardNumber: '4007000000027',
        expirationDate: '2012-10',
        cardCode: 111
      })
    })
  })
}, function(err, response) {});

updateCustomerShippingAddress

AuthorizeCIM.updateCustomerShippingAddress({
  customerProfileId: '123',
  address: new Authorize.ShippingAddress({
    firstName: 'John',
    lastName: 'Smith',
    state: 'TX',
    country: 'US',
    zip: 11111,
    customerAddressId: null
  })
}, function(err, response) {});

getCustomerProfile

AuthorizeCIM.getCustomerProfile('123', function(err, response) {});

getCustomerPaymentProfile

AuthorizeCIM.getCustomerPaymentProfile({
  customerProfileId: '123',
  customerPaymentProfileId: '1234'
}, function(err, response) {});

getCustomerShippingAddress

AuthorizeCIM.getCustomerShippingAddress({
  customerProfileId: '123',
  customerAddressId: '1234'
}, function(err, response) {});

validateCustomerPaymentProfile

AuthorizeCIM.validateCustomerPaymentProfile({
  customerProfileId: '123',
  customerPaymentProfileId: '1234',
  validationMode: 'testMode' // liveMode
}, function(err, response) {});

createCustomerProfileTransaction

var transaction = {
  amount: 56.01,
  tax: {
    amount: 12.44,
    name: 'State Tax',
    description: 'FL'
  },
  shipping: {
    amount: 5.00,
    name: 'FedEx Ground',
    description: 'No Free Shipping Option'
  },
  customerProfileId: '123',
  customerPaymentProfileId: '1234',
  order: {
    invoiceNumber: 1337
  }
};

AuthorizeCIM.createCustomerProfileTransaction('AuthCapture' /* AuthOnly, CaptureOnly, PriorAuthCapture */, transaction, function(err, response) {});

updateSplitTenderGroup

AuthorizeCIM.updateSplitTenderGroup({
  splitTenderId: 1,
  splitTenderStatus: 'voided'
}, function(err, response) {});

deleteCustomerPaymentProfile

AuthorizeCIM.deleteCustomerPaymentProfile({
  customerProfileId: '123',
  customerPaymentProfileId: '1234'
}, function(err, response) {});

deleteCustomerShippingAddress

AuthorizeCIM.deleteCustomerShippingAddress({
  customerProfileId: '123',
  customerAddressId: '1234'
}, function(err, response) {});

deleteCustomerProfile

AuthorizeCIM.deleteCustomerProfile('123', function(err, response) {});

setExtraOptions

AuthorizeCIM.setExtraOptions({
  x_duplicate_window: 0
});
AuthorizeCIM.createCustomerProfileTransaction(..., function(err) {
  // Then clear the extra options if needed
  AuthorizeCIM.setExtraOptions();
});

Note

Version >= 2.x.x has a breaking change, all values are returned as strings rather than strings and numbers (unless the value is an object, array, etc).