#!/bin/bash
# https://sipb.mit.edu/doc/safe-shell/
set -euf -o pipefail
command -v jq >/dev/null 2>&1 || { echo >&2 "I require 'jq' but it's not installed. Try 'brew install jq'. Aborting."; exit 1; }
trap "echo 'Command syntax: BF_add_webhook_sub.sh private_token bf_subdomain webhook_subscriptions [specific_webhook_id]
Example invocation: ./BF_add_webhook_sub.sh MY_PRIVATE_TOKEN api-sandbox \"Account.Created,Subscription.Paid\"'" EXIT SIGHUP SIGINT SIGTERM
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Regarding SaaS BillForward environments…
- Current environments:
- [Production] https://app.billforward.net/
- [Sandbox] https://app-sandbox.billforward.net/
- Sandbox cannot perform real transactions; it can only use payment gateways in Sandbox mode.
- Each environment is a separate instance of the entire BillForward stack.
- no data is shared between environments.
Regarding Organizations:
- Organizations essentially are a partition on the environment's dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function eatIfHungry() { | |
// states we need to think about: | |
// - isHungry | |
// - !isHungry | |
if (!$this->isHungry()) { | |
// states we need to think about: | |
// - !isHungry | |
return; |
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'."); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
NewerOlder