@@ -74,6 +74,15 @@ - (void)registerViewWithCallback:(callbackWithParams)callback {
7474 [[Branch getInstance ] registerViewWithParams: [self getParamsForServerRequest ] andCallback: callback];
7575}
7676
77+ - (void )userCompletedAction : (NSString *)action {
78+ NSMutableDictionary *actionPayload = [[NSMutableDictionary alloc ] init ];
79+ NSDictionary *linkParams = [self getParamsForServerRequest ];
80+ actionPayload[BNCCanonicalIdList] = @[self .canonicalIdentifier];
81+ actionPayload[self .canonicalIdentifier] = linkParams;
82+
83+ [[Branch getInstance ] userCompletedAction: action withState: actionPayload];
84+ }
85+
7786#pragma mark - Link Creation Methods
7887
7988- (NSString *)getShortUrlWithLinkProperties : (BranchLinkProperties *)linkProperties {
@@ -311,6 +320,12 @@ + (BranchUniversalObject *)getBranchUniversalObjectFromDictionary:(NSDictionary
311320 if (dictionary[BRANCH_LINK_DATA_KEY_KEYWORDS]) {
312321 universalObject.keywords = dictionary[BRANCH_LINK_DATA_KEY_KEYWORDS];
313322 }
323+ if (dictionary[BNCPurchaseAmount]) {
324+ universalObject.price = [dictionary[BNCPurchaseAmount] floatValue ];
325+ }
326+ if (dictionary[BNCPurchaseCurrency]) {
327+ universalObject.currency = dictionary[BNCPurchaseCurrency];
328+ }
314329
315330 return universalObject;
316331}
@@ -337,6 +352,12 @@ - (NSDictionary *)getParamsForServerRequest {
337352 [self safeSetValue: self .keywords forKey: BRANCH_LINK_DATA_KEY_KEYWORDS onDict: temp];
338353 [self safeSetValue: @(1000 * [self .expirationDate timeIntervalSince1970 ]) forKey: BRANCH_LINK_DATA_KEY_CONTENT_EXPIRATION_DATE onDict: temp];
339354 [self safeSetValue: self .type forKey: BRANCH_LINK_DATA_KEY_CONTENT_TYPE onDict: temp];
355+ [self safeSetValue: self .currency forKey: BNCPurchaseCurrency onDict: temp];
356+ if (self.price ) {
357+ // have to add if statement because safeSetValue only accepts objects so even if self.price is not set
358+ // a valid NSNumber object will be created and the request will have amount:0 in all cases.
359+ [self safeSetValue: [NSNumber numberWithFloat: self .price] forKey: BNCPurchaseAmount onDict: temp];
360+ }
340361
341362 [temp addEntriesFromDictionary: [self .metadata copy ]];
342363 return [temp copy ];
0 commit comments