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

42 lines
1.1 KiB
JavaScript
Raw Normal View History

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