diff --git a/Demo/VTDirectDemo/ViewController.m b/Demo/VTDirectDemo/ViewController.m index 1b51f05bf..6e0f88f21 100755 --- a/Demo/VTDirectDemo/ViewController.m +++ b/Demo/VTDirectDemo/ViewController.m @@ -37,36 +37,23 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. - self.navigationController.view.userInteractionEnabled = NO; - self.itemDetails = [self generateItemDetails]; + self.navigationController.view.userInteractionEnabled = NO; NSDictionary *clientAuth = [[NSUserDefaults standardUserDefaults] objectForKey:@"clientAuth"]; if (clientAuth) { [CONFIG setMerchantClientData:clientAuth]; self.navigationController.view.userInteractionEnabled = YES; - } else { + } + else { [[VTMerchantClient sharedClient] fetchMerchantAuthDataWithCompletion:^(id response, NSError *error) { if (response) { [[NSUserDefaults standardUserDefaults] setObject:response forKey:@"clientAuth"]; [[NSUserDefaults standardUserDefaults] synchronize]; [CONFIG setMerchantClientData:response]; self.navigationController.view.userInteractionEnabled = YES; - } else { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Error loading merchant authentication data, please restart the App" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil]; - [alert show]; } - }]; - } - - if ([CONFIG merchantClientData]) { - self.navigationController.view.userInteractionEnabled = YES; - } else { - [[VTMerchantClient sharedClient] fetchMerchantAuthDataWithCompletion:^(id response, NSError *error) { - if (response) { - [CONFIG setMerchantClientData:response]; - self.navigationController.view.userInteractionEnabled = YES; - } else { + else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Error loading merchant authentication data, please restart the App" delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil]; [alert show]; } diff --git a/MidtransKit/MidtransKit/VTAddCardController.m b/MidtransKit/MidtransKit/VTAddCardController.m index 94bb210b7..3f87a8cee 100755 --- a/MidtransKit/MidtransKit/VTAddCardController.m +++ b/MidtransKit/MidtransKit/VTAddCardController.m @@ -32,6 +32,7 @@ @interface VTAddCardController () @property (strong, nonatomic) IBOutlet VTCCFrontView *cardFrontView; @property (strong, nonatomic) IBOutlet UILabel *amountLabel; @property (strong, nonatomic) IBOutlet UISwitch *saveCardSwitch; +@property (strong, nonatomic) IBOutlet UIView *saveOptionView; @end @@ -49,6 +50,13 @@ - (void)viewDidLoad { [_cardExpiryDate addObserver:self forKeyPath:@"text" options:0 context:nil]; _amountLabel.text = self.transactionDetails.grossAmount.formattedCurrencyNumber; + + if ([CONFIG merchantClientData]) { + self.saveOptionView.hidden = NO; + } + else { + self.saveOptionView.hidden = YES; + } } - (void)dealloc { diff --git a/MidtransKit/MidtransKit/VTPaymentListController.m b/MidtransKit/MidtransKit/VTPaymentListController.m index 4cffecc52..83e250f5b 100755 --- a/MidtransKit/MidtransKit/VTPaymentListController.m +++ b/MidtransKit/MidtransKit/VTPaymentListController.m @@ -115,25 +115,34 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { VTPaymentListModel *paymentMethod = (VTPaymentListModel *)[self.paymentMethodList objectAtIndex:indexPath.row]; if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_CREDIT_CARD_IDENTIFIER]) { - VTCardListController *vc = [[VTCardListController alloc] initWithCustomerDetails:self.customerDetails itemDetails:self.itemDetails transactionDetails:self.transactionDetails paymentMethodName:paymentMethod]; - [self.navigationController pushViewController:vc animated:YES]; - - } else if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_VA_IDENTIFIER]) { + if ([CONFIG merchantClientData]) { + VTCardListController *vc = [[VTCardListController alloc] initWithCustomerDetails:self.customerDetails itemDetails:self.itemDetails transactionDetails:self.transactionDetails paymentMethodName:paymentMethod]; + [self.navigationController pushViewController:vc animated:YES]; + } + else { + VTAddCardController *vc = [[VTAddCardController alloc] initWithCustomerDetails:self.customerDetails itemDetails:self.itemDetails transactionDetails:self.transactionDetails paymentMethodName:nil]; + [self.navigationController pushViewController:vc animated:YES]; + } + } + else if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_VA_IDENTIFIER]) { VTVAListController *vc = [[VTVAListController alloc] initWithCustomerDetails:self.customerDetails itemDetails:self.itemDetails transactionDetails:self.transactionDetails paymentMethodName:paymentMethod]; [self.navigationController pushViewController:vc animated:YES]; - } else if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_CIMB_CLIKS_IDENTIFIER] || - [paymentMethod.internalBaseClassIdentifier isEqualToString:VT_ECASH_IDENTIFIER] || - [paymentMethod.internalBaseClassIdentifier isEqualToString:VT_BCA_KLIKPAY_IDENTIFIER] || - [paymentMethod.internalBaseClassIdentifier isEqualToString:VT_EPAY_IDENTIFIER]) { + } + else if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_CIMB_CLIKS_IDENTIFIER] || + [paymentMethod.internalBaseClassIdentifier isEqualToString:VT_ECASH_IDENTIFIER] || + [paymentMethod.internalBaseClassIdentifier isEqualToString:VT_BCA_KLIKPAY_IDENTIFIER] || + [paymentMethod.internalBaseClassIdentifier isEqualToString:VT_EPAY_IDENTIFIER]) { VTPaymentGeneralViewController *vc = [[VTPaymentGeneralViewController alloc] initWithCustomerDetails:self.customerDetails itemDetails:self.itemDetails transactionDetails:self.transactionDetails paymentMethodName:paymentMethod]; [self.navigationController pushViewController:vc animated:YES]; - } else if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_INDOMARET_IDENTIFIER] || - [paymentMethod.internalBaseClassIdentifier isEqualToString:VT_KLIK_BCA_IDENTIFIER]) { + } + else if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_INDOMARET_IDENTIFIER] || + [paymentMethod.internalBaseClassIdentifier isEqualToString:VT_KLIK_BCA_IDENTIFIER]) { VTPaymentDirectViewController *vc = [[VTPaymentDirectViewController alloc] initWithCustomerDetails:self.customerDetails itemDetails:self.itemDetails transactionDetails:self.transactionDetails paymentMethodName:paymentMethod]; [self.navigationController pushViewController:vc animated:YES]; - } else if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_MANDIRI_CLICKPAY_IDENTIFIER]) { + } + else if ([paymentMethod.internalBaseClassIdentifier isEqualToString:VT_MANDIRI_CLICKPAY_IDENTIFIER]) { VTMandiriClickpayController *vc = [[VTMandiriClickpayController alloc] initWithCustomerDetails:self.customerDetails itemDetails:self.itemDetails transactionDetails:self.transactionDetails paymentMethodName:paymentMethod]; [self.navigationController pushViewController:vc animated:YES]; diff --git a/MidtransKit/MidtransResources/VTAddCardController.xib b/MidtransKit/MidtransResources/VTAddCardController.xib index 079ee7ceb..b7eb8d70b 100644 --- a/MidtransKit/MidtransResources/VTAddCardController.xib +++ b/MidtransKit/MidtransResources/VTAddCardController.xib @@ -1,5 +1,5 @@ - + @@ -14,6 +14,7 @@ + @@ -95,12 +96,58 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -109,16 +156,16 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + - - + +