feat(payment): 优化套餐配置和支付服务
- 简化套餐配置结构,删除冗余的 default.yaml 和 us.yaml - 优化 Apple IAP 服务和验证逻辑 - 更新套餐数据模型和协议文档 - 添加支付相关测试用例
This commit is contained in:
@@ -5,16 +5,16 @@ void main() {
|
||||
group('VerifyTransactionRequest', () {
|
||||
test('toJson includes all required fields', () {
|
||||
const request = VerifyTransactionRequest(
|
||||
productCode: 'basic_pack',
|
||||
appStoreProductId: 'com.meeyao.qianwen.basic_pack',
|
||||
productCode: 'starter_pack',
|
||||
appStoreProductId: 'com.meeyao.qianwen.starter_pack',
|
||||
transactionId: '1000000123456789',
|
||||
signedTransactionInfo: 'eyJhbGciOiJFUzI1NiIs...',
|
||||
);
|
||||
|
||||
final json = request.toJson();
|
||||
|
||||
expect(json['productCode'], 'basic_pack');
|
||||
expect(json['appStoreProductId'], 'com.meeyao.qianwen.basic_pack');
|
||||
expect(json['productCode'], 'starter_pack');
|
||||
expect(json['appStoreProductId'], 'com.meeyao.qianwen.starter_pack');
|
||||
expect(json['transactionId'], '1000000123456789');
|
||||
expect(json['signedTransactionInfo'], 'eyJhbGciOiJFUzI1NiIs...');
|
||||
expect(json.containsKey('appAccountToken'), false);
|
||||
@@ -22,8 +22,8 @@ void main() {
|
||||
|
||||
test('toJson includes appAccountToken when provided', () {
|
||||
const request = VerifyTransactionRequest(
|
||||
productCode: 'basic_pack',
|
||||
appStoreProductId: 'com.meeyao.qianwen.basic_pack',
|
||||
productCode: 'starter_pack',
|
||||
appStoreProductId: 'com.meeyao.qianwen.starter_pack',
|
||||
transactionId: '1000000123456789',
|
||||
signedTransactionInfo: 'eyJhbGciOiJFUzI1NiIs...',
|
||||
appAccountToken: 'abc123def456',
|
||||
@@ -39,7 +39,7 @@ void main() {
|
||||
test('parses granted status correctly', () {
|
||||
final json = {
|
||||
'status': 'granted',
|
||||
'productCode': 'basic_pack',
|
||||
'productCode': 'starter_pack',
|
||||
'transactionId': '1000000123456789',
|
||||
'creditsAdded': 100,
|
||||
'newBalance': 180,
|
||||
@@ -49,7 +49,7 @@ void main() {
|
||||
final response = VerifyTransactionResponse.fromJson(json);
|
||||
|
||||
expect(response.status, VerifyTransactionStatus.granted);
|
||||
expect(response.productCode, 'basic_pack');
|
||||
expect(response.productCode, 'starter_pack');
|
||||
expect(response.transactionId, '1000000123456789');
|
||||
expect(response.creditsAdded, 100);
|
||||
expect(response.newBalance, 180);
|
||||
@@ -59,7 +59,7 @@ void main() {
|
||||
test('parses already_granted status correctly', () {
|
||||
final json = {
|
||||
'status': 'already_granted',
|
||||
'productCode': 'basic_pack',
|
||||
'productCode': 'starter_pack',
|
||||
'transactionId': '1000000123456789',
|
||||
'creditsAdded': 0,
|
||||
'newBalance': 180,
|
||||
|
||||
Reference in New Issue
Block a user