Skip to content

Commit

Permalink
CT-2086 Add Billing Details screen (#148)
Browse files Browse the repository at this point in the history
* fixed unit test

* Add billing address related viewModels to JPTransactionViewModel

* Billing details input fields added

* added validators

* Fix tests; Rename invalid JPCardDetailsMode enum values

* clang format

* Remove unused files (mostly outdated/duplicate test files); Add missing public header - JPNetworkTimeout; Reorganise the project file a bit

* Bugfixes and other improvements

* Fix unit test imports and a test

* Attempt to make Sonar happy

* More Sonar fixes

* Add JPCardTransactionDetails+Additions.h to SPM

* Add missing headers for SPM

* Fixes

* Remove duplicate NetworkTimeout after merge; rename JPDictionaryConvertible.toDictionary to _jp_toDictionary

* Updates 3DS package version

* Fixes

* Fixes

* Package version bump

* Fixes unit-tests

* Making Sonar happy

* Make Sonar happy

Co-authored-by: Andrei Movila <[email protected]>
Co-authored-by: Stefan <[email protected]>
  • Loading branch information
3 people authored Aug 5, 2022
1 parent 36ac74b commit 5f87126
Show file tree
Hide file tree
Showing 108 changed files with 3,098 additions and 1,702 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1084,14 +1084,14 @@
CODE_SIGN_ENTITLEMENTS = ObjectiveCExampleApp/ObjectiveCExampleApp.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 95V535S6TQ;
INFOPLIST_FILE = ObjectiveCExampleApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.3;
MARKETING_VERSION = 3.1.0;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.judo.JudoPayDemoObjC;
PRODUCT_NAME = "Judopay demo";
Expand All @@ -1109,14 +1109,14 @@
CODE_SIGN_ENTITLEMENTS = ObjectiveCExampleApp/ObjectiveCExampleApp.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 95V535S6TQ;
INFOPLIST_FILE = ObjectiveCExampleApp/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.3;
MARKETING_VERSION = 3.1.0;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.judo.JudoPayDemoObjC;
PRODUCT_NAME = "Judopay demo";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ - (JPCardTransactionDetails *)cardTransactionDetails {
address2:nil
address3:nil
town:@"London"
billingCountry:nil
postCode:@"se151qa"
countryCode:@826];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ - (NSSet *)computeHiddenKeysWithPriority:(NSArray *)keys {
kAddressLine3Key,
kAddressTownKey,
kAddressPostCodeKey,
kAddressBillingCountryKey,
kAddressCountryCodeKey,
kAddressPhoneCountryCodeKey,
kAddressMobileNumberKey,
Expand Down Expand Up @@ -72,7 +71,6 @@ - (NSSet *)computeHiddenKeysWithPriority:(NSArray *)keys {
kAddressLine3Key,
kAddressTownKey,
kAddressPostCodeKey,
kAddressBillingCountryKey,
kAddressCountryCodeKey,
kAddressPhoneCountryCodeKey,
kAddressMobileNumberKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ static NSString *const kAddressLine2Key = @"address_line_2";
static NSString *const kAddressLine3Key = @"address_line_3";
static NSString *const kAddressTownKey = @"address_town";
static NSString *const kAddressPostCodeKey = @"address_post_code";
static NSString *const kAddressBillingCountryKey = @"address_billing_country";
static NSString *const kAddressCountryCodeKey = @"address_country_code";
static NSString *const kAddressPhoneCountryCodeKey = @"address_phone_country_code";
static NSString *const kAddressMobileNumberKey = @"address_mobile_number";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ - (JPAddress *)address {
address2:[self.defaults stringForKey:kAddressLine2Key]
address3:[self.defaults stringForKey:kAddressLine3Key]
town:[self.defaults stringForKey:kAddressTownKey]
billingCountry:[self.defaults stringForKey:kAddressBillingCountryKey]
postCode:[self.defaults stringForKey:kAddressPostCodeKey]
countryCode:addressCountryCode];
}
Expand All @@ -234,15 +233,24 @@ - (JPPrimaryAccountDetails *)primaryAccountDetails {
}

- (NSString *)emailAddress {
return [self.defaults stringForKey:kAddressEmailAddressKey];
if (Settings.defaultSettings.isAddressOn) {
return [self.defaults stringForKey:kAddressEmailAddressKey];
}
return nil;
}

- (NSString *)mobileNumber {
return [self.defaults stringForKey:kAddressMobileNumberKey];
if (Settings.defaultSettings.isAddressOn) {
return [self.defaults stringForKey:kAddressMobileNumberKey];
}
return nil;
}

- (NSString *)phoneCountryCode {
return [self.defaults stringForKey:kAddressPhoneCountryCodeKey];
if (Settings.defaultSettings.isAddressOn) {
return [self.defaults stringForKey:kAddressPhoneCountryCodeKey];
}
return nil;
}

#pragma mark - 3DS v2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<key>Title</key>
<string>is_3ds2_enabled_title</string>
<key>Key</key>
<string>is_billing_info_screen_enabled</string>
<string>should_ask_for_billing_information</string>
<key>DefaultValue</key>
<true/>
</dict>
Expand Down Expand Up @@ -421,16 +421,6 @@
<key>DefaultValue</key>
<string>TR14 8PA</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>address_billing_country_title</string>
<key>Key</key>
<string>address_billing_country</string>
<key>DefaultValue</key>
<string>826</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,27 @@ - (void)test_GivenValidJPResponse_ParseObjectCorrectly {
Result *result = [Result resultFromObject:mockedResponse];

XCTAssertTrue([result.title isEqualToString:@"JPResponse"]);
NSMutableArray *titles = [NSMutableArray new];

for (ResultItem *item in result.items) {

// Judo ID should resolve to NSString and should not have subresults
if ([item.title isEqualToString:@"judoId"]) {
XCTAssertTrue([item.value isEqualToString:@"123456"]);
XCTAssertNil(item.subResult);
} else {
XCTFail(@"Judo ID must be a part of the Result object");
}

// Consumer should resolve to a JPConsumer and should have subresults
if ([item.title isEqualToString:@"consumer"]) {
XCTAssertTrue([item.value isEqualToString:@"JPConsumer"]);
XCTAssertNotNil(item.subResult);

XCTAssertTrue([item.subResult.title isEqualToString:@"JPConsumer"]);
XCTAssertEqual(item.subResult.items.count, 2);
} else {
XCTFail(@"Consumer must be part of the Result object");
}
[titles addObject:item.title];
}

XCTAssertTrue([titles containsObject:@"judoId"],@"Judo ID must be a part of the Result object");
XCTAssertTrue([titles containsObject:@"consumer"],@"Consumer must be part of the Result object");
}

- (JPResponse *)mockedResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#import "XCUIElement+Additions.h"
#import "JPHelpers.h"

void returnToMainScreen() {
void returnToMainScreen(void) {
XCUIApplication *application = [XCUIApplication new];
XCUIElement *mainScreen = application.otherElements[@"Main View"];
XCUIElement *cancelButton = application.buttons[@"CANCEL"];
Expand All @@ -54,7 +54,7 @@ void swipeAndDeleteCardCell(XCUIElement *cardCell) {
[[XCUIApplication new].alerts.buttons[@"Delete"] tap];
}

void resetStoredCards() {
void resetStoredCards(void) {
[JPMainElements.settingsButton tap];
[JPSettingsElements.cardPaymentMethodSwitch switchOn];
[JPGenericElements.backButton tap];
Expand Down Expand Up @@ -88,7 +88,7 @@ void resetStoredCards() {
}
}

void resetSettings() {
void resetSettings(void) {
[JPMainElements.settingsButton tap];

NSArray *switches = @[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

__attribute__((constructor))

void CucumberishInit() {
void CucumberishInit(void) {

NSBundle *bundle = [NSBundle bundleForClass:[JPUITestSetup class]];

Expand Down
8 changes: 4 additions & 4 deletions Examples/ObjectiveCExampleApp/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use_frameworks!
inhibit_all_warnings!

target 'ObjectiveCExampleApp' do
pod 'Judo3DS2_iOS', '1.0.1'
pod 'JudoKit-iOS', '3.0.2'

# pod 'Judo3DS2_iOS', :path => '../../../Judo3DS2-iOS-Source'
# pod 'JudoKit-iOS', :path => '../../'
pod 'Judo3DS2_iOS', '1.1.0'

pod 'JudoKit-iOS', :path => '../../'
# pod 'JudoKit-iOS', '3.1.0'

pod 'MaterialComponents/Snackbar'
pod 'InAppSettingsKit', '3.3.6'
Expand Down
19 changes: 10 additions & 9 deletions Examples/ObjectiveCExampleApp/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ PODS:
- DeviceDNA (2.0.0):
- OpenSSL-Universal (~> 1.1.180)
- InAppSettingsKit (3.3.6)
- Judo3DS2_iOS (1.0.1)
- JudoKit-iOS (3.0.2):
- Judo3DS2_iOS (1.1.0)
- JudoKit-iOS (3.0.3):
- DeviceDNA (~> 2.0.0)
- Judo3DS2_iOS (~> 1.0.1)
- Judo3DS2_iOS (~> 1.1.0)
- TrustKit
- ZappMerchantLib
- MaterialComponents/AnimationTiming (124.2.0)
Expand Down Expand Up @@ -87,8 +87,8 @@ DEPENDENCIES:
- CocoaDebug (= 1.7.2)
- Cucumberish (from `https://github.com/mpetrenco/Cucumberish.git`)
- InAppSettingsKit (= 3.3.6)
- Judo3DS2_iOS (= 1.0.1)
- JudoKit-iOS (= 3.0.2)
- Judo3DS2_iOS (= 1.1.0)
- JudoKit-iOS (from `../../`)
- MaterialComponents/Snackbar

SPEC REPOS:
Expand All @@ -97,7 +97,6 @@ SPEC REPOS:
- DeviceDNA
- InAppSettingsKit
- Judo3DS2_iOS
- JudoKit-iOS
- MaterialComponents
- MDFInternationalization
- MDFTextAccessibility
Expand All @@ -108,6 +107,8 @@ SPEC REPOS:
EXTERNAL SOURCES:
Cucumberish:
:git: https://github.com/mpetrenco/Cucumberish.git
JudoKit-iOS:
:path: "../../"

CHECKOUT OPTIONS:
Cucumberish:
Expand All @@ -119,15 +120,15 @@ SPEC CHECKSUMS:
Cucumberish: 6cbd0c1f50306b369acebfe7d9f514c9c287d26c
DeviceDNA: 9ff289d1fb983937754b324fa0adade2081210c4
InAppSettingsKit: 37df0b44132380d4c7db6fc7cded92997e29873a
Judo3DS2_iOS: c1ccf49ecacddb4559a73fb7eae6e680e2355b21
JudoKit-iOS: 4a96c63d4cfb45bb1a68a1891b2ebaeaa8a46be1
Judo3DS2_iOS: 88276544805c5db040e90c0e597d84da302480af
JudoKit-iOS: eb123ac21dde4e14e92d497e4a98f1aff7e23f60
MaterialComponents: 1a9b2d9d45b1601ae544de85089adc4c464306d4
MDFInternationalization: d697c55307816222a55685c4ccb1044ffb030c12
MDFTextAccessibility: f4bb4cc2194286651b59a215fdeaa0e05dc90ba5
OpenSSL-Universal: ee0a7a25f2042782e2df405e66db3e429198e392
TrustKit: 610b8c71c07914756dd74c380040a3408a747798
ZappMerchantLib: b14bc5814840426d351190309250347ca9b0983d

PODFILE CHECKSUM: 19338ddb7cdb0fea4f3595c840eb51d5d5e71db9
PODFILE CHECKSUM: a15c5b473dbfa7199cb2fbc9de48e3a6a4302ca9

COCOAPODS: 1.11.3
7 changes: 4 additions & 3 deletions JudoKit-iOS.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'JudoKit-iOS'
s.version = '3.0.3'
s.version = '3.1.0'
s.summary = 'Judo Pay Full iOS Client Kit'
s.homepage = 'https://www.judopay.com/'
s.license = 'MIT'
Expand All @@ -12,13 +12,14 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '11.0'
s.requires_arc = true
s.source_files = 'Source/**/*.{m,h}'
s.exclude_files = 'Source/include/'

s.dependency 'DeviceDNA', '~> 2.0.0'
s.dependency 'TrustKit'
s.dependency 'ZappMerchantLib'
s.dependency 'Judo3DS2_iOS', '~> 1.0.1'
s.dependency 'Judo3DS2_iOS', '~> 1.1.0'

s.frameworks = 'CoreLocation', 'Security', 'CoreTelephony', 'Vision'
s.resource_bundles = { "JudoKit_iOS" => ["Resources/*.lproj/*.strings"] }
s.resources = ['Resources/icons.bundle', 'Resources/resources.bundle']
s.resources = ['Resources/icons.bundle', 'Resources/resources.bundle', 'Resources/CountriesList.json']
end
Loading

0 comments on commit 5f87126

Please sign in to comment.