Skip to content

Commit

Permalink
Release Beta 14 (#120)
Browse files Browse the repository at this point in the history
Performance update for Add Transfer Method GraphQL
  • Loading branch information
aparthibanpaypal authored Jul 5, 2021
1 parent d2b0ab6 commit 0f104f7
Show file tree
Hide file tree
Showing 12 changed files with 335 additions and 93 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changelog
=========
[1.0.0-beta14](https://github.com/hyperwallet/hyperwallet-ios-sdk/releases/tag/1.0.0-beta14)
-------------------
- Performance update for Add Transfer Method GraphQL

[1.0.0-beta13](https://github.com/hyperwallet/hyperwallet-ios-sdk/releases/tag/1.0.0-beta13)
-------------------
Expand Down
2 changes: 1 addition & 1 deletion HyperwalletSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'HyperwalletSDK'
spec.version = '1.0.0-beta13'
spec.version = '1.0.0-beta14'
spec.summary = 'Hyperwallet Core SDK for iOS to integrate with Hyperwallet Platform'
spec.homepage = 'https://github.com/hyperwallet/hyperwallet-ios-sdk'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
8 changes: 8 additions & 0 deletions HyperwalletSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@
E8438CA7F43C3CB6FD545187 /* VenmoAccountResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = E843856BD0D7E5295973780D /* VenmoAccountResponse.json */; };
E8438DB98656EB3F69DE0776 /* VenmoAccountWrongFormatAccountId.json in Resources */ = {isa = PBXBuildFile; fileRef = E84381CE41DDB491C2F2B63D /* VenmoAccountWrongFormatAccountId.json */; };
FD1208CC2581FE3200A8D8B2 /* TransferMethodUpdateConfigurationFieldsVenmoResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = FD1208CB2581FE3200A8D8B2 /* TransferMethodUpdateConfigurationFieldsVenmoResponse.json */; };
FD2B6ECB2670D6980021078B /* TransferMethodConfigurationFeeAndProcessingTimeResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = FD2B6ECA2670D6980021078B /* TransferMethodConfigurationFeeAndProcessingTimeResponse.json */; };
FD536D072579F98B0056DC2D /* HyperwalletTransferMethodUpdateConfigurationQueries.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD536D062579F98B0056DC2D /* HyperwalletTransferMethodUpdateConfigurationQueries.swift */; };
FD536D09257A3C610056DC2D /* HyperwalletTransferMethodUpdateConfigurationField.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD536D08257A3C610056DC2D /* HyperwalletTransferMethodUpdateConfigurationField.swift */; };
FD536D0C257A60CE0056DC2D /* HyperwalletTransferMethodUpdateConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD536D0A257A60920056DC2D /* HyperwalletTransferMethodUpdateConfigurationTests.swift */; };
FDBCC62A26725217002CEF55 /* HyperwalletTransferMethodConfigurationFeeAndProcessingTimeQueryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDBCC62926725217002CEF55 /* HyperwalletTransferMethodConfigurationFeeAndProcessingTimeQueryTests.swift */; };
FDD2F4CF2580AFB0008E4CFC /* TransferMethodUpdateConfigurationFieldsPaypalResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = FDD2F4CE2580AFB0008E4CFC /* TransferMethodUpdateConfigurationFieldsPaypalResponse.json */; };
FDD2F4D12580B1D0008E4CFC /* TransferMethodUpdateConfigurationFieldsBankCardResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = FDD2F4D02580B1D0008E4CFC /* TransferMethodUpdateConfigurationFieldsBankCardResponse.json */; };
FDF2E7A6257E06D600589076 /* TransferMethodUpdateConfigurationFieldsResponse.json in Resources */ = {isa = PBXBuildFile; fileRef = FDF2E7A5257E06D600589076 /* TransferMethodUpdateConfigurationFieldsResponse.json */; };
Expand Down Expand Up @@ -292,10 +294,12 @@
E8438F714A2ED30BE185DE8C /* HyperwalletVenmoQueryParam.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HyperwalletVenmoQueryParam.swift; sourceTree = "<group>"; };
E8438FACD77368B4A83CCA41 /* HyperwalletVenmoAccount.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HyperwalletVenmoAccount.swift; sourceTree = "<group>"; };
FD1208CB2581FE3200A8D8B2 /* TransferMethodUpdateConfigurationFieldsVenmoResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = TransferMethodUpdateConfigurationFieldsVenmoResponse.json; sourceTree = "<group>"; };
FD2B6ECA2670D6980021078B /* TransferMethodConfigurationFeeAndProcessingTimeResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = TransferMethodConfigurationFeeAndProcessingTimeResponse.json; sourceTree = "<group>"; };
FD536D062579F98B0056DC2D /* HyperwalletTransferMethodUpdateConfigurationQueries.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HyperwalletTransferMethodUpdateConfigurationQueries.swift; sourceTree = "<group>"; };
FD536D08257A3C610056DC2D /* HyperwalletTransferMethodUpdateConfigurationField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HyperwalletTransferMethodUpdateConfigurationField.swift; sourceTree = "<group>"; };
FD536D0A257A60920056DC2D /* HyperwalletTransferMethodUpdateConfigurationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HyperwalletTransferMethodUpdateConfigurationTests.swift; sourceTree = "<group>"; };
FD8C499225E014E30062A440 /* Hippolyte.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Hippolyte.xcframework; path = Carthage/Build/Hippolyte.xcframework; sourceTree = "<group>"; };
FDBCC62926725217002CEF55 /* HyperwalletTransferMethodConfigurationFeeAndProcessingTimeQueryTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HyperwalletTransferMethodConfigurationFeeAndProcessingTimeQueryTests.swift; sourceTree = "<group>"; };
FDD2F4CE2580AFB0008E4CFC /* TransferMethodUpdateConfigurationFieldsPaypalResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = TransferMethodUpdateConfigurationFieldsPaypalResponse.json; sourceTree = "<group>"; };
FDD2F4D02580B1D0008E4CFC /* TransferMethodUpdateConfigurationFieldsBankCardResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = TransferMethodUpdateConfigurationFieldsBankCardResponse.json; sourceTree = "<group>"; };
FDF2E7A5257E06D600589076 /* TransferMethodUpdateConfigurationFieldsResponse.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = TransferMethodUpdateConfigurationFieldsResponse.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -628,6 +632,7 @@
isa = PBXGroup;
children = (
DB45190E22DD00A00022BD1F /* HyperwalletTransferMethodConfigurationFieldQueryTests.swift */,
FDBCC62926725217002CEF55 /* HyperwalletTransferMethodConfigurationFeeAndProcessingTimeQueryTests.swift */,
);
path = Query;
sourceTree = "<group>";
Expand Down Expand Up @@ -675,6 +680,7 @@
DBCA37A9225D6D1700CD4137 /* TransferMethodConfigurationFieldsResponse.json */,
DBCA37A4225D6D1600CD4137 /* TransferMethodConfigurationGraphQlResponse.json */,
DBCA37AD225D6D1700CD4137 /* TransferMethodConfigurationKeysResponse.json */,
FD2B6ECA2670D6980021078B /* TransferMethodConfigurationFeeAndProcessingTimeResponse.json */,
FDF2E7A5257E06D600589076 /* TransferMethodUpdateConfigurationFieldsResponse.json */,
FDD2F4D02580B1D0008E4CFC /* TransferMethodUpdateConfigurationFieldsBankCardResponse.json */,
FDD2F4CE2580AFB0008E4CFC /* TransferMethodUpdateConfigurationFieldsPaypalResponse.json */,
Expand Down Expand Up @@ -843,6 +849,7 @@
64278CAF22C0CE0D00B8736B /* CreateTransferResponseInvalidDestinationToken.json in Resources */,
DBCA37B8225D6D1700CD4137 /* TransferMethodConfigurationKeysWithoutFeeResponse.json in Resources */,
DBCA37B7225D6D1700CD4137 /* BankAccountErrorResponseWithMissingBankId.json in Resources */,
FD2B6ECB2670D6980021078B /* TransferMethodConfigurationFeeAndProcessingTimeResponse.json in Resources */,
DBCA37AE225D6D1700CD4137 /* BankAccountIndividualResponse.json in Resources */,
644A69C122B0F7640058E77E /* WireAccountBusinessResponse.json in Resources */,
DBCA37B2225D6D1700CD4137 /* BankCardErrorResponseWithInvalidCardNumber.json in Resources */,
Expand Down Expand Up @@ -962,6 +969,7 @@
DB1A0422225D571B0080C8D6 /* AuthenticationTokenGeneratorMock.swift in Sources */,
DBCA3775225D6A8D00CD4137 /* HyperwalletTransferMethodConfigurationTests.swift in Sources */,
07B1FE6822C2C71200F461D0 /* HyperwalletPrepaidCardTests.swift in Sources */,
FDBCC62A26725217002CEF55 /* HyperwalletTransferMethodConfigurationFeeAndProcessingTimeQueryTests.swift in Sources */,
DB0AFDF62277869500ABEFFD /* HyperwalletUserTests.swift in Sources */,
DB1A0414225D4D8B0080C8D6 /* ConfigurationTests.swift in Sources */,
DB1A0416225D4D8B0080C8D6 /* AuthenticationTokenDecoderTests.swift in Sources */,
Expand Down
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Use [Carthage](https://github.com/Carthage/Carthage) or [CocoaPods](https://coco
### Carthage
Specify it in your Cartfile:
```ogdl
github "hyperwallet/hyperwallet-ios-sdk" "1.0.0-beta13"
github "hyperwallet/hyperwallet-ios-sdk" "1.0.0-beta14"
```

### CocoaPods
Specify it in your Podfile:
```ruby
pod 'HyperwalletSDK', '~> 1.0.0-beta13'
pod 'HyperwalletSDK', '~> 1.0.0-beta14'
```

## Initialization
Expand Down Expand Up @@ -660,7 +660,7 @@ Hyperwallet.shared.listPrepaidCardBalances(prepaidCardToken: "trm-1234", queryPa

## Transfer Method Configurations

### Get countries, currencies and transfer method types
### Get countries, currencies
```swift
let keysQuery = HyperwalletTransferMethodConfigurationKeysQuery()

Expand All @@ -681,14 +681,32 @@ Hyperwallet.shared.retrieveTransferMethodConfigurationKeys(request: keysQuery) {
currencies = result.currencies(from: countries.first!.code)
}

// Get transfer method types based on the first country code and its first currency code
if let countryCode = countries?.first?.code, let currencyCode = currencies?.first?.code {
transferMethodTypes = result.transferMethodTypes(countryCode: countryCode, currencyCode: currencyCode)
}

print(countries)
print(currencies)
}
```

### Get transfer method types, fees and processing times for Country and Currency
```swift
let country = "CA"
let currency = "CAD"
let keysQuery = HyperwalletTransferMethodTypesFeesAndProcessingTimesQuery(country: country, currency: currency)

Hyperwallet
.shared
.retrieveTransferMethodTypesFeesAndProcessingTimes(request: keysQuery) { (result, error) in
guard error == nil else {
print(error?.getHyperwalletErrors()?.errorList?)
return
}

guard let result = result else { return }

// Get transfer method types based on the first country code and its first currency code
transferMethodTypes = result.transferMethodTypes(countryCode: country, currencyCode: currency)
print(transferMethodTypes)
print(transferMethodTypes?.first?.fees)
print(transferMethodTypes?.first?.processingTimes)
}
```

Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ final class HTTPTransaction {

/// Returns the default timeout - 5 seconds
private static let defaultTimeout: Double = {
10.0
5.0
}()

/// Returns `Accept-Language` header, generated by querying `Locale` for the user's `preferredLanguages`.
Expand Down
26 changes: 25 additions & 1 deletion Sources/Hyperwallet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ public final class Hyperwallet: NSObject {
transferMethodUpdateConfigurationFiledResponseHandler(completion))
}

/// Returns the transfer method configuration key set, processing times, and fees for the User that is associated
/// Returns the transfer method configuration key set for the User that is associated
/// with the authentication token returned from
/// `HyperwalletAuthenticationTokenProvider.retrieveAuthenticationToken(_ : @escaping CompletionHandler)`.
///
Expand All @@ -951,6 +951,30 @@ public final class Hyperwallet: NSObject {
completionHandler: transferMethodConfigurationKeyResponseHandler(completion))
}

/// Returns the transfer method types, processing times, and fees for the User that is associated
/// with the authentication token returned from
/// `HyperwalletAuthenticationTokenProvider.retrieveAuthenticationToken(_ : @escaping CompletionHandler)`.
///
/// The `completion: @escaping (HyperwalletTransferMethodConfigurationKey?, HyperwalletErrorType?) -> Void`
/// that is passed in to this method invocation will receive the successful
/// response(HyperwalletTransferMethodConfigurationKey) or
/// error(HyperwalletErrorType) from processing the
/// request.
///
/// This function will request a new authentication token via `HyperwalletAuthenticationTokenProvider`
/// if the current one is expired or is about to expire.
///
/// - Parameters:
/// - request: containing the transfer method configuration key query
/// - completion: the callback handler of responses from the Hyperwallet platform
public func retrieveTransferMethodTypesFeesAndProcessingTimes(
request: HyperwalletTransferMethodTypesFeesAndProcessingTimesQuery,
completion: @escaping (HyperwalletTransferMethodConfigurationKey?,
HyperwalletErrorType?) -> Void) {
httpTransaction.performGraphQl(request,
completionHandler: transferMethodConfigurationKeyResponseHandler(completion))
}

/// Updates the `HyperwalletBankAccount` for the User associated with the authentication token returned from
/// `HyperwalletAuthenticationTokenProvider.retrieveAuthenticationToken(_ : @escaping CompletionHandler)`.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>TAG_VERSION</key>
<string>1.0.0-beta13</string>
<string>1.0.0-beta14</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -168,29 +168,6 @@ public struct HyperwalletTransferMethodConfigurationKeysQuery: GraphQlQuery {
nodes {
code
name
transferMethodTypes {
nodes {
code
name
processingTimes {
nodes {
country
currency
transferMethodType
value
}
}
fees {
nodes {
currency
value
feeRateType
maximum
minimum
}
}
}
}
}
}
}
Expand All @@ -209,3 +186,70 @@ public struct HyperwalletTransferMethodConfigurationKeysQuery: GraphQlQuery {
String(format: query, userToken, limit)
}
}

