This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Type definitions for square-connect 2.20190814 | |
// Project: https://docs.connect.squareup.com/ | |
// Definitions by: Dmitri Dimitrioglo <https://github.com/ddimitrioglo> | |
// Richard Moot <https://github.com/mootrichard> | |
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | |
// TypeScript Version: 2.4 | |
export type CountryEnum = | |
'ZZ' | | |
'AD' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import './App.css'; | |
import PaymentForm from './components/PaymentForm'; | |
class App extends Component { | |
constructor(props){ | |
super(props) | |
this.state = { | |
loaded: false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
line_count = 1 | |
tip_amount_sum = 0 | |
def process_line(lines): | |
global line_count | |
global tip_amount_sum | |
line_count += 1 | |
tip_amount_sum += float(line.split(",")[15]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SquareConnect = require('square-connect'); | |
const crypto = require('crypto'); | |
const querystring = require('querystring'); | |
module.exports.checkout = (event, context, callback) => { | |
(SquareConnect.ApiClient.instance).authentications["oauth2"].accessToken = process.env.ACCESS_TOKEN; | |
const formData = querystring.parse(event.body); | |
const locationId = process.env.LOCATION_ID; | |
const checkoutRequest = { | |
idempotency_key: crypto.randomBytes(48).toString('base64'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: serverless-checkout # NOTE: update this with your service name | |
provider: | |
name: aws | |
runtime: nodejs8.10 | |
stage: prod | |
memorySize: 256 | |
package: | |
include: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const SquareConnect = require('square-connect'); | |
module.exports.checkout = (event, context, callback) => { | |
let response = "Success! Our function is running!"; | |
callback(null, response); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Square Swag Shop</title> | |
<meta name="description" content="A Simple eCommerce Store"> | |
<link id="favicon" rel="icon" href="/favicon.ico" type="image/x-icon"> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name='viewport' content='width=device-width, initial-scale=1'> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- start product --> | |
<div class='product'> | |
<div class='imageContainer'> | |
<img class='productImage' src="/0.jpeg" /> | |
<!-- insert product image url here --> | |
<div class='imageOverlay'> | |
<button>View Details</button> | |
</div> | |
</div> | |
<div class='modal clearfix'> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router.get("/callback", (req, res) => { | |
const tokenURL = "https://connect.squareup.com/oauth2/token"; | |
const redirectURI = "https://square-oauth-example.glitch.me/auth/callback"; | |
if (req.query.state === req.auth.state) { | |
axios | |
.post(tokenURL, { | |
client_id: CLIENT_ID, | |
client_secret: SECRET, | |
code: req.query.code, |
NewerOlder