@@ -200,4 +200,74 @@ - (void)testSKPaymentDiscountFromMap {
200200 }
201201}
202202
203+ - (void )testSKPaymentDiscountFromMapMissingIdentifier {
204+ if (@available (iOS 12.2 , *)) {
205+ NSDictionary * discountMap = @{
206+ @" keyIdentifier" : @" payment_discount_key_identifier" ,
207+ @" nonce" : @" d18981e0-9003-4365-98a2-4b90e3b62c52" ,
208+ @" signature" : @" this is a encrypted signature" ,
209+ @" timestamp" : @([NSDate date ].timeIntervalSince1970 ),
210+ };
211+
212+ XCTAssertThrows (
213+ [FIAObjectTranslator getSKPaymentDiscountFromMap: discountMap]);
214+ }
215+ }
216+
217+ - (void )testSKPaymentDiscountFromMapMissingKeyIdentifier {
218+ if (@available (iOS 12.2 , *)) {
219+ NSDictionary * discountMap = @{
220+ @" identifier" : @" payment_discount_identifier" ,
221+ @" nonce" : @" d18981e0-9003-4365-98a2-4b90e3b62c52" ,
222+ @" signature" : @" this is a encrypted signature" ,
223+ @" timestamp" : @([NSDate date ].timeIntervalSince1970 ),
224+ };
225+
226+ XCTAssertThrows (
227+ [FIAObjectTranslator getSKPaymentDiscountFromMap: discountMap]);
228+ }
229+ }
230+
231+ - (void )testSKPaymentDiscountFromMapMissingNonce {
232+ if (@available (iOS 12.2 , *)) {
233+ NSDictionary * discountMap = @{
234+ @" identifier" : @" payment_discount_identifier" ,
235+ @" keyIdentifier" : @" payment_discount_key_identifier" ,
236+ @" signature" : @" this is a encrypted signature" ,
237+ @" timestamp" : @([NSDate date ].timeIntervalSince1970 ),
238+ };
239+
240+ XCTAssertThrows (
241+ [FIAObjectTranslator getSKPaymentDiscountFromMap: discountMap]);
242+ }
243+ }
244+
245+ - (void )testSKPaymentDiscountFromMapMissingSignature {
246+ if (@available (iOS 12.2 , *)) {
247+ NSDictionary * discountMap = @{
248+ @" identifier" : @" payment_discount_identifier" ,
249+ @" keyIdentifier" : @" payment_discount_key_identifier" ,
250+ @" nonce" : @" d18981e0-9003-4365-98a2-4b90e3b62c52" ,
251+ @" timestamp" : @([NSDate date ].timeIntervalSince1970 ),
252+ };
253+
254+ XCTAssertThrows (
255+ [FIAObjectTranslator getSKPaymentDiscountFromMap: discountMap]);
256+ }
257+ }
258+
259+ - (void )testSKPaymentDiscountFromMapMissingTimestamp {
260+ if (@available (iOS 12.2 , *)) {
261+ NSDictionary * discountMap = @{
262+ @" identifier" : @" payment_discount_identifier" ,
263+ @" keyIdentifier" : @" payment_discount_key_identifier" ,
264+ @" nonce" : @" d18981e0-9003-4365-98a2-4b90e3b62c52" ,
265+ @" signature" : @" this is a encrypted signature" ,
266+ };
267+
268+ XCTAssertThrows (
269+ [FIAObjectTranslator getSKPaymentDiscountFromMap: discountMap]);
270+ }
271+ }
272+
203273@end
0 commit comments