/// The 'HyperwalletTransferMethodTypesFeesAndProcessingTimesQuery' struct defines
/// and builds a query to retrieve the processing time and fees associated with each country, currency
/// and transfer method type tuple.
/// that is required to construct a `HyperwalletTransferMethodConfigurationFieldQuery`.
public struct HyperwalletTransferMethodTypesFeesAndProcessingTimesQuery: GraphQlQuery, Hashable {
private var country: String = ""
private var currency: String = ""

private var query = """
query QueryFeeAndProcessing(
$idToken: String = "%@",
$country: Country = %@,
$currency: Currency = %@
) {
countries (idToken: $idToken,code: $country){
nodes {
code
name
currencies (code: $currency){
nodes {
code
name
transferMethodTypes {
nodes {
code
name
processingTimes {
nodes {
country
currency
transferMethodType
value
}
}
fees {
nodes {
currency
feeRateType
value
minimum
maximum
}
}
}
}
}
}
}
}
}
"""

public init(country: String, currency: String) {
self.country = country
self.currency = currency
}

public func toGraphQl(userToken: String) -> String {
String(format: query, userToken, country, currency)
}

public func hash(into hasher: inout Hasher) {
hasher.combine(country)
hasher.combine(currency)
}
}
Loading

0 comments on commit 0f104f7

Please sign in to comment.