Skip to content

Commit

Permalink
Merge pull request #1 from earlyshen/develop
Browse files Browse the repository at this point in the history
Fix registered card issue
  • Loading branch information
earlyshen authored Dec 17, 2016
2 parents 1a93b22 + 2b51647 commit 7ef67aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cards.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Card Number,Month,Year,CVV
4551722007609849,08,25,251
4551722003898800,08,25,158
Card Number,Month,Year,CVV,Zip Code,Note
4551722007609849,08,25,251,,Zip code is not required if the card is not registered
4551722003898800,08,25,158,00000,Must have a zip code if the card is registered
7 changes: 4 additions & 3 deletions gcmall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

require 'CSV'

def getBalance(card, month, year, cvv)
def getBalance(card, month, year, cvv, postal)
postal = postal == nil ? "00000" : postal
url = 'https://mygift.giftcardmall.com/Card/Login?returnUrl=Transactions'
`curl -sS -c cookie --data "CardNumber=#{card}&ExpirationMonth=#{month}&ExpirationYear=#{year}&SecurityCode=#{cvv}" #{url}`
`curl -sS -c cookie --data "PostalCode=#{postal}&CardNumber=#{card}&ExpirationMonth=#{month}&ExpirationYear=#{year}&SecurityCode=#{cvv}" #{url}`
response = `curl -sS -b cookie -H "Referer: #{url}" 'https://mygift.giftcardmall.com/Card/Transactions'`
matches = response.scan(/<\/h6><h5>([\d\.\$]+)<\/h5><\/td>/i)
if matches.count == 3
Expand All @@ -23,7 +24,7 @@ def getBalance(card, month, year, cvv)

CSV.foreach("cards.csv", { headers: true, header_converters: :symbol }) do |row|
card = row.to_hash
last4, available, initial = getBalance(card[:card_number], card[:month], card[:year], card[:cvv])
last4, available, initial = getBalance(card[:card_number], card[:month], card[:year], card[:cvv], card[:zip_code])
if last4
printf("%13s %10s %8s\n", last4, available, initial)
else
Expand Down

0 comments on commit 7ef67aa

Please sign in to comment.