Unzip glassfish_setup.zip
(this is a snapshot of the jars we use in Prod or something).
You will need to rename those jars first..
var BillForward = require('BillForward'); | |
var _ = require('lodash'); // lodash is the strongest | |
var Q = require('q'); | |
var config = { | |
"urlRoot": "https://api-sandbox.billforward.net:443/v1/", | |
"accessToken": "INSERT ACCESS TOKEN HERE", | |
// longStack: true, | |
"requestLogging": true, | |
"responseLogging": false, |
BillForward.Account.getByID('ACC-81674A80-3B2D-4327-8C24-994720BA') | |
.then(function(account) { | |
// you might want to take a peek at the account | |
// console.log(account.toString()); | |
// get relevant payment method: | |
var paymentMethod =_.findWhere(account.paymentMethods, {'gateway': 'stripe'}); | |
// the SDK seems to have an unserialization problem; we need to manually tell JavaScript that this JSON is a BillForward.PaymentMethod: | |
_paymentMethod = new BillForward.PaymentMethod(paymentMethod); |
BillForward.Account.getByID('ACC-81674A80-3B2D-4327-8C24-994720BA') | |
.then(function(account) { | |
models.creditNote = new BillForward.CreditNote({ | |
'accountID': account.id, // predicated on account's first being created | |
'value': 100, | |
'currency': 'USD' | |
}); | |
return BillForward.CreditNote.create(models.creditNote); | |
}) | |
.done(); |
BillForward.Account.getByID('ACC-81674A80-3B2D-4327-8C24-994720BA') | |
.then(function(account) { | |
// you might want to take a peek at the account | |
// console.log(account.toString()); | |
// get relevant payment method: | |
var paymentMethod =_.findWhere(account.paymentMethods, {'defaultPaymentMethod': true}); | |
if (paymentMethod === undefined) throw new Error("No default payment method found for this account. Of course it is still possible that this account can pay via credit or 'offline payments'."); | |
Install Rvm (lets you switch between Ruby versions)
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable
Check what Ruby versions are available
<?php | |
public function eatIfHungry() { | |
// states we need to think about: | |
// - isHungry | |
// - !isHungry | |
if (!$this->isHungry()) { | |
// states we need to think about: | |
// - !isHungry | |
return; |
Regarding SaaS BillForward environments…
Regarding Organizations:
InvoicePayments are mutable. When you perform a refund: we update the InvoicePayment in-place. | |
If you refund a Payment, I think it goes something like this: | |
- definitely persist a Refund | |
- definitely persist a Receipt (unless it breaks before we begin our chat with the payment gateway) | |
- persist an "credit" Payment — but only if Refund succeeds | |
- mutate the InvoicePayment — but only if Refund succeeds |
Here's how to tidy away the configuration for the bf_ruby2
SDK.
Store your config in config.yml
:
config:
host: "api-sandbox.billforward.net:433"
scheme: "https"
base_path: "v1"
debugging: false