@@ -24,43 +24,10 @@ export function initializeStripe() {
2424 stripe = Stripe ( window . stripeKey ) ;
2525}
2626
27- export function mountStripe ( ) {
28- // Create an instance of Elements.
29- const elements = stripe . elements ( { locale : "sv" } ) ;
30- // Custom styling can be passed to options when creating an Element.
31- const stripeStyle = {
32- base : {
33- color : "#32325d" ,
34- lineHeight : "18px" ,
35- fontFamily : '"Helvetica Neue", Helvetica, sans-serif' ,
36- fontSmoothing : "antialiased" ,
37- fontSize : "16px" ,
38- "::placeholder" : {
39- color : "#aab7c4" ,
40- } ,
41- } ,
42- invalid : {
43- color : "#fa755a" ,
44- iconColor : "#fa755a" ,
45- } ,
46- } ;
47-
48- // Create an instance of the card Element.
49- card = elements . create ( "card" , { style : stripeStyle } ) ;
50- card . mount ( "#card-element" ) ;
51-
52- payButton = document . getElementById ( "pay-button" ) as HTMLInputElement ;
53- spinner = document . querySelector ( ".progress-spinner" ) ;
54- errorElement = document . getElementById ( "card-errors" ) ;
55- return card ;
56- }
57-
5827interface InitializePaymentFunction {
5928 ( result : any ) : Promise < any > ;
6029}
61- interface ResponseFunction {
62- ( json : any ) : void ;
63- }
30+
6431export interface PaymentFlowDefinition {
6532 initiate_payment : InitializePaymentFunction ;
6633 before_initiate_payment ?: Function ;
@@ -85,10 +52,6 @@ export function disable_pay_button() {
8552 spinner . classList . add ( "progress-spinner-visible" ) ;
8653}
8754
88- function default_before_initiate_payment ( ) {
89- disable_pay_button ( ) ;
90- errorElement . textContent = "" ;
91- }
9255export function display_stripe_error ( error : any ) {
9356 errorElement . textContent = error . message ;
9457 UIkit . modal . alert ( "<h2>Your payment failed</h2>" + errorElement . innerHTML ) ;
0 commit comments