Skip to content

Instantly share code, notes, and snippets.

View judgej's full-sized avatar

Jason Judge judgej

View GitHub Profile
@judgej
judgej / gist:38d5bcba3c8f5e3f6fa5
Created August 29, 2014 15:10
XMLRPC Pay Invoice?
Feed - OpenERP Feed - OpenERP * FAQ
Last visit was: Wed May 15, 2013 6:36 am It is currently Wed May 15, 2013 6:36 am
Board index » OpenERP - Development Topics » General Questions
All times are UTC
XMLRPC Pay Invoice?
<?php
namespace XeroPHP\Models\Accounting;
use XeroPHP\Remote;
class BatchPayments extends Remote\Object {
/**
@judgej
judgej / sagepay.js
Last active February 4, 2017 11:44
sagepay.js 2016-01-23
/* 1.0.0-1290 - Mon Jan 23 13:18:16 GMT 2017 */
var SagePayConfig = {
'restHost': 'https://pi-test.sagepay.com',
'restBaseURL': 'https://pi-test.sagepay.com/api/v1',
'hostedPagesSubPath': '/hosted/docs',
'pages': {
'standardCardDetails': 'card-details-form.html',
'reusableCardIdentifier': 'reusable-card-identifier-form.html'
}
};
/* 1.0.0-1409 - Tue Jun 20 13:38:59 BST 2017 */
var SagePayConfig = {
'restHost': 'https://pi-test.sagepay.com',
'restBaseURL': 'https://pi-test.sagepay.com/api/v1',
'hostedPagesSubPath': '/hosted/docs',
'pages': {
'standardCardDetails': 'card-details-form.html',
'reusableCardIdentifier': 'reusable-card-identifier-form.html'
}
};

These are the four valid combinations of fields that make up a card payment type. Both reusable/save flags default to FALSE, so setting the field to "false" or leaving it blank are equivalent:

card-identifier session-key reusable save notes
first-use string string FALSE TRUE Card tokenised on the front end; saved as reusable after transaction.
first-use string string FALSE FALSE Card tokenised on the front end; not reusable after transaction.
second-use string n/a TRUE FALSE Reusing a saved card; no CVV checks.
second-use string string TRUE FALSE Reusing a saved card; with CVV checks.

The first-use string is the card identifier used for the first time. second-use is the same card identifier stored and used again.

@judgej
judgej / setphp
Last active January 24, 2020 17:28
bash script to switch between PHP versions in Plesk
#!/bin/bash
# Use the script like this:
# . setphp 7.1
# or
# source setphp 5.6
#
# It will look for the path to the current PHP version in your PATH and switch to
# the new PHP version.
# If you do not have a path to a php version, then it will add one.
@judgej
judgej / readme.md
Created June 2, 2018 23:14 — forked from Lemmings19/readme.md
Set up Laravel 5.4 in an Ubuntu VM on Windows

To setup Laravel inside an Ubuntu virtual machine on Windows

Tested on Windows 10. Probably works in 7 and 8. I wrote this after I went through all of it, so let me know if I forgot a step.

In this guide:

  • VirtualBox (allows you to run a Linux operating system such as Ubuntu while you are running Windows)
  • Ubuntu 16.04 64 (a user friendly Linux installation that will be supported for many years)
  • LAMP stack (Linux, Apache, MySQL, PHP - all of the things that you will run your web application on)
  • Composer (this just manages your PHP dependencies, such as Laravel)
<?php
namespace App\Services;
use GuzzleHttp\Client;
class DataStoreApi
{
// set public variables
public $client;
<?php
class ImmutableClass
{
protected $property1;
protected $property2;
// Clone, set value, return the clone.
public function withProperty1($value)
{
COUNTRIES_WITHOUT_POSTCODES = [
[ "Angola", "AO" ],
[ "Antigua and Barbuda", "AG" ],
[ "Aruba", "AW" ],
[ "Bahamas", "BS" ],
[ "Belize", "BZ" ],
[ "Benin", "BJ" ],
[ "Bolivia", "BO" ],
[ "Botswana", "BW" ],
[ "Burkina Faso", "BF" ],