Skip to content

Commit

Permalink
Merge pull request #57 from TEAMMatchDev/feat/#47
Browse files Browse the repository at this point in the history
Feat/#47
  • Loading branch information
sujinyang00 committed Nov 6, 2023
2 parents 509728d + 427a9c1 commit e546add
Show file tree
Hide file tree
Showing 15 changed files with 506 additions and 75 deletions.
44 changes: 44 additions & 0 deletions asset/image/icon/payment/ic_kakaopay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions asset/image/icon/payment/ic_kakaopay_radio.svg

This file was deleted.

16 changes: 16 additions & 0 deletions lib/model/card_info/card_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'card_info.freezed.dart';
part 'card_info.g.dart';

@freezed
class CardInfo with _$CardInfo {
const factory CardInfo({
required int id,
required String cardCode,
required String? cardName,
required String cardNo,
required String cardAbleStatus,
}) = _CardInfo;
factory CardInfo.fromJson(Map<String, dynamic> json) => _$CardInfoFromJson(json);
}
238 changes: 238 additions & 0 deletions lib/model/card_info/card_info.freezed.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark

part of 'card_info.dart';

// **************************************************************************
// FreezedGenerator
// **************************************************************************

T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');

CardInfo _$CardInfoFromJson(Map<String, dynamic> json) {
return _CardInfo.fromJson(json);
}

/// @nodoc
mixin _$CardInfo {
int get id => throw _privateConstructorUsedError;
String get cardCode => throw _privateConstructorUsedError;
String? get cardName => throw _privateConstructorUsedError;
String get cardNo => throw _privateConstructorUsedError;
String get cardAbleStatus => throw _privateConstructorUsedError;

Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)
$CardInfoCopyWith<CardInfo> get copyWith =>
throw _privateConstructorUsedError;
}

/// @nodoc
abstract class $CardInfoCopyWith<$Res> {
factory $CardInfoCopyWith(CardInfo value, $Res Function(CardInfo) then) =
_$CardInfoCopyWithImpl<$Res, CardInfo>;
@useResult
$Res call(
{int id,
String cardCode,
String? cardName,
String cardNo,
String cardAbleStatus});
}

/// @nodoc
class _$CardInfoCopyWithImpl<$Res, $Val extends CardInfo>
implements $CardInfoCopyWith<$Res> {
_$CardInfoCopyWithImpl(this._value, this._then);

// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;

@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? cardCode = null,
Object? cardName = freezed,
Object? cardNo = null,
Object? cardAbleStatus = null,
}) {
return _then(_value.copyWith(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
cardCode: null == cardCode
? _value.cardCode
: cardCode // ignore: cast_nullable_to_non_nullable
as String,
cardName: freezed == cardName
? _value.cardName
: cardName // ignore: cast_nullable_to_non_nullable
as String?,
cardNo: null == cardNo
? _value.cardNo
: cardNo // ignore: cast_nullable_to_non_nullable
as String,
cardAbleStatus: null == cardAbleStatus
? _value.cardAbleStatus
: cardAbleStatus // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}

/// @nodoc
abstract class _$$CardInfoImplCopyWith<$Res>
implements $CardInfoCopyWith<$Res> {
factory _$$CardInfoImplCopyWith(
_$CardInfoImpl value, $Res Function(_$CardInfoImpl) then) =
__$$CardInfoImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
{int id,
String cardCode,
String? cardName,
String cardNo,
String cardAbleStatus});
}

/// @nodoc
class __$$CardInfoImplCopyWithImpl<$Res>
extends _$CardInfoCopyWithImpl<$Res, _$CardInfoImpl>
implements _$$CardInfoImplCopyWith<$Res> {
__$$CardInfoImplCopyWithImpl(
_$CardInfoImpl _value, $Res Function(_$CardInfoImpl) _then)
: super(_value, _then);

@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
Object? cardCode = null,
Object? cardName = freezed,
Object? cardNo = null,
Object? cardAbleStatus = null,
}) {
return _then(_$CardInfoImpl(
id: null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as int,
cardCode: null == cardCode
? _value.cardCode
: cardCode // ignore: cast_nullable_to_non_nullable
as String,
cardName: freezed == cardName
? _value.cardName
: cardName // ignore: cast_nullable_to_non_nullable
as String?,
cardNo: null == cardNo
? _value.cardNo
: cardNo // ignore: cast_nullable_to_non_nullable
as String,
cardAbleStatus: null == cardAbleStatus
? _value.cardAbleStatus
: cardAbleStatus // ignore: cast_nullable_to_non_nullable
as String,
));
}
}

