Skip to content

Commit

Permalink
feat: 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
mqzkim committed Dec 18, 2023
1 parent 476c8bb commit fd998d2
Show file tree
Hide file tree
Showing 7 changed files with 188 additions and 136 deletions.
3 changes: 2 additions & 1 deletion Examples/UIKit-Objc-Example/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ - (void)didReceivedCustomRequest:(PaymentMethodWidget * _Nonnull)widget paymentM

}

- (void)didUpdateHeight:(PaymentMethodWidget * _Nonnull)widget height:(CGFloat)height {
- (void)didUpdateMethodWidgetHeight:(PaymentMethodWidget * _Nonnull)widget height:(CGFloat)height {

}

Expand All @@ -118,6 +118,7 @@ - (void)didUpdateAgreementStatus:(AgreementWidget * _Nonnull)widget agreementSta

}


- (void)didUpdateAgreementWidgetHeight:(AgreementWidget * _Nonnull)agreementWidget height:(CGFloat)height {

}
Expand Down
80 changes: 40 additions & 40 deletions Examples/UIKit-Objc-Example/Widget/DefaultWidgetPaymentInfo.h
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@

//
// DefaultWidgetPaymentInfo.h
// UIKit-Objc-Example
////
//// DefaultWidgetPaymentInfo.h
//// UIKit-Objc-Example
////
//// Created by 김진규 on 2023/12/14.
//// Copyright © 2023 TossPayments, Inc. All rights reserved.
////
//
// Created by 김진규 on 2023/12/14.
// Copyright © 2023 TossPayments, Inc. All rights reserved.
//#import <UIKit/UIKit.h>
//#import <TossPayments/TossPayments-Swift.h>
//
//@interface DefaultWidgetPaymentInfo: NSObject <WidgetPaymentInfo>
//
//@property (nonatomic, readonly, nonnull) NSString *orderId;
//@property (nonatomic, readonly, nonnull) NSString *orderName;
//@property (nonatomic, readonly, nullable) NSString *taxExemptionAmount;
//@property (nonatomic, readonly, nullable) NSString *appScheme;
//@property (nonatomic, readonly, nullable) NSString *customerName;
//@property (nonatomic, readonly, nullable) NSString *customerEmail;
//@property (nonatomic, readonly, nullable) NSNumber *taxFreeAmount;
//@property (nonatomic, readonly) BOOL cultureExpense;
//@property (nonatomic, readonly, nullable) NSString *customerMobilePhone;
//@property (nonatomic, readonly, nullable) NSString *showCustomerMobilePhone;
//@property (nonatomic, readonly, nullable) NSNumber *useEscrow;
//@property (nonatomic, readonly, nullable) NSArray<NSString *> *escrowProducts;
//@property (nonatomic, readonly, nullable) NSString *mobileCarrier;
//
//- (instancetype _Nonnull)initWithOrderId:(nonnull NSString *)orderId
// orderName:(nonnull NSString *)orderName
// taxExemptionAmount:(nullable NSString *)taxExemptionAmount
// appScheme:(nullable NSString *)appScheme
// customerName:(nullable NSString *)customerName
// customerEmail:(nullable NSString *)customerEmail
// taxFreeAmount:(nullable NSNumber *)taxFreeAmount
// cultureExpense:(BOOL)cultureExpense
// customerMobilePhone:(nullable NSString *)customerMobilePhone
// showCustomerMobilePhone:(nullable NSString *)showCustomerMobilePhone
// useEscrow:(nullable NSNumber *)useEscrow
// escrowProducts:(nullable NSArray<NSString *> *)escrowProducts
// mobileCarrier:(nullable NSString *)mobileCarrier;
//@end
//

#import <UIKit/UIKit.h>
#import <TossPayments/TossPayments-Swift.h>

@interface DefaultWidgetPaymentInfo: NSObject <WidgetPaymentInfo>

@property (nonatomic, readonly, nonnull) NSString *orderId;
@property (nonatomic, readonly, nonnull) NSString *orderName;
@property (nonatomic, readonly, nullable) NSString *taxExemptionAmount;
@property (nonatomic, readonly, nullable) NSString *appScheme;
@property (nonatomic, readonly, nullable) NSString *customerName;
@property (nonatomic, readonly, nullable) NSString *customerEmail;
@property (nonatomic, readonly, nullable) NSNumber *taxFreeAmount;
@property (nonatomic, readonly) BOOL cultureExpense;
@property (nonatomic, readonly, nullable) NSString *customerMobilePhone;
@property (nonatomic, readonly, nullable) NSString *showCustomerMobilePhone;
@property (nonatomic, readonly, nullable) NSNumber *useEscrow;
@property (nonatomic, readonly, nullable) NSArray<NSString *> *escrowProducts;
@property (nonatomic, readonly, nullable) NSString *mobileCarrier;

