GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — NFCityServer/softheon.py at master · taiseiak/NFCityServer

Expand file tree

/

softheon.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
113 lines (86 loc) · 3.16 KB
/

softheon.py

Copy path

File metadata and controls

113 lines (86 loc) · 3.16 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import base64
import requests
import json
TOKEN_END_POINT_URL = \
'https://hack.softheon.io/api/identity/core/connect/token'
CREDIT_CARD_END_POINT_URL = \
'https://hack.softheon.io/api/payments/v1/creditcards'
PAYMENT_END_POINT = 'https://hack.softheon.io/api/payments/v1/payments'
class CreditCard:
def __init__(self, card_number, security_code, exp_month, exp_year,
card_holder_name, billing_address, email):
self.card_number = card_number
self.security_code = security_code
self.expiration_month = exp_month
self.expiration_year = exp_year
self.card_holder_name = card_holder_name
self.billing_address = billing_address
self.email = email
# convert the credit card object to json
def to_json(self):
json = {
"cardNumber": self.card_number,
"securityCode": self.security_code,
"expirationMonth": int(self.expiration_month),
"expirationYear": int(self.expiration_year),
"cardHolderName": self.card_holder_name,
"billingAddress": self.billing_address,
"email": self.email,
}
return str(json)
def retrieve_access_token(client_id, client_secret):
# The token request end point
# The authorization token - a base 64 encoding of 'client_id:client_secret'
auth_token = base64.standard_b64encode((client_id + ':' + client_secret).encode('ascii'))
# declare request headers
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic ' + str(auth_token)
}
# declare request body
body = {
'scope': 'paymentapi',
'grant_type': 'client_credentials'
}
# call http POST
req = requests.post(TOKEN_END_POINT_URL, headers=headers, data=body)
# load the response text as json
resp_json = json.loads(req.text)
print(resp_json)
return resp_json['access_token']
def retrieve_credit_card_token(credit_card, access_token):
# set the headers
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + access_token
}
req = requests.post(CREDIT_CARD_END_POINT_URL, headers=headers,
data=credit_card.to_json())
resp_json = json.loads(req.text)
return resp_json['token']
def make_payment(access_token, credit_card_token, payment_amount):
"""Returns a json that has the payment information"""
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + access_token
}
payment_method = {
'paymentToken': str(credit_card_token),
'type': 'Credit Card'
}
payment = {
'paymentAmount': payment_amount,
'paymentMethod': payment_method
}
payment_json = str(payment)
req = requests.post(PAYMENT_END_POINT, headers=headers, data=payment_json)
resp_json = json.loads(req.text)
"""
print
'\nRESULT: ' + str(resp_json['result']['status'])
print
'AMOUNT: ' + str(resp_json['paymentAmount'])
print
'TYPE: ' + str(resp_json['paymentMethod']['type'])
"""
return resp_json
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.