/// @nodoc
@JsonSerializable()
class _$CardInfoImpl implements _CardInfo {
const _$CardInfoImpl(
{required this.id,
required this.cardCode,
required this.cardName,
required this.cardNo,
required this.cardAbleStatus});

factory _$CardInfoImpl.fromJson(Map<String, dynamic> json) =>
_$$CardInfoImplFromJson(json);

@override
final int id;
@override
final String cardCode;
@override
final String? cardName;
@override
final String cardNo;
@override
final String cardAbleStatus;

@override
String toString() {
return 'CardInfo(id: $id, cardCode: $cardCode, cardName: $cardName, cardNo: $cardNo, cardAbleStatus: $cardAbleStatus)';
}

@override
bool operator ==(dynamic other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$CardInfoImpl &&
(identical(other.id, id) || other.id == id) &&
(identical(other.cardCode, cardCode) ||
other.cardCode == cardCode) &&
(identical(other.cardName, cardName) ||
other.cardName == cardName) &&
(identical(other.cardNo, cardNo) || other.cardNo == cardNo) &&
(identical(other.cardAbleStatus, cardAbleStatus) ||
other.cardAbleStatus == cardAbleStatus));
}

@JsonKey(ignore: true)
@override
int get hashCode =>
Object.hash(runtimeType, id, cardCode, cardName, cardNo, cardAbleStatus);

@JsonKey(ignore: true)
@override
@pragma('vm:prefer-inline')
_$$CardInfoImplCopyWith<_$CardInfoImpl> get copyWith =>
__$$CardInfoImplCopyWithImpl<_$CardInfoImpl>(this, _$identity);

@override
Map<String, dynamic> toJson() {
return _$$CardInfoImplToJson(
this,
);
}
}

abstract class _CardInfo implements CardInfo {
const factory _CardInfo(
{required final int id,
required final String cardCode,
required final String? cardName,
required final String cardNo,
required final String cardAbleStatus}) = _$CardInfoImpl;

factory _CardInfo.fromJson(Map<String, dynamic> json) =
_$CardInfoImpl.fromJson;

@override
int get id;
@override
String get cardCode;
@override
String? get cardName;
@override
String get cardNo;
@override
String get cardAbleStatus;
@override
@JsonKey(ignore: true)
_$$CardInfoImplCopyWith<_$CardInfoImpl> get copyWith =>
throw _privateConstructorUsedError;
}
25 changes: 25 additions & 0 deletions lib/model/card_info/card_info.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions lib/modules/payment/controller/payment_controller.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:match/model/card_info/card_info.dart';
import 'package:match/model/match_history/match_history.dart';
import 'package:match/modules/project/controller/project_controller.dart';
import 'package:match/provider/api/order_api.dart';
Expand All @@ -23,6 +24,11 @@ class PaymentController extends GetxController {
//TODO) 후원자 정보
Rx<Donator> donator = tmpDonator.obs;
//TODO) 카드 정보
RxList<CardInfo> cardInfoList = <CardInfo>[].obs;
RxList<String> cardCodeList = [tmpCardInfo.cardCode].obs;
RxList<String> cardNumList = [tmpCardInfo.cardNo].obs;
RxList<int> cardIdList = [tmpCardInfo.id].obs;

//TODO) 기부금 정보
final RxBool isPayAble = false.obs; //금액, 날짜 선택 모두 했는지
Expand All @@ -38,6 +44,7 @@ class PaymentController extends GetxController {
}
}


//TODO) 결제 정보
/// 동의항목
var selectedItems = <String>[].obs;
Expand All @@ -46,7 +53,10 @@ class PaymentController extends GetxController {
void selectCard(int index) {
selectedCardIndex.value = index;
}
/// 결제할 카드 & 프로젝트 정보
RxInt cardId = 1.obs;

//TODO) 카드 신규 등록
/// 카드 번호
Rx<TextEditingController> cardNumTextController = TextEditingController().obs;
/// 유효기간
Expand All @@ -62,6 +72,11 @@ class PaymentController extends GetxController {
void onInit() async {
super.onInit();
payList.assignAll(await PaymentApi.getPaymentDetail(regularPayId: id));
cardInfoList.assignAll(await OrderApi.getCardList());
cardCodeList.assignAll(cardInfoList.map((card) => card.cardCode.toString()).toList());
cardNumList.assignAll(cardInfoList.map((card) => card.cardNo).toList());
cardIdList.assignAll(cardInfoList.map((card) => card.id).toList());

donateState.value = _projectController.projectDetail.value.regularStatus;
}
}
Loading

0 comments on commit e546add

Please sign in to comment.