- (instancetype _Nonnull)initWithOrderId:(nonnull NSString *)orderId
orderName:(nonnull NSString *)orderName
taxExemptionAmount:(nullable NSString *)taxExemptionAmount
appScheme:(nullable NSString *)appScheme
customerName:(nullable NSString *)customerName
customerEmail:(nullable NSString *)customerEmail
taxFreeAmount:(nullable NSNumber *)taxFreeAmount
cultureExpense:(BOOL)cultureExpense
customerMobilePhone:(nullable NSString *)customerMobilePhone
showCustomerMobilePhone:(nullable NSString *)showCustomerMobilePhone
useEscrow:(nullable NSNumber *)useEscrow
escrowProducts:(nullable NSArray<NSString *> *)escrowProducts
mobileCarrier:(nullable NSString *)mobileCarrier;
@end

94 changes: 47 additions & 47 deletions Examples/UIKit-Objc-Example/Widget/DefaultWidgetPaymentInfo.m
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
////
//// DefaultWidgetPaymentInfo.m
//// UIKit-Objc-Example
////
//// Created by 김진규 on 2023/12/15.
//// Copyright © 2023 TossPayments, Inc. All rights reserved.
////
//
// DefaultWidgetPaymentInfo.m
// UIKit-Objc-Example
//#import <Foundation/Foundation.h>
//#import "DefaultWidgetPaymentInfo.h"
//
// Created by 김진규 on 2023/12/15.
// Copyright © 2023 TossPayments, Inc. All rights reserved.
//@interface DefaultWidgetPaymentInfo ()
//

#import <Foundation/Foundation.h>
#import "DefaultWidgetPaymentInfo.h"

@interface DefaultWidgetPaymentInfo ()

@end

@implementation DefaultWidgetPaymentInfo

- (instancetype)initWithOrderId:(NSString *)orderId
orderName:(NSString *)orderName
taxExemptionAmount:(nullable NSString *)taxExemptionAmount
appScheme:(nullable NSString *)appScheme
customerName:(nullable NSString *)customerName
customerEmail:(nullable NSString *)customerEmail
taxFreeAmount:(nullable NSNumber *)taxFreeAmount
cultureExpense:(BOOL)cultureExpense
customerMobilePhone:(nullable NSString *)customerMobilePhone
showCustomerMobilePhone:(nullable NSString *)showCustomerMobilePhone
useEscrow:(nullable NSNumber *)useEscrow
escrowProducts:(nullable NSArray<NSString *> *)escrowProducts
mobileCarrier:(nullable NSString *)mobileCarrier {
self = [super init];
if (self) {
_orderId = orderId;
_orderName = orderName;
_taxExemptionAmount = taxExemptionAmount;
_appScheme = appScheme;
_customerName = customerName;
_customerEmail = customerEmail;
_taxFreeAmount = taxFreeAmount;
_cultureExpense = cultureExpense;
_customerMobilePhone = customerMobilePhone;
_showCustomerMobilePhone = showCustomerMobilePhone;
_useEscrow = useEscrow;
_escrowProducts = escrowProducts;
_mobileCarrier = mobileCarrier;
}
return self;
}

@end
//@end
//
//@implementation DefaultWidgetPaymentInfo
//
//- (instancetype)initWithOrderId:(NSString *)orderId
// orderName:(NSString *)orderName
// taxExemptionAmount:(nullable NSString *)taxExemptionAmount
// appScheme:(nullable NSString *)appScheme
// customerName:(nullable NSString *)customerName
// customerEmail:(nullable NSString *)customerEmail
// taxFreeAmount:(nullable NSNumber *)taxFreeAmount
// cultureExpense:(BOOL)cultureExpense
// customerMobilePhone:(nullable NSString *)customerMobilePhone
// showCustomerMobilePhone:(nullable NSString *)showCustomerMobilePhone
// useEscrow:(nullable NSNumber *)useEscrow
// escrowProducts:(nullable NSArray<NSString *> *)escrowProducts
// mobileCarrier:(nullable NSString *)mobileCarrier {
// self = [super init];
// if (self) {
// _orderId = orderId;
// _orderName = orderName;
// _taxExemptionAmount = taxExemptionAmount;
// _appScheme = appScheme;
// _customerName = customerName;
// _customerEmail = customerEmail;
// _taxFreeAmount = taxFreeAmount;
// _cultureExpense = cultureExpense;
// _customerMobilePhone = customerMobilePhone;
// _showCustomerMobilePhone = showCustomerMobilePhone;
// _useEscrow = useEscrow;
// _escrowProducts = escrowProducts;
// _mobileCarrier = mobileCarrier;
// }
// return self;
//}
//
//@end
2 changes: 1 addition & 1 deletion Examples/UIKit-Objc-Example/Widget/WidgetViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ - (void)didUpdateAgreementStatus:(AgreementWidget * _Nonnull)widget agreementSta

}

