/ src / stripe.lisp
stripe.lisp
 1  (in-package :ami)
 2  ;; This package contains the stripe interface to interact with the stripe API
 3  
 4  (defclass payment-provider () ())
 5  
 6  (defmethod customer-create ((pp payment-provider) internal-id email name)
 7    (error "To implement"))
 8  
 9  (defmethod customer-update ((pp payment-provider) id new-data)
10    (error "To implement"))
11  
12  (defclass stripe (payment-provider)
13    ((api-key :type string :initarg :api-key :accessor stripe-api-key)))
14  
15  (defun stripe-call ()
16    "Make a request to the stripe API")
17  
18  (defmethod stripe-call ((pp stripe) method path &key (retries 5) &allow-other-keys)
19    (let ((uri (format nil "https://api.stripe.com~a" path)))
20      (dex:request uri :method method :basic-auth (cons (stripe-api-key pp)))))
21  
22  (defmethod customer-create ((pp payment-provider) internal-id email name)
23    (stripe-call