Skip to content

Commit

Permalink
Add ownership fields to FinancialConnectionsAccount (#1302)
Browse files Browse the repository at this point in the history
* Add ownership fields

* mark fields as public
  • Loading branch information
vardges-stripe authored Jul 14, 2022
1 parent 4822bab commit 83fbd7b
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public extension StripeAPI {

public struct CashBalance {
/** The funds available to the account holder. Typically this is the current balance less any holds. Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Each value is an integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder. */
let available: [String:Int]?
public let available: [String:Int]?
}

public struct CreditBalance {
/** The credit that has been used by the account holder. Each key is a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Each value is a integer amount. A positive amount indicates money owed to the account holder. A negative amount indicates money owed by the account holder. */
let used: [String:Int]?
public let used: [String:Int]?
}

public struct Balance {
Expand All @@ -52,7 +52,56 @@ public extension StripeAPI {
public let current: [String:Int]
public let type: ModelType
}

public struct Owner: Codable, Equatable {
/// The email address of the owner.
public let email: String?
/// Unique identifier for the object.
public let id: String
/// The full name of the owner.
public let name: String
/// The ownership object that this owner belongs to.
public let ownership: String
/// The raw phone number of the owner.
public let phone: String?
/// The raw physical address of the owner.
public let rawAddress: String?
/// The timestamp of the refresh that updated this owner.
public let refreshedAt: Int?
}

public struct OwnerList: Codable, Equatable {
public let count: Int?
/// Details about each object.
public let data: [Owner]
/// True if this list has another page of items after this one that can be fetched.
public let hasMore: Bool
public let totalCount: Int?
/// The URL where this list can be accessed.
public let url: String
}

public struct Ownership: Codable, Equatable {
/// Time at which the object was created. Measured in seconds since the Unix epoch.
public let created: Int
/// Unique identifier for the object.
public let id: String
public let owners: OwnerList
}

public struct OwnershipRefresh: Codable, Equatable {
@frozen public enum Status: String, SafeEnumCodable, Equatable {
case failed = "failed"
case pending = "pending"
case succeeded = "succeeded"
case unparsable
}
/// The time at which the last refresh attempt was initiated. Measured in seconds since the Unix epoch.
public let lastAttemptedAt: Int
/// The status of the last refresh attempt.
public let status: OwnershipRefresh.Status
}

@frozen public enum Category: String, SafeEnumCodable, Equatable {
case cash = "cash"
case credit = "credit"
Expand Down Expand Up @@ -97,6 +146,9 @@ public extension StripeAPI {

public let balance: Balance?
public let balanceRefresh: BalanceRefresh?
public let ownership: Ownership?
/// The state of the most recent attempt to refresh the account owners.
public let ownershipRefresh: OwnershipRefresh?
public let displayName: String?
public let institutionName: String
public let last4: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ class PaginatedAPIClient: FinancialConnectionsAPIClient {
private let limit: Int
private lazy var accounts: [StripeAPI.FinancialConnectionsAccount] = (0...count-1).map {
StripeAPI.FinancialConnectionsAccount(balance: nil,
balanceRefresh: nil,
displayName: "\($0)",
institutionName: "TestBank",
last4: "\($0)",
category: .cash,
created: 1,
id: "\($0)",
livemode: false,
permissions: nil,
status: .active,
subcategory: .checking,
supportedPaymentMethodTypes: [.usBankAccount])
balanceRefresh: nil,
ownership: nil,
ownershipRefresh: nil,
displayName: "\($0)",
institutionName: "TestBank",
last4: "\($0)",
category: .cash,
created: 1,
id: "\($0)",
livemode: false,
permissions: nil,
status: .active,
subcategory: .checking,
supportedPaymentMethodTypes: [.usBankAccount])
}

// MARK: - FinancialConnectionsAPIClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class NoMoreAccountSessionAPIClient: FinancialConnectionsAPIClient {
}

func fetchFinancialConnectionsAccounts(clientSecret: String, startingAfterAccountId: String?) -> Promise<StripeAPI.FinancialConnectionsSession.AccountList> {
let account = StripeAPI.FinancialConnectionsAccount(balance: nil, balanceRefresh: nil, displayName: nil, institutionName: "bank", last4: nil, category: .credit, created: 3, id: "12", livemode: false, permissions: nil, status: .active, subcategory: .checking, supportedPaymentMethodTypes: [.usBankAccount])
let account = StripeAPI.FinancialConnectionsAccount(balance: nil, balanceRefresh: nil, ownership: nil, ownershipRefresh: nil, displayName: nil, institutionName: "bank", last4: nil, category: .credit, created: 3, id: "12", livemode: false, permissions: nil, status: .active, subcategory: .checking, supportedPaymentMethodTypes: [.usBankAccount])
let fullList = StripeAPI.FinancialConnectionsSession.AccountList(data: [account], hasMore: false)
return Promise(value: fullList)
}
Expand Down
4 changes: 2 additions & 2 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Generate new localized screenshots



### ios ci_builds
### ios build_extras

```sh
[bundle exec] fastlane ios ci_builds
[bundle exec] fastlane ios build_extras
```


Expand Down

0 comments on commit 83fbd7b

Please sign in to comment.