Skip to content

Instantly share code, notes, and snippets.

@darilldrems
darilldrems / create ssh config.sh
Created March 23, 2016 13:28 — forked from yomexzo/create ssh config.sh
Troublshooting tools
#! /usr/bin/env python
import re
from os import path, listdir
from os.path import isfile, join
config_path = path.abspath(path.expanduser('~') + '/.ssh/config')
template = 'Host {}\n\tStrictHostKeyChecking no\n\tHostName {}\n\tUser {}\n\n'
begin = '#WRW HOST VARS - START'
end = '#WRW HOST VARS - END'
@darilldrems
darilldrems / pwc-example-php-authentication.php
Last active July 21, 2016 13:09
An example code for oAuth 2.0 Authentication with PayWithCapture API in PHP.
<?php
use PayWithCapture\Services;
$clientId = "84747hfyfyf"; //Your client id is in PwC devcenter account page
$clientSecret = "7446ydt77464"; //Your client secret is in PwC devcenter account page
$env = "staging";
$auth = new Authentication($clientId, $clientSecret, $env);
$auth->loadAccessToken();
//once loaded, you can get your access token with
var PayWithCapture = require('PayWithCapture');
var clientId = "636yertryrury", //your client id is in PwC devcenter
clientSecret = "76474hrhryre7437433yg3y3uy3yugregregr37464t4g45"; //your client secret in in Pwc devcenter account
var client = new PayWithCapture(clientId, clientSecret, "staging");
var Authentication = client.getAuthenticationClient();
new Authentication().authenticate()
.then(function(authResp) {
curl https://pwcstaging.herokuapp.com/oauth/token \
-d client_id=audyyhf47646 \
-d client_secret=46464urhfgfyr66474 \
-d grant_type=client_credentials
@darilldrems
darilldrems / hosted-payment-page
Created July 21, 2016 15:41
PayWithCapture hosted payment page curl example.
curl https://pwcstaging.herokuapp.com/oauth/token \
-d merchant_id=audyyhf47646 \
-d amount=4000 \
-d description=payment for laptop \
-d redirect_url=http://forloop.com.ng
-d transaction_id=773649uryy
-d customer_email=dd@gmail.com
-d customer_phone=09098090908
curl https://pwcstaging.herokuapp.com/orders/transactions?merchant_code=64545636353 \
-H "Authorization: Bearer [access_token_here]"
or
curl https://pwcstaging.herokuapp.com/orders/transactions?reference_no=64545636353
-H "Authorization: Bearer [access_token_here]"
@darilldrems
darilldrems / pwc-pos-example.php
Created July 21, 2016 16:40
PwC pos printing example in php
<?php
use PayWithCapture\PayWithCaptureClient;
$clientId = ""; //Your client id is in your devcenter account page
$clientSecret = ""; //Your client secret is in your devcenter account page
$env = "staging"; //this can either be staging or production
$client = new PayWithCaptureClient($clientId, $clientSecret, $env);
$posClient = $client->getPOSPrintingClient();
@darilldrems
darilldrems / pwc-pos-example-node.js
Created July 21, 2016 16:43
PwC pos printing example in javascript for Nodejs server application.
var PayWithCapture = require('PayWithCapture');
var clientId = "eyet636484u4h", //Your clientId is in your PayWithCapture DevCenter account page
clientSecret = "736484yekhgutit857485", //Your clientSecret is in your PayWithCapture DevCenter account page
env = "staging"; // env can either be staging or production
var pwcClient = new PayWithCapture(clientId, clientSecret, env);
var posClient = pwcClient.getPosPrinting();
var merchantCode = "474649"; //You merchant code is in your account page on PayWithCapture DevCenter
//this method will return transactions done by a merchant
GET curl https://pwcstaging.herokuapp.com/otp/sms/[phonenumber_here]
-H "Authorization: Bearer [access_token_here]"
or
GET curl https://pwcstaging.herokuapp.com/otp/voice/[phonenumber_here]
-H "Authorization: Bearer [access_token_here]"
<?php
use PayWithCapture\PayWithCaptureClient;
//You can find your clientId, $clientSecret in your PayWithCapture DevCenter settings page
$clientId = "745474656hdhdgftfyfjfkg";
$clientSecret = "jyrtr64546470od";
$env = "staging"; // $env should be "staging" when in dev mode and in production change to "production"
$client = new PayWithCaptureClient($clientId, $clientSecret, $env);
$otpClient = $client->getOtpClient();