feat: Phase 1 — remove Stripe, switch to e-Transfer
- Drop stripe_payment + stripe_sdk deps; delete stripe pay pages/widgets - New ETransferPay widget: shows payment@wisetronic.com + R#<orderId> remark - goPayment stripe/native branches now route to e-Transfer - pay_now widgets: strip saved-cards section & dead nativePay logic - my_cards pages rewritten as e-Transfer info (route kept) - models/utils/constants cleaned of stripe; env constraint -> Dart 3 See UPGRADE_NOTES.md. (Null-safety migration is Phase 3; deps upgrade Phase 2.)
This commit is contained in:
@@ -11,7 +11,6 @@ import '../../events/events.dart';
|
||||
import '../../generated/l10n.dart';
|
||||
import '../../models/order.dart';
|
||||
import '../../models/payment_platform.dart';
|
||||
import '../../models/stripe_payment_method.dart';
|
||||
import '../../models/user.dart';
|
||||
import '../../routes.dart';
|
||||
import '../../store/actions.dart';
|
||||
@@ -19,7 +18,6 @@ import '../../store/store.dart';
|
||||
import '../../utils/http_util.dart';
|
||||
import '../../utils/util_web.dart' if (dart.library.io) '../../utils/util_io.dart';
|
||||
import '../../utils/utils.dart';
|
||||
import '../../widgets/general/payment_verification_code_dialog.dart';
|
||||
|
||||
class DesktopPayNow extends StatefulWidget {
|
||||
final Key key;
|
||||
@@ -38,8 +36,6 @@ class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
List<PaymentPlatform> paymentPlatforms;
|
||||
User _user;
|
||||
|
||||
bool nativePay;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
|
||||
@@ -69,7 +65,7 @@ class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
BuildContext mainContext = context;
|
||||
|
||||
ListView listView = ListView.builder(
|
||||
itemCount: nativePay ? paymentPlatforms.length + 3 : paymentPlatforms.length + 2,
|
||||
itemCount: paymentPlatforms.length + 1,
|
||||
itemBuilder: (BuildContext context, int position) {
|
||||
if (position == 0) {
|
||||
return Column(
|
||||
@@ -169,135 +165,7 @@ class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
);
|
||||
}
|
||||
PaymentPlatform paymentPlatform;
|
||||
if (position == 1) {
|
||||
if (_user.stripePaymentMethods.length > 0) {
|
||||
paymentPlatform = paymentPlatforms[position - 1];
|
||||
Column column = Column(
|
||||
children: <Widget>[],
|
||||
);
|
||||
column.children.add(
|
||||
Container(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
width: double.infinity,
|
||||
child: Text(
|
||||
S.of(context).pay_with_existing_cards,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 1,
|
||||
color: Colors.black26,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
for (StripePaymentMethod stripePaymentMethod in _user.stripePaymentMethods) {
|
||||
column.children.add(
|
||||
GestureDetector(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 16.0, left: 16.0, right: 16.0, bottom: 16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
stripePaymentMethod.cardBrand == 'visa' ?
|
||||
Image.asset(
|
||||
'assets/images/visa.png',
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
fit: BoxFit.fill,
|
||||
) : (stripePaymentMethod.cardBrand == 'mastercard' ?
|
||||
Image.asset(
|
||||
'assets/images/master.png',
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
fit: BoxFit.fill,
|
||||
) : Icon(
|
||||
Icons.credit_card, size: 50.0, color: Colors.black38,)),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.0, right: 10.0),
|
||||
child: Text(
|
||||
'**** ${stripePaymentMethod.cardLast4}',
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.0, right: 10.0),
|
||||
child: Text(
|
||||
S.of(context).expire_token(stripePaymentMethod.cardExpMonth, stripePaymentMethod.cardExpYear),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0,
|
||||
color: Colors.black26,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: Colors.black26,
|
||||
),
|
||||
],
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5,
|
||||
color: Colors.black12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: mainContext,
|
||||
builder: (BuildContext context) {
|
||||
return PaymentVerificationCodeDialog(_user, () {
|
||||
Util.goPayment(context, order, paymentPlatform,
|
||||
stripePaymentMethod: stripePaymentMethod);
|
||||
}, () {
|
||||
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
column.children.add(
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: SizedBox.shrink(),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 10,
|
||||
color: Colors.black26,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
return column;
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
if (position == 2 && nativePay) {
|
||||
paymentPlatform = paymentPlatforms[position - 2];
|
||||
return Util().getNativePay(mainContext, order, paymentPlatform);
|
||||
}
|
||||
paymentPlatform = nativePay ? paymentPlatforms[position - 3] : paymentPlatforms[position - 2];
|
||||
paymentPlatform = paymentPlatforms[position - 1];
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 16.0, left: 16.0, right: 16.0, bottom: 16.0),
|
||||
@@ -371,14 +239,6 @@ class DesktopPayNowState extends State<DesktopPayNow> {
|
||||
).then((data) {
|
||||
paymentPlatforms = (data['payment_platforms'] as List).map((e) =>
|
||||
PaymentPlatform.fromJson(e)).toList();
|
||||
PaymentPlatform pp = paymentPlatforms[0];
|
||||
if (Constants.ENABLE_NATIVE_PAY && pp.publishableKey != null
|
||||
&& pp.publishableKey.isNotEmpty && pp.merchantId != null
|
||||
&& pp.merchantId.isNotEmpty) {
|
||||
nativePay = true;
|
||||
} else {
|
||||
nativePay = false;
|
||||
}
|
||||
_user = User.fromJson(data['contact']);
|
||||
store.dispatch(UpdateCurrentUser(_user));
|
||||
eventBus.fire(OnCurrentUserUpdated());
|
||||
|
||||
Reference in New Issue
Block a user