@filanodev/paygate-vue
Version:
PayGateGlobal Vue.js plugin with composables - Support FLOOZ and T-Money
26 lines (22 loc) • 723 B
text/typescript
import type { App } from 'vue'
import { PayGateClient } from '@filanodev/paygate-core'
import type { PayGatePluginOptions } from './types'
import { PAYGATE_CLIENT_KEY } from './composables'
export function createPayGate(options: PayGatePluginOptions) {
const client = new PayGateClient(options)
return {
install(app: App) {
app.provide(PAYGATE_CLIENT_KEY, client)
// Ajouter le client aux propriétés globales pour l'Options API
app.config.globalProperties.$paygate = client
},
client
}
}
// Plugin par défaut pour installation directe
export default {
install(app: App, options: PayGatePluginOptions) {
const { install } = createPayGate(options)
install(app)
}
}