Skip to content

Commit

Permalink
Feedback - drop billing prefix from BTPayPalBillingCycle property names
Browse files Browse the repository at this point in the history
  • Loading branch information
scannillo committed Jun 25, 2024
1 parent 85d5034 commit 1653a2d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ class PayPalWebCheckoutViewController: PaymentButtonBaseViewController {
)

let billingCycle = BTPayPalBillingCycle(
billingInterval: .month,
billingIntervalCount: 1,
interval: .month,
intervalCount: 1,
numberOfExecutions: 12,
sequence: 9,
startDate: "2024-04-06T00:00:00Z",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public struct BTPayPalBillingCycle {

// MARK: - Private Properties

private let billingInterval: BillingInterval
private let interval: BillingInterval

/// The interval at which the payment is charged or billed.
public enum BillingInterval: String {
Expand All @@ -15,7 +15,7 @@ public struct BTPayPalBillingCycle {
case year = "YEAR"
}

private let billingIntervalCount: Int
private let intervalCount: Int

private let numberOfExecutions: Int

Expand All @@ -31,24 +31,24 @@ public struct BTPayPalBillingCycle {

/// Initialize a `BTPayPalBillingCycle` object.
/// - Parameters:
/// - billingInterval: The number of intervals after which a subscriber is charged or billed.
/// - billingIntervalCount: The number of times this billing cycle gets executed. For example, if the `billingInterval` is DAY with an `billingIntervalCount` of 2, the subscription is billed once every two days. Maximum values {DAY -> 365}, {WEEK, 52}, {MONTH, 12}, {YEAR, 1}.
/// - intervalCount: The number of intervals after which a subscriber is charged or billed.
/// - intervalCount: The number of times this billing cycle gets executed. For example, if the `intervalCount` is DAY with an `intervalCount` of 2, the subscription is billed once every two days. Maximum values {DAY -> 365}, {WEEK, 52}, {MONTH, 12}, {YEAR, 1}.
/// - numberOfExecutions: The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999). Regular billing cycles can be executed infinite times (value of 0) or a finite number of times (value between 1 and 999).
/// - sequence: The sequence of the billing cycle. Starting value 1 and max value 100. All billing cycles should have unique sequence values.
/// - startDate: The date and time when the billing cycle starts, in Internet date and time format `YYYY-MM-DDT00:00:00Z`. If not provided the billing cycle starts at the time of checkout. If provided and the merchant wants the billing cycle to start at the time of checkout, provide the current time. Otherwise the `startDate` can be in future.
/// - isTrial: The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan.
/// - pricing: The active pricing scheme for this billing cycle. Required if `trial` is false. Optional if `trial` is true.
public init(
billingInterval: BillingInterval,
billingIntervalCount: Int,
interval: BillingInterval,
intervalCount: Int,
numberOfExecutions: Int,
sequence: Int?,
startDate: String?,
isTrial: Bool,
pricing: BTPayPalBillingPricing?
) {
self.billingInterval = billingInterval
self.billingIntervalCount = billingIntervalCount
self.interval = interval
self.intervalCount = intervalCount
self.numberOfExecutions = numberOfExecutions
self.sequence = sequence
self.startDate = startDate
Expand All @@ -61,8 +61,8 @@ public struct BTPayPalBillingCycle {
func parameters() -> [String: Any] {
var parameters: [String: Any] = [:]

parameters["billing_frequency"] = billingIntervalCount
parameters["billing_frequency_unit"] = billingInterval.rawValue
parameters["billing_frequency"] = intervalCount
parameters["billing_frequency_unit"] = interval.rawValue
parameters["number_of_executions"] = numberOfExecutions
parameters["trial"] = isTrial

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ class BTPayPalVaultRequest_Tests: XCTestCase {
)

let billingCycle = BTPayPalBillingCycle(
billingInterval: .month,
billingIntervalCount: 13,
interval: .month,
intervalCount: 13,
numberOfExecutions: 12,
sequence: 9,
startDate: "test-date",
Expand Down

0 comments on commit 1653a2d

Please sign in to comment.