new payment system

master
Matthew Butterick 7 years ago
parent c8d41cad9e
commit 6fafef09b0

@ -0,0 +1,9 @@
#lang pollen
(define-meta title "Regrettably your payment failed")
(section-from-metas metas)
(define-meta toolbar-blank "true")
 
Click the back button to try again, or a[#:href "mailto:mb@beautifulracket.com"]{email me} if you think something is amiss.
link["/index.html"]{Return to the Typography for Lawyers home page.}

@ -0,0 +1,10 @@
#lang pollen
(define-meta title "Thank you for your order")
(section-from-metas metas)
(define-meta toolbar-blank "true")
 
A confirmation will be sent to the email address you used for payment.
link["/index.html"]{Return to the Typography for Lawyers home page.}

@ -41,9 +41,6 @@
(define (get-variant-id sku which)
(dict-ref (sku-variant-ids sku) which))
(define (make-buy-url sku which)
(format "http://typo.la/bc.html?item=~a" (get-variant-id sku which)))
(define (grid->table grid)
(define (table-row row [cell-tag 'td])
@ -52,8 +49,8 @@
(table-row row 'th))
`(table ((class "buy-table"))
,(table-header (car grid))
,@(map table-row (cdr grid))))
,(table-header (car grid))
,@(map table-row (cdr grid))))
(define (people->string p)
(define p-string (format "~a"
@ -62,11 +59,39 @@
p)))
(string-append p-string " " (if (= p 1) "person" "people")))
(require txexpr racket/string)
(define (textify x)
(cond
;; convert nbsp to string
[(string? x) (string-replace x #px"[\\s#\u00A0]+" " ")]
[(eq? 'nbsp x) " "]
[(list? x) (string-append* (map textify (if (txexpr? x)
(get-elements x)
x)))]))
(module+ test
(require rackunit)
(check-equal?
(textify
'(span (a ((href "equity.html")) "Equity") " + " (a ((href "concourse.html")) "Concourse Standard") " + " (a ((href "triplicate.html")) "Triplicate")))
"Equity + Concourse Standard + Triplicate"))
(define (buy-link sku people)
(define price (get-price sku people))
(define item (textify (sku-name sku)))
`(a ((class "checkout_clicker")
(href "#")
(item ,item)
(label ,(format "~a (~a-person license)" item people))
(quantity ,(number->string people))
(amount ,(number->string price)))
,(format "$~a" price)))
(define (make-buy-grid #:people people-list #:skus sku-list)
(cons
(cons "" (map people->string people-list))
(map (λ(sku) (cons (sku-name sku)
(map (λ(p) `(a ((href ,(make-buy-url sku p))) ,(format "$~a" (get-price sku p)))) people-list))) sku-list)))
(map (λ(p) (buy-link sku p)) people-list))) sku-list)))
(define (make-buy-table #:people people-list #:skus sku-list)

@ -81,7 +81,10 @@ document.write('<link rel="stylesheet" type="text/css" media="all" href="/firefo
</script>
(when/block (hash-ref metas 'tfl-font-template #f)
string-append{
<script src="https://checkout.stripe.com/checkout.js"></script>
<script src="https://mbtype.com/core/checkout.js"></script>})
</head>