- (void)didUpdateAgreementWidgetWidgetHeight:(AgreementWidget * _Nonnull)widget height:(CGFloat)height {
- (void)didUpdateAgreementWidgetHeight:(AgreementWidget * _Nonnull)widget height:(CGFloat)height {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,44 @@

import Foundation

@objc
@objcMembers
public class DefaultWidgetPaymentInfo: NSObject, WidgetPaymentInfo {

// 필수
public let orderId: String
public let orderName: String
public let taxExemptionAmount: String?
public let appScheme: String?

// 선택
//
// // 선택
public let customerName: String?
public let customerEmail: String?
public let taxFreeAmount: NSNumber?
public let cultureExpense: Bool

// 추가 선택
//
// // 추가 선택
public let customerMobilePhone: String?
public let showCustomerMobilePhone: String?
public let useEscrow: Bool?

@nonobjc
public private(set) var useEscrow: Bool?

@objc(useEscrow)
public private(set) var internalUseEscrow: NSNumber? {
get {
guard let useEscrow else { return nil }
return useEscrow ? 1 : 0
}
set {
guard let newValue else { return }
useEscrow = newValue == 1
}
}

public let escrowProducts: [String]?
public let mobileCarrier: String?

@nonobjc
public init(
orderId: String,
orderName: String,
Expand All @@ -40,7 +56,7 @@ public class DefaultWidgetPaymentInfo: NSObject, WidgetPaymentInfo {
cultureExpense: Bool = false,
customerMobilePhone: String? = nil,
showCustomerMobilePhone: String? = nil,
useEscrow: Bool? = nil,
useEscrow: Bool?,
escrowProducts: [String]? = nil,
mobileCarrier: String? = nil
) {
Expand All @@ -59,6 +75,36 @@ public class DefaultWidgetPaymentInfo: NSObject, WidgetPaymentInfo {
self.mobileCarrier = mobileCarrier
}

public init(
orderId: String,
orderName: String,
taxExemptionAmount: String? = nil,
appScheme: String? = nil,
customerName: String? = nil,
customerEmail: String? = nil,
taxFreeAmount: NSNumber? = nil,
cultureExpense: Bool = false,
customerMobilePhone: String? = nil,
showCustomerMobilePhone: String? = nil,
useEscrow: NSNumber? = nil,
escrowProducts: [String]? = nil,
mobileCarrier: String? = nil
) {
self.orderId = orderId
self.orderName = orderName
self.taxExemptionAmount = taxExemptionAmount
self.appScheme = appScheme
self.customerName = customerName
self.customerEmail = customerEmail
self.taxFreeAmount = taxFreeAmount
self.cultureExpense = cultureExpense
self.customerMobilePhone = customerMobilePhone
self.showCustomerMobilePhone = showCustomerMobilePhone
self.useEscrow = nil
self.escrowProducts = escrowProducts
self.mobileCarrier = mobileCarrier
}

public func convertToPaymentInfo(amount: Double) -> [String: Any]? {
var info = [String: Any]()

Expand All @@ -76,6 +122,9 @@ public class DefaultWidgetPaymentInfo: NSObject, WidgetPaymentInfo {
info["escrowProducts"] = escrowProducts
info["mobileCarrier"] = mobileCarrier


info["amount"] = amount

return info
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public extension TossPaymentsWidgetUIDelegate {
@objc
public protocol TossPaymentsAgreementUIDelegate: AnyObject {

@objc(didUpdateAgreementWidgetWidgetHeight:height:)
@objc(didUpdateAgreementWidgetHeight:height:)
func didUpdateHeight(_ widget: AgreementWidget, height: CGFloat)
func didUpdateAgreementStatus(_ widget: AgreementWidget, agreementStatus: AgreementStatus)
}
Expand Down
Loading

0 comments on commit fd998d2

Please sign in to comment.