feat: integrate payment system (EasyPay, Alipay, WxPay, Stripe)

Replace iframe-based external payment with native implementation:

Backend (Go):
- 5 new Ent schemas: PaymentOrder, PaymentAuditLog, PaymentChannel,
  SubscriptionPlan, PaymentProviderInstance
- 5 SQL migrations (090-094)
- Payment provider interface + registry + load balancer
- 4 provider implementations (EasyPay, Alipay, WxPay, Stripe)
- PaymentService (order lifecycle, fulfillment, refund 3-phase)
- PaymentConfigService (settings, instance/channel/plan CRUD)
- 31 API endpoints (9 user + 4 webhook + 18 admin)
- Wire DI integration

Frontend (Vue3):
- Payment types, API modules, store, router changes
- Sidebar: payment_enabled controls visibility, new menu items
- User pages: PaymentView (replace iframe), QR payment, Stripe,
  result page, order list
- Admin pages: Order management (4 tabs), provider instance mgmt
- Settings: new payment tab, removed old purchase iframe config
- i18n: full payment namespace (en + zh)

Docs:
- PAYMENT_FRONTEND_MIGRATION_PLAN.md
- PAYMENT_BACKEND_MIGRATION_PLAN.md
- PAYMENT_IMPLEMENTATION_ROADMAP.md
This commit is contained in:
erio committed 2026-04-05 15:06:05 +08:00
1 parent dbb248df52
commit 64c4495ae5
120 files changed
+39083 -149

No files matched your search

@@ -0,0 +1,103 @@
<template>
<div class="space-y-4">
<!-- Quick Amount Buttons -->
<div>
<label class="mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ t('payment.quickAmounts') }}
</label>
<div class="grid grid-cols-4 gap-2">
<button
v-for="amt in filteredAmounts"
:key="amt"
type="button"
:class="[
'rounded-lg border-2 px-4 py-3 text-center font-medium transition-colors',
modelValue === amt
? 'border-primary-500 bg-primary-50 text-primary-700 dark:border-primary-400 dark:bg-primary-900/40 dark:text-primary-300'
: 'border-gray-200 bg-white text-gray-700 hover:border-gray-300 dark:border-dark-600 dark:bg-dark-800 dark:text-gray-200 dark:hover:border-dark-500',
]"
@click="selectAmount(amt)"
>
{{ amt }}
</button>
</div>
</div>
<!-- Custom Amount Input -->
<div>
<label class="mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300">
{{ t('payment.customAmount') }}
</label>
<div class="relative">
<span class="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 dark:text-dark-500">
&yen;
</span>
<input
type="text"
inputmode="decimal"
:value="customText"
:placeholder="`${min} - ${max}`"
class="input w-full py-3 pl-8 pr-4"
@input="handleInput"
/>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { useI18n } from 'vue-i18n'
const props = withDefaults(defineProps<{
amounts?: number[]
modelValue: number | null
min?: number
max?: number
}>(), {
amounts: () => [10, 50, 100, 200, 500, 1000],
min: 1,
max: 10000,
})
const emit = defineEmits<{
'update:modelValue': [value: number | null]
}>()
const { t } = useI18n()
const customText = ref('')
const filteredAmounts = computed(() =>
props.amounts.filter((a) => a >= props.min && a <= props.max)
)
const AMOUNT_PATTERN = /^\d*(\.\d{0,2})?$/
function selectAmount(amt: number) {
customText.value = String(amt)
emit('update:modelValue', amt)
}
function handleInput(e: Event) {
const val = (e.target as HTMLInputElement).value
if (!AMOUNT_PATTERN.test(val)) return
customText.value = val
if (val === '') {
emit('update:modelValue', null)
return
}
const num = parseFloat(val)
if (!isNaN(num) && num > 0) {
emit('update:modelValue', num)
} else {
emit('update:modelValue', null)
}
}
watch(() => props.modelValue, (v) => {
if (v !== null && String(v) !== customText.value) {
customText.value = String(v)
}
}, { immediate: true })
</script>