Skip to content

Instantly share code, notes, and snippets.

Avatar

Alfred Rowe nukturnal

View GitHub Profile
@nukturnal
nukturnal / simple_deploy.rb
Created Sep 18, 2012
Simple script to help with Rails deployment tasks. Requires "Rye Gem"
View simple_deploy.rb
require 'rubygems'
require 'rye'
HOST = "yourserver"
USER = "username"
PASS = "password"
app_path = "/path/to/rails_app_root"
production_env = "RAILS_ENV=production"
@nukturnal
nukturnal / api_conf.php
Last active Oct 12, 2015
MPower PHP API Keys Configuration
View api_conf.php
<?php
MPower_Setup::setMasterKey("dd6f2c90-f075-012f-5b69-00155d866600");
MPower_Setup::setPublicKey("test_public_oDLVlm1eNyh0IsetdhdJvcl0ygA");
MPower_Setup::setPrivateKey("test_private_zzF3ywvX9DE-OSDNhUqKoaTI4wc");
MPower_Setup::setMode("test");
MPower_Setup::setToken("ca03737cf942cf644f36");
@nukturnal
nukturnal / store_conf.php
Last active Oct 12, 2015
MPower PHP Checkout Store Configuration
View store_conf.php
<?php
//Setup your Store information
MPower_Checkout_Store::setName("My Awesome Online Store");
MPower_Checkout_Store::setTagline("My awesome store's awesome tagline");
MPower_Checkout_Store::setPhoneNumber("0302507099");
MPower_Checkout_Store::setPostalAddress("Post office Box AN 10604");
@nukturnal
nukturnal / library.php
Created Nov 6, 2012
MPower PHP Library Setup
View library.php
require('mpower/mpower.php');
@nukturnal
nukturnal / building_checkout_invoice.php
Last active Oct 12, 2015
MPower PHP Checkout Invoice setup
View building_checkout_invoice.php
<?php
/* Adding items to your invoice is very basic, the parameters expected are
name_of_item, quantity, unit_price, total_price and optional item
description. */
$invoice->addItem("13' Apple Retina 500 HDD",1,10.99,10.99);
$invoice->addItem("Case Logic laptop Bag",2,100.50,201,"Optional description");
$invoice->addItem("Philips electric shaver",2,50.50,101.00);
/* You can optionally set a general invoice description text which can
be used in cases where your invoice does not need an items list or in cases
@nukturnal
nukturnal / total_amount.php
Last active Oct 12, 2015
MPower PHP Checkout Total Amount Set
View total_amount.php
<?php
$invoice->setTotalAmount(1200.99);
@nukturnal
nukturnal / add_tax.php
Last active Oct 12, 2015
MPower PHP Checkout Invoice Adding Tax
View add_tax.php
<?php
// The parameters for setting add tax are title_of_the_tax, tax_amount
$invoice->addTax('VAT (15%)',50);
$invoice->addTax('NHIL (5%)',50);
@nukturnal
nukturnal / cancel_url.php
Last active Oct 12, 2015
MPower PHP Checkout Invoice Cancel URL
View cancel_url.php
<?php
// Globally setting cancel URL, the piece of code below
// should be included with the checkout shop setup code
MPower_Checkout_Store::setCancelUrl("http://www.myawesomeshop.com/");
// Setting the cancel URL on an invoice instance.
// This will overwrite any global settings for cancel URL
$invoice->setCancelUrl("http://www.myawesomeshop.com/");
@nukturnal
nukturnal / create_redirect_checkout.php
Last active Oct 12, 2015
MPower PHP Library Checkout Invoice Creation & Redirection
View create_redirect_checkout.php
<?php
// The code below depicts how to create the checkout invoice on our servers
// and redirect to the checkout page.
if($invoice->create()) {
header("Location: ".$invoice->getInvoiceUrl());
}else{
echo $invoice->response_text;
}
@nukturnal
nukturnal / return_url.php
Last active Oct 12, 2015
MPower PHP Checkout Invoice Return URL
View return_url.php
<?php
// Globally setting return URL, the piece of code below
// should be included with the checkout shop setup code
MPower_Checkout_Store::setReturnUrl("http://www.myawesomeshop.com/confirm.php");
// Setting the return URL on an invoice instance.
// This will overwrite any global settings for return URL
$invoice->setReturnUrl("http://www.myawesomeshop.com/confirm.php");