Я пытаюсь внедрить Payumoney SDK в моем проекте, как проверено в тестовой среде. Я получаю сообщение об ошибке, указывающее, что «ключ недействителен»
PUMTxnParam *txnParam= [[PUMTxnParam alloc] init];
//Set the parameters
txnParam.phone = [[userDict valueForKey:@"basicDetails"] valueForKey:@"contactNumber"];
txnParam.email = email;
txnParam.amount = [NSString stringWithFormat:@"%@",[detailDict valueForKey:@"amt"]];
txnParam.environment = PUMEnvironmentTest;
//txnParam.environment = PUMEnvironmentProduction;
txnParam.firstname = [[userDict valueForKey:@"basicDetails"] valueForKey:@"firstName"];
txnParam.key = @"uxUefv4H";
txnParam.merchantid = [paymentGateInfoDict valueForKey:@"merchantId"];
txnParam.txnID = txnId;
txnParam.surl = [paymentGateInfoDict valueForKey:@"surl"];
txnParam.furl = [paymentGateInfoDict valueForKey:@"furl"];
txnParam.productInfo = kAppName;
txnParam.udf1 = [groupDict valueForKey:@"code"];
txnParam.udf2 = [groupDict valueForKey:@"name"];
txnParam.udf2 = [_paymentArray objectAtIndex:kPostIdIndex];
txnParam.udf4 = [detailDict valueForKey:@"payId"];
txnParam.udf5 = payHeading;
txnParam.udf6 = userId;
txnParam.udf7 = @"";
txnParam.udf8 = @"";
txnParam.udf9 = @"";
txnParam.udf10 = @"";
txnParam.hashValue = [NBUtils getHashForPaymentParams:txnParam];
[PlugNPlay setButtonColor:kDarkestGreyColor];
[PlugNPlay setTopTitleTextColor:kDarkestGreyColor];
[PlugNPlay setTopBarColor:kLightestGreyColor];
[PlugNPlay presentPaymentViewControllerWithTxnParams:txnParam onViewController:self withCompletionBlock:^(NSDictionary *paymentResponse, NSError *error, id extraParam) {
if (paymentResponse) {
[self savePaymentDataToServer:[paymentResponse valueForKey:@"result"]];
}
// NSLog(@"the payment response is : %@",[paymentResponse description]);
// NSLog(@"the payment error is : %@",[error description]);
}];
// generating hashcode
+(NSString *)getHashForPaymentParams:(PUMTxnParam *)txnParam{
NSString *salt = txnParam.environment == PUMEnvironmentTest? @"AWlay6xpm0" : @"AWlay6xpm0";
NSLog(@"saltValue............:%@",salt);
NSString *hashSequence = [NSString stringWithFormat:@"%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@|%@",txnParam.key,txnParam.txnID,txnParam.amount,txnParam.productInfo,txnParam.firstname,txnParam.email,txnParam.udf1,txnParam.udf2,txnParam.udf3,txnParam.udf4,txnParam.udf5,txnParam.udf6,txnParam.udf7,txnParam.udf8,txnParam.udf9,txnParam.udf10, salt];
const char *s = [hashSequence cStringUsingEncoding:NSASCIIStringEncoding];
NSData *keyData = [NSData dataWithBytes:s length:strlen(s)];
uint8_t digest[CC_SHA512_DIGEST_LENGTH] = {0};
CC_SHA512(keyData.bytes, (CC_LONG)keyData.length, digest);
NSData *output = [NSData dataWithBytes:digest length:CC_SHA512_DIGEST_LENGTH];
//NSLog(@"Hash output --------- %@",output);
NSString *hash = [[[[output description]stringByReplacingOccurrencesOfString:@"<" withString:@""]stringByReplacingOccurrencesOfString:@">" withString:@""]stringByReplacingOccurrencesOfString:@" " withString:@""];
return hash;
}