Skip to content

Commit

Permalink
refactor: remove currency references (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeul authored Nov 22, 2023
1 parent 86320e9 commit 751c903
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 167 deletions.
7 changes: 0 additions & 7 deletions Sources/PayPalMessages/Config/PayPalMessageModalConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class PayPalMessageModalDataConfig: NSObject {
var partnerAttributionID: String?
var environment: Environment
var amount: Double?
var currency: String?
var buyerCountry: String?
var offerType: PayPalMessageOfferType?
var placement: PayPalMessagePlacement?
Expand All @@ -51,14 +50,12 @@ class PayPalMessageModalDataConfig: NSObject {
clientID: String,
environment: Environment,
amount: Double? = nil,
currency: String? = nil,
placement: PayPalMessagePlacement? = nil,
offerType: PayPalMessageOfferType? = nil,
modalCloseButton: ModalCloseButtonConfig = ModalCloseButtonConfig()
) {
self.clientID = clientID
self.amount = amount
self.currency = currency
self.placement = placement
self.offerType = offerType
self.modalCloseButton = modalCloseButton
Expand All @@ -72,7 +69,6 @@ class PayPalMessageModalDataConfig: NSObject {
environment: Environment,
partnerAttributionID: String,
amount: Double? = nil,
currency: String? = nil,
placement: PayPalMessagePlacement? = nil,
offerType: PayPalMessageOfferType? = nil,
modalCloseButton: ModalCloseButtonConfig = ModalCloseButtonConfig()
Expand All @@ -81,7 +77,6 @@ class PayPalMessageModalDataConfig: NSObject {
self.merchantID = merchantID
self.partnerAttributionID = partnerAttributionID
self.amount = amount
self.currency = currency
self.placement = placement
self.offerType = offerType
self.modalCloseButton = modalCloseButton
Expand Down Expand Up @@ -122,7 +117,6 @@ class PayPalMessageModalConfig: NSObject, Encodable {
case merchantID = "merchant_id"
case partnerAttributionID = "partner_attribution_id"
case amount
case currency
case buyerCountry
case offerType = "offer"
case channel
Expand All @@ -139,7 +133,6 @@ class PayPalMessageModalConfig: NSObject, Encodable {
try container.encodeIfPresent(data.merchantID, forKey: .merchantID)
try container.encodeIfPresent(data.partnerAttributionID, forKey: .partnerAttributionID)
try container.encodeIfPresent(data.amount, forKey: .amount)
try container.encodeIfPresent(data.currency, forKey: .currency)
try container.encodeIfPresent(data.buyerCountry, forKey: .buyerCountry)
try container.encodeIfPresent(data.offerType?.rawValue, forKey: .offerType)
try container.encodeIfPresent(data.channel, forKey: .channel)
Expand Down
3 changes: 0 additions & 3 deletions Sources/PayPalMessages/PayPalMessageModal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ final class PayPalMessageModal: UIViewController, WKUIDelegate {
@Proxy(\.viewModel.amount)
var amount: Double?

@Proxy(\.viewModel.currency)
var currency: String?

@Proxy(\.viewModel.buyerCountry)
var buyerCountry: String?

Expand Down
7 changes: 0 additions & 7 deletions Sources/PayPalMessages/PayPalMessageModalViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ class PayPalMessageModalViewModel: NSObject, WKNavigationDelegate, WKScriptMessa
var amount: Double? {
didSet { queueUpdate(from: oldValue, to: amount) }
}
var currency: String? {
didSet { queueUpdate(from: oldValue, to: currency) }
}
var buyerCountry: String? {
didSet { queueUpdate(from: oldValue, to: buyerCountry) }
}
Expand Down Expand Up @@ -71,7 +68,6 @@ class PayPalMessageModalViewModel: NSObject, WKNavigationDelegate, WKScriptMessa
"merchant_id": merchantID,
"partner_attribution_id": partnerAttributionID,
"amount": amount?.description,
"currency": currency,
"buyer_country": buyerCountry,
"offer": offerType?.rawValue,
"channel": channel,
Expand Down Expand Up @@ -125,7 +121,6 @@ class PayPalMessageModalViewModel: NSObject, WKNavigationDelegate, WKScriptMessa
merchantID = config.data.merchantID
partnerAttributionID = config.data.partnerAttributionID
amount = config.data.amount
currency = config.data.currency
offerType = config.data.offerType
buyerCountry = config.data.buyerCountry
channel = config.data.channel
Expand Down Expand Up @@ -166,7 +161,6 @@ class PayPalMessageModalViewModel: NSObject, WKNavigationDelegate, WKScriptMessa
merchantID = config.data.merchantID
partnerAttributionID = config.data.partnerAttributionID
amount = config.data.amount
currency = config.data.currency
offerType = config.data.offerType
buyerCountry = config.data.buyerCountry
channel = config.data.channel
Expand All @@ -181,7 +175,6 @@ class PayPalMessageModalViewModel: NSObject, WKNavigationDelegate, WKScriptMessa
clientID: self.clientID,
environment: self.environment,
amount: self.amount,
currency: self.currency,
placement: self.placement,
offerType: self.offerType
))
Expand Down
1 change: 0 additions & 1 deletion Sources/PayPalMessages/PayPalMessageViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ class PayPalMessageViewModel: PayPalMessageModalEventDelegate {
clientID: clientID,
environment: environment,
amount: amount,
// currency: currency, TODO: Implement?
placement: placement,
offerType: offerType,
modalCloseButton: modalCloseButton
Expand Down
Loading

0 comments on commit 751c903

Please sign in to comment.