backup. before shop update
This commit is contained in:
85
lib/models/payment_platform.dart
Normal file
85
lib/models/payment_platform.dart
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import '../generated/l10n.dart';
|
||||
|
||||
class PaymentPlatform {
|
||||
int id;
|
||||
String name;
|
||||
String code;
|
||||
String method;
|
||||
String icon;
|
||||
String xLogin;
|
||||
String transactionKey;
|
||||
String responseKey;
|
||||
String squareAppId;
|
||||
String squareAccessToken;
|
||||
String squareLocationId;
|
||||
String publishableKey;
|
||||
String merchantId;
|
||||
|
||||
PaymentPlatform(this.code);
|
||||
|
||||
PaymentPlatform.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
name = json['name'],
|
||||
code = json['code'],
|
||||
method = json['method'],
|
||||
icon = json['icon'],
|
||||
xLogin = json['x_login'],
|
||||
transactionKey = json['transaction_key'],
|
||||
responseKey = json['response_key'],
|
||||
squareAppId = json['square_app_id'],
|
||||
squareAccessToken = json['square_access_token'],
|
||||
squareLocationId = json['square_location_id'],
|
||||
publishableKey = json['publishable_key'],
|
||||
merchantId = json['merchant_id'];
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'name': name,
|
||||
'code': code,
|
||||
'method': method,
|
||||
'icon': icon,
|
||||
'x_login': xLogin,
|
||||
'transaction_key': transactionKey,
|
||||
'response_key': responseKey,
|
||||
'square_app_id': squareAppId,
|
||||
'square_access_token': squareAccessToken,
|
||||
'square_location_id': squareLocationId,
|
||||
'publishable_key': publishableKey,
|
||||
'merchant_id': merchantId,
|
||||
};
|
||||
|
||||
static String getPaymentPlatformName(BuildContext context, String code) {
|
||||
switch(code) {
|
||||
case 'chase':
|
||||
return S.of(context).credit_debit_card;
|
||||
break;
|
||||
case 'web-credit-card':
|
||||
return S.of(context).credit_card;
|
||||
break;
|
||||
case 'ALIPAY':
|
||||
return S.of(context).alipay;
|
||||
break;
|
||||
case 'WECHATPAY':
|
||||
return S.of(context).wechatpay;
|
||||
break;
|
||||
case 'paypal':
|
||||
return S.of(context).paypal;
|
||||
case 'payondeliverypickup':
|
||||
return S.of(context).pay_on_deliery_pickup;
|
||||
case 'stripe':
|
||||
return S.of(context).credit_card;
|
||||
default:
|
||||
return S.of(context).pay_on_deliery;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return json.encode(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user