I’m just gonna dump this code block I wrote so I don’t have to click and point on PCF’s messed up website.
I’m going to assume you probably know how to use PowerShell modules and using that said function. In this case all you need to do with this function is:
Get-PCFBalance -CardNumber 6018871011111110 -Password InsertYourPasswordInPlainTextHere
Unfortunately due to the use of a plain-text password above, I’d strongly suggest that you don’t store your password in a script if you need to perform crazy tasks with this cmdlet. You have been warned.
And oh, one word of warning, PCF authenticates “trusted” computers by IP Addresses. This means if you need to use this script, you’ll probably have to login to the site with a real browser once, answer those security questions and then use this cmdlet.
Code dump below, use it to your liking. And yes, it’s licensed under the BSD 2-Clause license as with most of my new stuff is licensed under nowadays.
<#
PowerShell functions for PC Financial Banking Division's Web Services
Copyright (C) 2013 Jeff Leung jleung at v10networks.ca
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#>
function Get-PCFBalance
{
<#
.SYNOPSIS
Get your current account balance from PC Financial. It is strongly reccommended that you login first with a browser as this script does not implement answers to your set security questions! Yes, PCF recognizes trusted machines by IP Address at this time. They do realize that IP can be easily spoofed right?
.DESCRIPTION
Get your current account balance from PC Financial. It is strongly reccommended that you login first with a browser as this script does not implement answers to your set security questions! Yes, PCF recognizes trusted machines by IP Address at this time. They do realize that IP can be easily spoofed right?
.PARAMETER CardNumber
Your Bank Card Number
.PARAMETER Password
Your Banking Password
#>
param (
[parameter(Mandatory=$true)]
[string]$CardNumber,
[parameter(Mandatory=$true)]
[string]$Password
)
Process {
$response = Invoke-WebRequest -Uri https://www.txn.banking.pcfinancial.ca/a/authentication/preSignOn.ams -SessionVariable session
$form_data = ($response.Forms | Where-Object { $_.Id -eq "SignOnForm" }).Fields
$form = $response.Forms | Where-Object { $_.Id -eq "SignOnForm" }
$form_data.cardNumber = $CardNumber
$form_data.password = $Password
$response2 = Invoke-WebRequest -Uri "https://www.txn.banking.pcfinancial.ca$($form.Action)" -Method Post -Body $form_data -SessionVariable session
$balances = $response2.AllElements | Where-Object { $_.class -eq "tdBorder" }
$counter = 0
$obj = @()
for ($count=1; $count -le ($balances.Count / 4); $count++)
{
$balance = [ordered]@{
AccountType = $balances[$counter++].InnerText
BankCardDesignation = $balances[$counter++].InnerText
FundsAvail = $balances[$counter++].InnerText
Balance = $balances[$counter++].InnerText
}
$balance_property = New-Object PSObject -Property $balance
$obj +=$balance_property
}
return $obj
}
}