Skip to content

Adds MPANs configuration objects to ApplePay config - #345

Open
stefan-tudor wants to merge 3 commits into
masterfrom
feature/CT-3271/apple-pay-mpan
Open

Adds MPANs configuration objects to ApplePay config#345
stefan-tudor wants to merge 3 commits into
masterfrom
feature/CT-3271/apple-pay-mpan

Conversation

@stefan-tudor

Copy link
Copy Markdown
Contributor

No description provided.


NSURL *managementURL = [NSURL URLWithString:Settings.defaultSettings.applePayAutomaticReloadPaymentManagementUrl];

if (@available(iOS 16.0, *)) {

@RafalOzogJudopay RafalOzogJudopay Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would make sense to join these two ifs together (this and 452 line).

If so, the same case down below (lines 469 and 473) in deferred payment case.

*
* [NOTE: Deferred Payment is only available starting with iOS 16.4]
*/
@property (nonatomic, strong, nullable) JPDeferredPaymentRequest *deferredPaymentRequest API_AVAILABLE(macos(13.3), ios(16.4)) API_UNAVAILABLE(watchos);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to mention macos in API_AVAILABLE?

func test_ToPKItem_MapsThresholdAmount() {
let pkItem = sut.toPKAutomaticReloadPaymentSummaryItem()
XCTAssertEqual(pkItem.thresholdAmount, thresholdAmount)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could join the last 3 tests into 1, as it is checking whether all required properties are reassigned correctly by toPKAutomaticReloadPaymentSummaryItem.

It allows to shorten the code a bit, and we already do like it for example in test_ToPKRequest_MapsRequiredProperties (JPAutomaticReloadPaymentRequestTests.swift‎).

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
16 Security Hotspots
13.5% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

*/
func test_OnInitialization_SetsManagementURL() {
XCTAssertEqual(sut.managementURL, managementURL)
}

@RafalOzogJudopay RafalOzogJudopay Jul 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could join these two tests test_OnInitialization_SetsManagementURL and test_OnInitialization_SetsPaymentDescription together and check in one test whether all required properties are provided (similarly as below in test_ToPKRequest_MapsRequiredProperties).


NSURL *managementURL = [NSURL URLWithString:Settings.defaultSettings.applePayDeferredPaymentManagementUrl];

if (@available(iOS 16.4, *)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cosmetics, but probably we could join these two ifs together (452 and 456 lines).

@RafalOzogJudopay

Copy link
Copy Markdown
Contributor
  1. The code looks good to me, added few comments above about cosmetics (please have a look), other than that review done.

  2. I see that we only add this MIT stuff to ObjC example app, maybe we could also add it to Swift to keep them in sync?

  3. When testing example app I've noticed that we can select both of these options together (Recurring and Deferred as in the pic). Shouldn't we make them mutually exclusive (as we do in case of PaymentSession vs Token/Secret settings)?

Simulator Screenshot - iPhone 17 Pro - 2026-07-27 at 14 08 45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants