woocommerce-paypal-payments/modules/ppcp-axo/resources/js/Connection/Fastlane.js

43 lines
974 B
JavaScript
Raw Normal View History

2024-02-09 17:49:45 +00:00
class Fastlane {
2024-07-12 12:58:34 +02:00
construct() {
this.connection = null;
this.identity = null;
this.profile = null;
this.FastlaneCardComponent = null;
this.FastlanePaymentComponent = null;
this.FastlaneWatermarkComponent = null;
}
2024-02-09 17:49:45 +00:00
2024-07-12 12:58:34 +02:00
connect( config ) {
return new Promise( ( resolve, reject ) => {
window.paypal
.Fastlane( config )
.then( ( result ) => {
this.init( result );
resolve();
} )
.catch( ( error ) => {
console.error( error );
reject();
} );
} );
}
2024-02-09 17:49:45 +00:00
2024-07-12 12:58:34 +02:00
init( connection ) {
this.connection = connection;
this.identity = this.connection.identity;
this.profile = this.connection.profile;
this.FastlaneCardComponent = this.connection.FastlaneCardComponent;
this.FastlanePaymentComponent =
this.connection.FastlanePaymentComponent;
this.FastlaneWatermarkComponent =
this.connection.FastlaneWatermarkComponent;
}
2024-02-09 17:49:45 +00:00
2024-07-12 12:58:34 +02:00
setLocale( locale ) {
this.connection.setLocale( locale );
}
2024-02-09 17:49:45 +00:00
}
export default Fastlane;