Instantly share code, notes, and snippets.

Embed
What would you like to do?
//
// AddCardViewController.m
// pay
//
// Created by Jasmin Suljic on 21/12/16.
// Copyright © 2016 Webteh.hr. All rights reserved.
//
#import "AddCardViewController.h"
#import "WebtehWebView.h"
#import "ApiService.h"
#import "PgwApi.h"
@interface AddCardViewController ()
@property (weak, nonatomic) IBOutlet WebtehWebView *webtehWebView;
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *progressBar;
@end
@implementation AddCardViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
PgwApi *api = [[PgwApi alloc] init:@"00001111222233330000111122223333" isDebug:true];
NSString *orderNumber = [ApiService currentMillis];
TransactionLifecycleAdapter * adapter = [[TransactionLifecycleAdapter alloc] init:self api:api merchantKey:@"TestKeyXULLyvgWyPJSwOHe" orderNumber:orderNumber];
[_webtehWebView initialize:adapter isDebug:true timeout:10000];
AddCardModel *model = [[AddCardModel alloc] init:@"007007007007"
client:@"ios"
orderInfo:@"order info"
orderNumber:orderNumber
sign:@"009"
amount:@"1340"
currency:@"EUR"
clientSecret:@"MegaSecretKey"
authToken:@"00001111222233330000111122223333"];
[_webtehWebView addCard:model];
}
-(void) showProgress{
NSLog(@"showProgress");
[self.progressBar startAnimating];
}
-(void) hideProgress{
NSLog(@"hideProgress");
[self.progressBar stopAnimating];
}
-(void) transactionSuccess:(TransactionSuccess *)success{
NSLog(@"transactionSuccess: %@", success);
}
-(void) handleTransactionErrorApi:(ApiErrorException *)model{
NSLog(@"handleTransactionErrorApi: %@", model);
}
-(void) checkOrderIdFailure:(ApiErrorException *)model{
NSLog(@"checkOrderIdFailure: %@", model);
}
-(void) checkOrderIdSuccess:(ShowOrderResponse *)model{
NSLog(@"checkOrderIdSuccess: %@", model);
}
-(void) handleTransactionError:(TransactionErrorDetailed *)model{
NSLog(@"handleTransactionError: %@", model);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment