Skip to content

Commit

Permalink
Releasing sample app compatible with CB v_6.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
umangarya336 committed Nov 6, 2020
1 parent 2501e18 commit 58de496
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions PG SDK UI/Presentation Layer/PUUIPaymentOptionVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -479,23 +479,26 @@ -(void)PayUFailureResponse:(id)response{
- (void)PayUSuccessResponse:(id)payUResponse SURLResponse:(id)surlResponse{
[self removeViewController];
NSError *serializationError;
id payUResponseInJSON = payUResponse;
if (![payUResponse isKindOfClass:[NSDictionary class]]) {
id payUResponseInJSON = [NSDictionary new];
id surlResponseInJSON = surlResponse ? surlResponse : @"";
if (payUResponse && [payUResponse isKindOfClass:[NSString class]]) {
payUResponseInJSON = [NSJSONSerialization JSONObjectWithData:[payUResponse dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&serializationError];
}

NSDictionary *responseDict = [NSDictionary dictionaryWithObjectsAndKeys:payUResponseInJSON,kPUUIPayUResponse, surlResponse, kPUUIMerchantResponse, nil];
NSDictionary *responseDict = [NSDictionary dictionaryWithObjectsAndKeys:payUResponseInJSON,kPUUIPayUResponse, surlResponseInJSON, kPUUIMerchantResponse, nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kPUUINotiPaymentResponse object:responseDict];


}

- (void)PayUFailureResponse:(id)payUResponse FURLResponse:(id)furlResponse{
[self removeViewController];
NSError *serializationError;
id payUResponseInJSON = [NSJSONSerialization JSONObjectWithData:[payUResponse dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&serializationError];
id payUResponseInJSON = [NSDictionary new];
id furlResponseInJSON = furlResponse ? furlResponse : @"";
if (payUResponse && [payUResponse isKindOfClass:[NSString class]]) {
payUResponseInJSON = [NSJSONSerialization JSONObjectWithData:[payUResponse dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&serializationError];
}

NSDictionary *responseDict = [NSDictionary dictionaryWithObjectsAndKeys:payUResponseInJSON,kPUUIPayUResponse, furlResponse, kPUUIMerchantResponse, nil];
NSDictionary *responseDict = [NSDictionary dictionaryWithObjectsAndKeys:payUResponseInJSON,kPUUIPayUResponse, furlResponseInJSON, kPUUIMerchantResponse, nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kPUUINotiPaymentResponse object:responseDict];
}

Expand All @@ -515,20 +518,20 @@ - (void)PayUTerminateTransaction {



#pragma mark - Back Button Handling

- (void) shouldDismissVCOnBackPress
{
UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Cancel Transaction?" message:@"Do you want to cancel this transaction?" preferredStyle:UIAlertControllerStyleAlert];
__weak PUUIPaymentOptionVC *weakSelf = self;
[alertVC addAction:[UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[weakSelf.webVC markPayUTxnCancelInDBWithCompletionBlock:^(BOOL success) {
[weakSelf removeViewController];
}];
}]];
[alertVC addAction:[UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:nil]];
[self.webVC presentViewController:alertVC animated:true completion:nil];
}
//#pragma mark - Back Button Handling
//
//- (void) shouldDismissVCOnBackPress
//{
// UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Cancel Transaction?" message:@"Do you want to cancel this transaction?" preferredStyle:UIAlertControllerStyleAlert];
// __weak PUUIPaymentOptionVC *weakSelf = self;
// [alertVC addAction:[UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
// [weakSelf.webVC markPayUTxnCancelInDBWithCompletionBlock:^(BOOL success) {
// [weakSelf removeViewController];
// }];
// }]];
// [alertVC addAction:[UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:nil]];
// [self.webVC presentViewController:alertVC animated:true completion:nil];
//}

/*!
* Removed current view controller from screen
Expand Down

0 comments on commit 58de496

Please sign in to comment.