Skip to content

Commit

Permalink
[PassKit] Update bindings for Xcode 13.0 beta 1, 2 (#12299)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelkang committed Aug 3, 2021
1 parent f2551e6 commit 3d0ac38
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 229 deletions.
7 changes: 6 additions & 1 deletion src/PassKit/PKEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public enum PKPaymentButtonType : long {
Contribute = 14,
[iOS (14,0)]
Tip = 15,
[Mac (12,0), iOS (15,0), Watch (8,0)]
Continue = 16,
}

[Mac (11,0)]
Expand Down Expand Up @@ -221,7 +223,8 @@ public enum PKPaymentMethodType : ulong
Debit,
Credit,
Prepaid,
Store
Store,
EMoney,
}

[Mac (11,0)]
Expand Down Expand Up @@ -252,6 +255,8 @@ public enum PKPaymentErrorCode : long {
ShippingContactInvalid = 1,
BillingContactInvalid,
ShippingAddressUnserviceable,
CouponCodeInvalid,
CouponCodeExpired,
}

[iOS (12,0)]
Expand Down
199 changes: 197 additions & 2 deletions src/passkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ interface PKPassLibrary {
[Watch (6,2), iOS (13,4)]
[Export ("signData:withSecureElementPass:completion:")]
void SignData (NSData signData, PKSecureElementPass secureElementPass, PKPassLibrarySignDataCompletionHandler completion);

[Async (ResultTypeName = "PKServiceProviderDataCompletionResult")]
[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("serviceProviderDataForSecureElementPass:completion:")]
void GetServiceProviderData (PKSecureElementPass secureElementPass, Action<NSData, NSError> completion);
}

[Static]
Expand Down Expand Up @@ -345,6 +350,11 @@ interface PKPaymentAuthorizationViewControllerDelegate {
[Export ("paymentAuthorizationViewController:didRequestMerchantSessionUpdate:")]
[EventArgs ("PKPaymentRequestMerchantSessionUpdate")]
void DidRequestMerchantSessionUpdate (PKPaymentAuthorizationViewController controller, Action<PKPaymentRequestMerchantSessionUpdate> updateHandler);

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("paymentAuthorizationViewController:didChangeCouponCode:handler:")]
[EventArgs ("PKPaymentRequestCouponCodeUpdate")]
void DidChangeCouponCode (PKPaymentAuthorizationViewController controller, string couponCode, Action<PKPaymentRequestCouponCodeUpdate> completion);
}

[Mac (11,0)]
Expand Down Expand Up @@ -416,6 +426,11 @@ interface PKShippingMethod {
[NullAllowed] // by default this property is null
[Export ("detail")]
string Detail { get; set; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[NullAllowed]
[Export ("dateComponentsRange", ArgumentSemantic.Copy)]
PKDateComponentsRange DateComponentsRange { get; set; }
}

[Watch (3,0)]
Expand Down Expand Up @@ -446,6 +461,19 @@ interface PKPaymentRequest {
[Export ("currencyCode")]
string CurrencyCode { get; set; }

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("supportsCouponCode")]
bool SupportsCouponCode { get; set; }

[NullAllowed]
[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("couponCode")]
string CouponCode { get; set; }

[Watch (8,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("shippingContactEditingMode", ArgumentSemantic.Assign)]
PKShippingContactEditingMode ShippingContactEditingMode { get; set; }

[NoMac]
[Deprecated (PlatformName.WatchOS, 4,0, message: "Use 'RequiredBillingContactFields' instead.")]
[Deprecated (PlatformName.iOS, 11,0, message: "Use 'RequiredBillingContactFields' instead.")]
Expand Down Expand Up @@ -548,6 +576,16 @@ interface PKPaymentRequest {
[Static]
[Export ("paymentShippingAddressUnserviceableErrorWithLocalizedDescription:")]
NSError CreatePaymentShippingAddressUnserviceableError ([NullAllowed] string localizedDescription);

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Static]
[Export ("paymentCouponCodeInvalidErrorWithLocalizedDescription:")]
NSError GetCouponCodeInvalidError ([NullAllowed] string localizedDescription);

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Static]
[Export ("paymentCouponCodeExpiredErrorWithLocalizedDescription:")]
NSError GetCouponCodeExpiredError ([NullAllowed] string localizedDescription);
}

[Mac (11,0)]
Expand Down Expand Up @@ -1140,7 +1178,11 @@ interface PKPaymentAuthorizationControllerDelegate {
[MacCatalyst (14,0)]
[Export ("paymentAuthorizationController:didRequestMerchantSessionUpdate:")]
void DidRequestMerchantSessionUpdate (PKPaymentAuthorizationController controller, Action<PKPaymentRequestMerchantSessionUpdate> handler);


[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("paymentAuthorizationController:didChangeCouponCode:handler:")]
void DidChangeCouponCode (PKPaymentAuthorizationController controller, string couponCode, Action<PKPaymentRequestCouponCodeUpdate> completion);

[Watch (7,0)][iOS (14,0)]
[MacCatalyst (14,0)]
[Export ("presentationWindowForPaymentAuthorizationController:")]
Expand Down Expand Up @@ -1171,7 +1213,7 @@ interface PKLabeledValue

[Mac (11,0)]
[Watch (4,3), iOS (11,3)]
[BaseType (typeof (NSObject))]
[BaseType (typeof (PKStoredValuePassProperties))]
[DisableDefaultCtor]
interface PKTransitPassProperties {

Expand All @@ -1180,9 +1222,17 @@ interface PKTransitPassProperties {
[return: NullAllowed]
PKTransitPassProperties GetPassProperties (PKPass pass);

[Deprecated (PlatformName.iOS, 15, 0)]
[Deprecated (PlatformName.WatchOS, 8, 0)]
[Deprecated (PlatformName.MacOSX, 12, 0)]
[Deprecated (PlatformName.MacCatalyst, 15, 0)]
[Export ("transitBalance", ArgumentSemantic.Copy)]
NSDecimalNumber TransitBalance { get; }

[Deprecated (PlatformName.iOS, 15, 0)]
[Deprecated (PlatformName.WatchOS, 8, 0)]
[Deprecated (PlatformName.MacOSX, 12, 0)]
[Deprecated (PlatformName.MacCatalyst, 15, 0)]
[Export ("transitBalanceCurrencyCode")]
string TransitBalanceCurrencyCode { get; }

Expand All @@ -1192,6 +1242,7 @@ interface PKTransitPassProperties {
[Deprecated (PlatformName.iOS, 14,5, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.MacCatalyst, 14,5, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.WatchOS, 7,4, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.MacOSX, 11,3, message: "Use 'Blocked' instead.")]
[Export ("blacklisted")]
bool Blacklisted { [Bind ("isBlacklisted")] get; }

Expand Down Expand Up @@ -1244,6 +1295,8 @@ interface PKSuicaPassProperties
[Export ("blacklisted")]
[Deprecated (PlatformName.iOS, 14,5, message: "Use 'Blocked' instead.")] // exists in base class
[Deprecated (PlatformName.WatchOS, 7,4, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.MacOSX, 11,3, message: "Use 'Blocked' instead.")]
[Deprecated (PlatformName.MacCatalyst, 14,5, message: "Use 'Blocked' instead.")]
bool Blacklisted { [Bind ("isBlacklisted")] get; }
}

Expand Down Expand Up @@ -1278,6 +1331,10 @@ interface PKPaymentRequestUpdate {

[Export ("paymentSummaryItems", ArgumentSemantic.Copy)]
PKPaymentSummaryItem[] PaymentSummaryItems { get; set; }

[Watch (8,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Export ("shippingMethods", ArgumentSemantic.Copy)]
PKShippingMethod[] ShippingMethods { get; set; }
}

[Mac (11,0)]
Expand Down Expand Up @@ -1569,6 +1626,10 @@ interface PKShareablePassMetadata {
[Export ("initWithProvisioningCredentialIdentifier:cardConfigurationIdentifier:sharingInstanceIdentifier:passThumbnailImage:ownerDisplayName:localizedDescription:")]
IntPtr Constructor (string credentialIdentifier, string cardConfigurationIdentifier, string sharingInstanceIdentifier, CGImage passThumbnailImage, string ownerDisplayName, string localizedDescription);

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("initWithProvisioningCredentialIdentifier:sharingInstanceIdentifier:passThumbnailImage:ownerDisplayName:localizedDescription:accountHash:templateIdentifier:relyingPartyIdentifier:requiresUnifiedAccessCapableDevice:")]
IntPtr Constructor (string credentialIdentifier, string sharingInstanceIdentifier, CGImage passThumbnailImage, string ownerDisplayName, string localizedDescription, string accountHash, string templateIdentifier, string relyingPartyIdentifier, bool requiresUnifiedAccessCapableDevice);

[Export ("credentialIdentifier", ArgumentSemantic.Strong)]
string CredentialIdentifier { get; }

Expand All @@ -1586,6 +1647,22 @@ interface PKShareablePassMetadata {

[Export ("ownerDisplayName", ArgumentSemantic.Strong)]
string OwnerDisplayName { get; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("accountHash", ArgumentSemantic.Strong)]
string AccountHash { get; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("templateIdentifier", ArgumentSemantic.Strong)]
string TemplateIdentifier { get; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("relyingPartyIdentifier", ArgumentSemantic.Strong)]
string RelyingPartyIdentifier { get; }

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Export ("requiresUnifiedAccessCapableDevice")]
bool RequiresUnifiedAccessCapableDevice { get; }
}

[NoWatch, NoTV]
Expand Down Expand Up @@ -1858,6 +1935,23 @@ interface PKPaymentRequestMerchantSessionUpdate {
PKPaymentMerchantSession Session { get; set; }
}

[NoWatch, Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[BaseType (typeof(PKPaymentRequestUpdate))]
[DisableDefaultCtor]
interface PKPaymentRequestCouponCodeUpdate
{
[Export ("initWithPaymentSummaryItems:")]
[DesignatedInitializer]
IntPtr Constructor (PKPaymentSummaryItem[] paymentSummaryItems);

[Export ("initWithErrors:paymentSummaryItems:shippingMethods:")]
[DesignatedInitializer]
IntPtr Constructor ([NullAllowed] NSError[] errors, PKPaymentSummaryItem[] paymentSummaryItems, PKShippingMethod[] shippingMethods);

[NullAllowed, Export ("errors", ArgumentSemantic.Copy)]
NSError[] Errors { get; set; }
}

[Watch (7,0)][Mac (11,0)][iOS (14,0)]
[MacCatalyst (14,0)]
[BaseType (typeof (NSObject))]
Expand All @@ -1873,4 +1967,105 @@ enum PKRadioTechnology : ulong {
Nfc = 1 << 0,
Bluetooth = 1 << 1,
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface PKDateComponentsRange : NSCopying, NSSecureCoding
{
[Export ("initWithStartDateComponents:endDateComponents:")]
[return: NullAllowed]
IntPtr Constructor (NSDateComponents startDateComponents, NSDateComponents endDateComponents);

[Export ("startDateComponents", ArgumentSemantic.Copy)]
NSDateComponents StartDateComponents { get; }

[Export ("endDateComponents", ArgumentSemantic.Copy)]
NSDateComponents EndDateComponents { get; }
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(PKPaymentSummaryItem))]
[DisableDefaultCtor]
interface PKDeferredPaymentSummaryItem
{
[Export ("deferredDate", ArgumentSemantic.Copy)]
NSDate DeferredDate { get; set; }
}

[Watch (8,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Native]
public enum PKShippingContactEditingMode : ulong
{
Enabled = 1,
StorePickup,
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(PKPaymentSummaryItem))]
[DisableDefaultCtor]
interface PKRecurringPaymentSummaryItem
{
[NullAllowed, Export ("startDate", ArgumentSemantic.Copy)]
NSDate StartDate { get; set; }

[Export ("intervalUnit", ArgumentSemantic.Assign)]
NSCalendarUnit IntervalUnit { get; set; }

[Export ("intervalCount")]
nint IntervalCount { get; set; }

[NullAllowed, Export ("endDate", ArgumentSemantic.Copy)]
NSDate EndDate { get; set; }
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
public enum PKStoredValuePassBalanceType
{
[Field ("PKStoredValuePassBalanceTypeCash")]
Cash,
[Field ("PKStoredValuePassBalanceTypeLoyaltyPoints")]
LoyaltyPoints,
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface PKStoredValuePassBalance
{
[Export ("amount", ArgumentSemantic.Strong)]
NSDecimalNumber Amount { get; }

[NullAllowed, Export ("currencyCode")]
string CurrencyCode { get; }

[Export ("balanceType")]
string BalanceType { get; }

[NullAllowed, Export ("expiryDate", ArgumentSemantic.Strong)]
NSDate ExpiryDate { get; }

[Export ("isEqualToBalance:")]
bool IsEqual (PKStoredValuePassBalance balance);
}

[Watch (8,0), iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[BaseType (typeof(NSObject))]
[DisableDefaultCtor]
interface PKStoredValuePassProperties
{
[Static]
[Export ("passPropertiesForPass:")]
[return: NullAllowed]
PKStoredValuePassProperties GetPassProperties (PKPass pass);

[Export ("blocked")]
bool Blocked { [Bind ("isBlocked")] get; }

[NullAllowed, Export ("expirationDate", ArgumentSemantic.Copy)]
NSDate ExpirationDate { get; }

[Export ("balances", ArgumentSemantic.Copy)]
PKStoredValuePassBalance[] Balances { get; }
}
}
13 changes: 13 additions & 0 deletions tests/introspection/iOS/iOSApiProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ protected override bool Skip (Type type, string protocolName)
case "ARSkeletonDefinition": // device only
case "ARVideoFormat": // device only
case "NSMergePolicy":
case "PKDeferredPaymentSummaryItem":
case "PKPaymentRequestCouponCodeUpdate":
case "PKRecurringPaymentSummaryItem":
case "PKStoredValuePassBalance":
case "PKStoredValuePassProperties":
case "SFSafariViewControllerPrewarmingToken": // conformance not in headers
case "SRTextInputSession": // conformance not in headers
return true;
Expand Down Expand Up @@ -682,6 +687,11 @@ protected override bool Skip (Type type, string protocolName)
case "ARSkeletonDefinition": // device only
case "ARVideoFormat": // device only
case "NSMergePolicy":
case "PKDeferredPaymentSummaryItem":
case "PKPaymentRequestCouponCodeUpdate":
case "PKRecurringPaymentSummaryItem":
case "PKStoredValuePassBalance":
case "PKStoredValuePassProperties":
case "SFSafariViewControllerPrewarmingToken": // conformance not in headers
case "SRTextInputSession": // conformance not in headers
return true;
Expand Down Expand Up @@ -767,6 +777,9 @@ protected override bool Skip (Type type, string protocolName)
case "NSMappingModel":
case "NSMergePolicy":
case "NSPropertyMapping":
case "PKDeferredPaymentSummaryItem":
case "PKRecurringPaymentSummaryItem":
case "PKStoredValuePassProperties":
return true;
}
break;
Expand Down
Loading

5 comments on commit 3d0ac38

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)

Packages generated

View packages

Test results

2 tests failed, 223 tests passed.

Failed tests

  • monotouch-test/Mac Catalyst/Debug [dotnet]: BuildFailure ( (failed to parse the logs: '�', hexadecimal value 0x1D, is an invalid character.))
  • Documentation/All: Failed

Pipeline on Agent XAMBOT-1027.BigSur'
[PassKit] Update bindings for Xcode 13.0 beta 1, 2 (#12299)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ Tests failed on macOS M1 - Mac Big Sur (11.5) ❌

Tests failed on M1 - Mac Big Sur (11.5).

Failed tests are:

  • xammac_tests

Pipeline on Agent
[PassKit] Update bindings for Xcode 13.0 beta 1, 2 (#12299)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[PassKit] Update bindings for Xcode 13.0 beta 1, 2 (#12299)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[PassKit] Update bindings for Xcode 13.0 beta 1, 2 (#12299)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS Mac Mojave (10.14) ✅

Tests passed

All tests on macOS X Mac Mojave (10.14) passed.

Pipeline on Agent
[PassKit] Update bindings for Xcode 13.0 beta 1, 2 (#12299)

Please sign in to comment.