Skip to content

Commit

Permalink
Development (#386)
Browse files Browse the repository at this point in the history
* update

* update

* update

* update fix object data on saved card

* update

* add 5 minute expiry for cc token (#357)

* update reduce gross amount

* update promo velocity error

* decreased gross amount price to 2k (#359)

* update

* Feature/mob 1632 add custom field (#361)

* one custom field

* add multiple input type option

* add new kind for mdalertviewcontroller

* link mdoptionmanager custom field value with the ones for demo merchant client request

* change total amount to 10k then display bank name and logo on saved card view (#360)

* fix nil value checking for custom field (#362)

* update order_id

* update order-id

* fix setting midtrans transaction expire time according to md option (#363)

* update

* update constant and bump version to 1.12.1

* correcting total amount from transaction result (#366)

* Feature/mob 1649 multi currency demo (#365)

* fix no expiry bug

* add midtrans currency, midtrans config, midtrans currency formatter from existing indonesian currency formatter

* use iso country code style

* replace indonesian currency formatter with format iso currency number, apply to demo as well

* add currency field on midtrans v2 transaction detail

* add constants, add models on transaction detail

* reset v2 models, add constants string, helper methods for currency/string conversion

* add currency on request from config

* add md option and option manager for currency

* add icons

* add currency on credit card get token

* add test case for decimal value in demo
make sure when currency=idr/sgd request will send correct decimal value or integer
make sure item details is correct when currency idr/sgd
revert back paymentrequestv2

* make sure format width is +1 from number format string length to give space between idr/sgd and nominal

* remove spaces

* make sure validate string regardless of upper/lower cases

* remove some more spaces

* remove some more spaces for formatter
revert spaces for v2

* revert back for v2

* remove some spaces

* Feature/mob 1649 multi currency demo (#367)

* add currency field on midtrans v2 transaction detail

* add constants, add models on transaction detail

* reset v2 models, add constants string, helper methods for currency/string conversion

* add currency on request from config

* add currency on credit card get token

* remove some more spaces for formatter
revert spaces for v2

* revert back for v2

* make sure decimal handled correctly on transaction detail view total amount popup

* remove reference for indomaret xib and re add again (#369)

* remove reference for indomaret xib and re add again

* handle total amount display when transaction fail

* bump podpecs

* remove reference for indomaret and danamon online, move them to midtranskit resources folder, then re-add them again. (#371)

tested on demo app

* bump to 1.12.3

* fix crash on add new card from saved card controller when payment is one click (#372)

* fix crash on add new card from saved card controller when payment is one click

* remove unused code

* Chore/fix wording (#374)

* fix wording on en_lang and id_lang

* refactor error message/code and localisation

* add indonesian translation

* localize gopay display message

* fix localised NSError translation conditional by description rather than localizedDescription because we want to be sure when comparing English sentences

* refine method localised NSError Midtrans Error message

* add translation for gopay message

* try make testing class for midtrans transaction result

* make sure refactoring alert message is ok, make some test cases

* use vtclass helper on gopay

* fix bug where card list not refreshing on saved card view controller after deleting last card via 'hapus kartu' button on new cc view controller (#375)

* revert back demo settings to config set on MDOptionsViewController (#376)

* fix one click-two click add card when token storage enabled no (#377)

* Bugfix/mob 1671 change idr to rp in ui (#378)

* change currency label on ui for indonesian from IDR to Rp

* add special case for mandiri click pay input2 label display

* bump version 1.13.1 (#379)

* Feature/mob 1630 bin filter (#368)

* add bin filter ui on demo and config save

* fix bin filter demo option

* fix edit filter by bank names

* remove dummy bin filter

* fix bank names

* use compatible bank names from snap

* add filter by bank name function on midtrans client

* handle total amount when case transaction error

* merge development into bin filter, delete the midtransclient bankname func as we dont need it

* Feature/akulaku (#384)

* Feature/mob 1197 klikpay instruction (#308)

* update delegate to strong

* update podpecs-> 1.7.1.4

* update creditcard helper

* Feature/translation cc (#299)

* add localizable.strings

* update locale

* replace uilocalizedstring macro with vtclasshelper gettranslationfromappbundleforstring

* add permata va localization

* update devicehelper

* add mandiri e-cash localization

* add mandiri click pay translation

* changed translation from localized files to plist files with prefix en/id (language code)

* add bca klikpay and klikbca translation

* id bca klikpay

* changed filename of each plist to prefix id/en using function midtransdevicehelper

* update fixing path translation

* add ini va translation

* add bca va translation

* update translation creditcard

* all va translation

* update midtranscreditcardHelper

* add translation

* translation VA

* update translation

* update cimb clicks translation

* update translation

* add translation mandiri click pay

* update cell translation

* fixed wrong plist format for translation, should be array at root instead of dict

* add email placeholder translation on bank transfer

* update translation cc

* fix sms charges notice label translation

* update translation cc

* update translation cc

* fix small leftovers for translation

* update

* fix small leftover translation

* updat

* add leftover small translation

* add small translation leftover

* update cc translation

* update compability on midtransmerchantclient

* release 1.7.2

* update translation

* updating pod pecs

* update core kit

* update podpecs

* fix langungage positiion

* fix langungage positiion

* update podpecs

* update podpecs

* update podpecs

* update add development

* update classhelper to handle location of translation

* update podpecs to 1.7.2.4

* update lang-> lang.json

* update podpecs to 1.7.2.5

* update

* Feature/mob 1192 other atm (#300)

* added icons for atm lainnya

* insert icon image view

* fixed bank icons for bank transfer for others va

* remove some spaces

* just changing the spelling for indonesian text field placeholder (#301)

* update reload save card after delete

* add danamon payment list

* fix crash on other bank transfer

* fix crash on other bank transfer

* update release 1.7.2.6

* Feature/mob 1192 backup for other bank transfer with ui fix (#305)

* added icons for atm lainnya

* insert icon image view

* fixed bank icons for bank transfer for others va

* remove some spaces

* working on ui for other bank list

* fix alpha on midtrans table alert view container

* add title for midtrans table alert view

* fix presenting table alert view

* fix table alert view title and refactor with enum type

* fix ui for table alert

* Feature/mob 1192 backup for other atm (#304)

* added icons for atm lainnya

* insert icon image view

* fixed bank icons for bank transfer for others va

* remove some spaces

* working on ui for other bank list

* fix alpha on midtrans table alert view container

* add title for midtrans table alert view

* fix presenting table alert view

* fix table alert view title and refactor with enum type

* fix ui for table alert

* update fix crash on other bank transfer

* update

* update token storage bug

* update credit card token storage method

* pre-released 1.7.2.7

* handle language if its not id, or english

* update creditcard config when handle nil

* pre-release 1.7.3

* update remove raygun

*  remove temporary raygun

* changes alignment for numbers

* add klikpay new instruction

* update

* Development (#327)

* fixing with adding BNI_VA to plist

* update gopay and paymentlist

* update to 1.9.4

* update

* update BCA VA
update localized about BNI

* updaet vtclasshelper for language

* update

* update mdordercontroller

* update transaction id

* revert to payment normal

* update expire time

* update

* update paymentlist

* update

* update-> TNC bni point

* update

* update fix crash on promos

* update sandbox

* simulate otherVA

* update midtransorderviewcontorller

* update payment order

* bump version to 1.9.5

* update

* update kioson, indomaret

* update virtual account number -> payment code

* change wording when bin is not applicable

* update translation for wrong

* update development expiry date credit card

* update credit card helper

* update

* prepare for release 1.10.0

* bump version to 1.10.0

* update

* update

* update midtrans ui cell to get the promo badge

* update

* update

* update

* Feature/mob 1549 check bin update snap (#332)

* combine local son loading with snap api call

* use only api call for bin number update

* refine

* load local first at view didload for new creditcard view controller

* fix instalment available match bin number method

* update move to mainthread

* update

* update

* update

* move some BINs from bni to bni_debit_online (#334)

* extract and add merchant id from v2response, for mixpanel tracking (#335)

* Bugfix/mob 1549 fix check bin threading (#333)

* fix instalment view threading

* add weak self for configure installment threading

* add transaction id tracking (#339)

* add transaction id tracking

* fix transaction id and order id tracking

* prevent nil

* fix add entries

* fix order id

* fix lower case track event name

* add enabled payments as default parameters for tracking manager (#337)

* add enabled payments as default parameters for tracking manager

* change tracking prefix

* fix lower case without underscore

* Feature/mob 1573 track 1click2click (#341)

* add track event 1 click 2 click additional parameters

* fix 1 click 2 click token available tracking

* fix code convention format

* Feature/mob 1578 tracking installment (#342)

* add installment available and required on tracking manager

* fix installment tracking

* fix installment tracking on load

* add installment tracking on did load for saved card

* fix lower case

* remove this as we no longer use user defaults to store installment data, instead we send it directly on view did load (#343)

* update

* put ui modification code on resetInstallmentIndex to main thread, (#344)

* put ui modification code on resetInstallmentIndex to main thread,
add additional data properly for payment status success

* use strong self

* update

* update

* Feature/mob 1573 add missing properties 1click 2click (#345)

* add missing 1 click 2 click properties for mixpanel tracking on pg success

* add missing installment properties on pg success

* prevent scroll collection view when index is out of bounds (#346)

* self explanatory (#347)

* Bugfix/mob 1573 mixpanel pg success  (#349)

* fix one click two click with user defaults

* prevent add-on addition nil

* bump version to 1.11.0

* update

* Refactor/mob 1608 danamon instruction (#350)

* add first two instruction

* make cell color grey depending index is even/odd

* reduce space on danamon online view controller between sub guide and header instruction label

* Refactor/mob 1609 indomaret post payment (#351)

* make indomaret view controller ui like android, extract to MIDPaymentIndomaretViewController

* resolve conflict between danamon online and indomaret refactoring

* update podpecs

* Development (#352)

* fixing with adding BNI_VA to plist

* update gopay and paymentlist

* update to 1.9.4

* update

* update BCA VA
update localized about BNI

* updaet vtclasshelper for language

* update

* update mdordercontroller

* update transaction id

* revert to payment normal

* update expire time

* update

* update paymentlist

* update

* update-> TNC bni point

* update

* update fix crash on promos

* update sandbox

* simulate otherVA

* update midtransorderviewcontorller

* update payment order

* bump version to 1.9.5

* update

* update kioson, indomaret

* update virtual account number -> payment code

* change wording when bin is not applicable

* update translation for wrong

* update development expiry date credit card

* update credit card helper

* update

* prepare for release 1.10.0

* bump version to 1.10.0

* update

* update

* update midtrans ui cell to get the promo badge

* update

* update

* update

* Feature/mob 1549 check bin update snap (#332)

* combine local son loading with snap api call

* use only api call for bin number update

* refine

* load local first at view didload for new creditcard view controller

* fix instalment available match bin number method

* update move to mainthread

* update

* update

* update

* move some BINs from bni to bni_debit_online (#334)

* extract and add merchant id from v2response, for mixpanel tracking (#335)

* Bugfix/mob 1549 fix check bin threading (#333)

* fix instalment view threading

* add weak self for configure installment threading

* add transaction id tracking (#339)

* add transaction id tracking

* fix transaction id and order id tracking

* prevent nil

* fix add entries

* fix order id

* fix lower case track event name

* add enabled payments as default parameters for tracking manager (#337)

* add enabled payments as default parameters for tracking manager

* change tracking prefix

* fix lower case without underscore

* Feature/mob 1573 track 1click2click (#341)

* add track event 1 click 2 click additional parameters

* fix 1 click 2 click token available tracking

* fix code convention format

* Feature/mob 1578 tracking installment (#342)

* add installment available and required on tracking manager

* fix installment tracking

* fix installment tracking on load

* add installment tracking on did load for saved card

* fix lower case

* remove this as we no longer use user defaults to store installment data, instead we send it directly on view did load (#343)

* update

* put ui modification code on resetInstallmentIndex to main thread, (#344)

* put ui modification code on resetInstallmentIndex to main thread,
add additional data properly for payment status success

* use strong self

* update

* update

* Feature/mob 1573 add missing properties 1click 2click (#345)

* add missing 1 click 2 click properties for mixpanel tracking on pg success

* add missing installment properties on pg success

* prevent scroll collection view when index is out of bounds (#346)

* self explanatory (#347)

* Bugfix/mob 1573 mixpanel pg success  (#349)

* fix one click two click with user defaults

* prevent add-on addition nil

* bump version to 1.11.0

* update

* Refactor/mob 1608 danamon instruction (#350)

* add first two instruction

* make cell color grey depending index is even/odd

* reduce space on danamon online view controller between sub guide and header instruction label

* Refactor/mob 1609 indomaret post payment (#351)

* make indomaret view controller ui like android, extract to MIDPaymentIndomaretViewController

* resolve conflict between danamon online and indomaret refactoring

* update podpecs

* Development (#364)

* update

* update

* update

* update fix object data on saved card

* update

* add 5 minute expiry for cc token (#357)

* update reduce gross amount

* update promo velocity error

* decreased gross amount price to 2k (#359)

* update

* Feature/mob 1632 add custom field (#361)

* one custom field

* add multiple input type option

* add new kind for mdalertviewcontroller

* link mdoptionmanager custom field value with the ones for demo merchant client request

* change total amount to 10k then display bank name and logo on saved card view (#360)

* fix nil value checking for custom field (#362)

* update order_id

* update order-id

* fix setting midtrans transaction expire time according to md option (#363)

* update

* update constant and bump version to 1.12.1

* add icon & guide file

* create akulaku payment object

* impl akulaku in corekit

* impl akulaku in corekit

* impl akulaku in uikit

* update pbxproj

* update payment list

* update client key

* Feature/fix some issues (#385)

* add icon for ipad

* fix spelling

* update Info.plist

* update podspec and doc for integrating akulaku
  • Loading branch information
jukiginanjar authored Oct 26, 2018
1 parent c9a76dd commit 414be5a
Show file tree
Hide file tree
Showing 100 changed files with 5,839 additions and 4,716 deletions.
147 changes: 147 additions & 0 deletions MidtransCoreKit/MidtransCoreKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions MidtransCoreKit/MidtransCoreKit/MidtransConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "MidtransEnvironment.h"
#import "MidtransHelper.h"

#define CONFIG ((MidtransConfig *)[MidtransConfig shared])

Expand Down Expand Up @@ -41,6 +42,8 @@
@property (nonatomic) NSArray *customPaymentChannels;
@property (nonatomic) NSDictionary *customFreeText;

@property (nonatomic) MidtransCurrency currency;

/**
Container for data that will be sent to the Merchant Server. The common use-case for this data is to identify client to the Merchant Server. If this variable is set to non-nil, then every request to the Merchant Server will contain this data in its HTTP request header.
Expand Down
2 changes: 1 addition & 1 deletion MidtransCoreKit/MidtransCoreKit/MidtransConstant.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static NSString * const MIDTRANS_PAYMENT_BCA_KLIKPAY = @"bca_klikpay";
static NSString * const MIDTRANS_PAYMENT_KLIK_BCA = @"bca_klikbca";
static NSString * const MIDTRANS_PAYMENT_GOPAY = @"gopay";
static NSString * const MIDTRANS_PAYMENT_INDOMARET = @"indomaret";
static NSString * const MIDTRANS_PAYMENT_AKULAKU = @"akulaku";
static NSString * const MIDTRANS_PAYMENT_CIMB_CLICKS = @"cimb_clicks";
static NSString * const MIDTRANS_PAYMENT_DANAMON_ONLINE = @"danamon_online";
static NSString * const MIDTRANS_PAYMENT_CSTORE = @"cstore";
Expand Down Expand Up @@ -180,7 +181,6 @@ static NSString *const MIDTRANS_UIKIT_TRACKING_SELECT_PAYMENT_TYPE = @"Payment
//static NSString *const MIDTRANS_CORE_CREDIT_CARD_SCANNER_OUTPUT_EXPIRED_YEAR = @"credit_card_result_scan_expired_year";
//static NSString *const MIDTRANS_CORE_CREDIT_CARD_SCANNER_OUTPUT_EXPIRED_MONTH = @"credit_card_result_scan_expired_month";


static NSInteger const MIDTRANS_ERROR_CODE_3DSECURE = -30;
static NSInteger const MIDTRANS_ERROR_CODE_CANCELED_WEBPAYMENT = -31;

Expand Down
1 change: 1 addition & 0 deletions MidtransCoreKit/MidtransCoreKit/MidtransCoreKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ FOUNDATION_EXPORT const unsigned char MidtransCoreKitVersionString[];
#import "MidtransCreditCardHelper.h"
#import "MidtransMandiriClickpayHelper.h"
#import "MidtransPaymentEpayBRI.h"
#import "MidtransPaymentAkulaku.h"
#import "MidtransPaymentKiosOn.h"
#import "MidtransPaymentListModel.h"
#import "MidtransVirtualAccountModel.h"
Expand Down
14 changes: 13 additions & 1 deletion MidtransCoreKit/MidtransCoreKit/MidtransHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,28 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, MidtransCurrency) {
MidtransCurrencyIDR,
MidtransCurrencySGD
};

extern NSString *const MidtransMaskedCardsUpdated;

@interface MidtransHelper : NSObject
+ (id)nullifyIfNil:(id)object;
+ (NSBundle*)coreBundle;
+ (NSString *)stringFromCurrency:(MidtransCurrency)currency;
+ (MidtransCurrency)currencyFromString:(NSString *)string;
@end

@interface NSString (random)
+ (NSString *)randomWithLength:(NSUInteger)length;
@end

@interface NSNumber (format)
- (NSString *)roundingWithoutCurrency;
@end

@interface UIApplication (utilities)
+ (UIViewController *)rootViewController;
@end
Expand All @@ -28,11 +39,12 @@ extern NSString *const MidtransMaskedCardsUpdated;
- (id)objectThenDeleteForKey:(NSString *)key;
@end


@interface NSObject (utilities)
+ (NSNumberFormatter *)indonesianCurrencyFormatter;
+ (NSDateFormatter *)dateFormatterWithIdentifier:(NSString *)identifier;
+ (NSNumberFormatter *)multiCurrencyFormatter:(MidtransCurrency)currency;
@end

//
//@interface NSDictionary (SafeObject)
//- (id)safeObjectForKey:(id)key;
Expand Down
62 changes: 58 additions & 4 deletions MidtransCoreKit/MidtransCoreKit/MidtransHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
//

#import "MidtransHelper.h"
#import "MidtransConfig.h"

NSString *const MIdtransMaskedCardsUpdated = @"vt_masked_cards_updated";

NSString *const MIDTRANS_CORE_CURRENCY_IDR = @"IDR";
NSString *const MIDTRANS_CORE_CURRENCY_SGD = @"SGD";

@implementation MidtransHelper

Expand All @@ -36,6 +38,32 @@ + (NSBundle*)coreBundle {
});
return kitBundle;
}
+ (NSString *)stringFromCurrency:(MidtransCurrency)currency {
switch (currency) {
case MidtransCurrencyIDR:
return MIDTRANS_CORE_CURRENCY_IDR;
break;
case MidtransCurrencySGD:
return MIDTRANS_CORE_CURRENCY_SGD;
break;

default:
return MIDTRANS_CORE_CURRENCY_IDR;
break;
}
}
+ (MidtransCurrency)currencyFromString:(NSString *)string {
NSString *uppercaseString = string.uppercaseString;
if ([uppercaseString.uppercaseString isEqualToString:MIDTRANS_CORE_CURRENCY_SGD]) {
return MidtransCurrencySGD;
}
else if ([uppercaseString isEqualToString:MIDTRANS_CORE_CURRENCY_IDR]) {
return MidtransCurrencyIDR;
}
else {
return MidtransCurrencyIDR;
}
}

@end

Expand All @@ -53,6 +81,16 @@ + (NSString *)randomWithLength:(NSUInteger)length {

@end

@implementation NSNumber (format)

- (NSString *)roundingWithoutCurrency {
NSNumberFormatter *currencyFormatter = [NSNumberFormatter multiCurrencyFormatter:CONFIG.currency];
currencyFormatter.numberStyle = NSNumberFormatterNoStyle;
return [currencyFormatter stringFromNumber:self];
}

@end

@implementation UIApplication (Utils)

+ (UIViewController *)rootViewController {
Expand Down Expand Up @@ -115,9 +153,6 @@ + (NSNumberFormatter *)indonesianCurrencyFormatter {

if (currentFormatter == nil) {
currentFormatter = [NSNumberFormatter new];
currentFormatter.numberStyle = NSNumberFormatterDecimalStyle;
currentFormatter.groupingSeparator = @",";
currentFormatter.decimalSeparator = @".";
[dictionary setObject:currentFormatter forKey:identifier];
}

Expand All @@ -133,5 +168,24 @@ + (NSDateFormatter *)dateFormatterWithIdentifier:(NSString *)identifier {
}
return currentFormatter;
}

+ (NSNumberFormatter *)multiCurrencyFormatter:(MidtransCurrency)currency {
NSNumberFormatter *currencyFormatter = [MidtransHelper indonesianCurrencyFormatter];
currencyFormatter.paddingPosition = NSNumberFormatterPadAfterPrefix;
if (currency == MidtransCurrencySGD) {
currencyFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_SG"];
currencyFormatter.numberStyle = NSNumberFormatterCurrencyISOCodeStyle;
currencyFormatter.minimumFractionDigits = 2;
currencyFormatter.roundingMode = NSNumberFormatterRoundHalfEven;
}
else {
// by default set to indonesian
currencyFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"id_ID"];
currencyFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
currencyFormatter.minimumFractionDigits = 0;
currencyFormatter.roundingMode = NSNumberFormatterRoundDown;
}
return currencyFormatter;
}
@end

13 changes: 13 additions & 0 deletions MidtransCoreKit/MidtransCoreKit/MidtransItemDetail.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "MidtransItemDetail.h"
#import "MidtransHelper.h"
#import "MidtransConfig.h"

@implementation NSArray (VTITemDetail)

Expand Down Expand Up @@ -44,6 +45,18 @@ - (instancetype)initWithItemID:(NSString *)itemID
}

- (NSDictionary *)dictionaryValue {
switch ([CONFIG currency]) {
case MidtransCurrencyIDR:
_price = [NSNumber numberWithInteger:_price.integerValue];
break;
case MidtransCurrencySGD:
_price = [NSNumber numberWithDouble:_price.doubleValue];
break;

default:
_price = [NSNumber numberWithInteger:_price.integerValue];
break;
}
return @{@"id":[MidtransHelper nullifyIfNil:_itemId],
@"price":[MidtransHelper nullifyIfNil:_price],
@"quantity":[MidtransHelper nullifyIfNil:_quantity],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "MidtransMandiriClickpayHelper.h"
#import "MidtransHelper.h"

@implementation MidtransMandiriClickpayHelper

Expand All @@ -25,7 +26,7 @@ + (NSString *_Nonnull)generateInput1FromCardNumber:(NSString *_Nonnull)cardNumbe
}

+ (NSString *_Nonnull)generateInput2FromGrossAmount:(NSNumber *_Nonnull)grossAmount {
return [grossAmount stringValue];
return [grossAmount roundingWithoutCurrency];
}

+ (NSString *_Nonnull)generateInput3 {
Expand Down
2 changes: 1 addition & 1 deletion MidtransCoreKit/MidtransCoreKit/MidtransMerchantClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ - (void)requestTransacationWithCurrentToken:(NSString *_Nonnull)token
countryCode:paymentRequestV2.customerDetails.billingAddress.countryCode];


NSNumber *amount = [NSNumber numberWithInteger:[paymentRequestV2.transactionDetails.grossAmount integerValue]];
NSNumber *amount = [NSNumber numberWithDouble:[paymentRequestV2.transactionDetails.grossAmount doubleValue]];
MidtransTransactionDetails *reConstructTransactionDetail = [[MidtransTransactionDetails alloc] initWithOrderID:paymentRequestV2.transactionDetails.orderId
andGrossAmount:amount];

Expand Down
18 changes: 18 additions & 0 deletions MidtransCoreKit/MidtransCoreKit/MidtransPaymentAkulaku.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// MidtransPaymentAkulaku.h
// MidtransCoreKit
//
// Created by Nanang Rafsanjani on 23/10/18.
// Copyright © 2018 Midtrans. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "MidtransPaymentDetails.h"

NS_ASSUME_NONNULL_BEGIN

@interface MidtransPaymentAkulaku : NSObject <MidtransPaymentDetails>

@end

NS_ASSUME_NONNULL_END
19 changes: 19 additions & 0 deletions MidtransCoreKit/MidtransCoreKit/MidtransPaymentAkulaku.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// MidtransPaymentAkulaku.m
// MidtransCoreKit
//
// Created by Nanang Rafsanjani on 23/10/18.
// Copyright © 2018 Midtrans. All rights reserved.
//

#import "MidtransPaymentAkulaku.h"
#import "MidtransHelper.h"
#import "MidtransConstant.h"

@implementation MidtransPaymentAkulaku

- (NSDictionary *)dictionaryValue {
return @{@"payment_type":MIDTRANS_PAYMENT_AKULAKU};
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
//

#import <Foundation/Foundation.h>


#import "MidtransHelper.h"

@interface MidtransPaymentRequestV2TransactionDetails : NSObject <NSCoding, NSCopying>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@

#import "MidtransPaymentRequestV2TransactionDetails.h"


NSString *const kMidtransPaymentRequestV2TransactionDetailsOrderId = @"order_id";
NSString *const kMidtransPaymentRequestV2TransactionDetailsGrossAmount = @"gross_amount";


@interface MidtransPaymentRequestV2TransactionDetails ()

- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
Expand All @@ -36,9 +34,9 @@ - (instancetype)initWithDictionary:(NSDictionary *)dict
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if (self && [dict isKindOfClass:[NSDictionary class]]) {
self.orderId = [self objectOrNilForKey:kMidtransPaymentRequestV2TransactionDetailsOrderId fromDictionary:dict];
self.grossAmount = [self objectOrNilForKey:kMidtransPaymentRequestV2TransactionDetailsGrossAmount fromDictionary:dict];

self.orderId = [self objectOrNilForKey:kMidtransPaymentRequestV2TransactionDetailsOrderId fromDictionary:dict];
self.grossAmount = [self objectOrNilForKey:kMidtransPaymentRequestV2TransactionDetailsGrossAmount fromDictionary:dict];
}

return self;
Expand All @@ -50,7 +48,7 @@ - (NSDictionary *)dictionaryRepresentation
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.orderId forKey:kMidtransPaymentRequestV2TransactionDetailsOrderId];
[mutableDict setValue:self.grossAmount forKey:kMidtransPaymentRequestV2TransactionDetailsGrossAmount];

return [NSDictionary dictionaryWithDictionary:mutableDict];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ - (void)viewDidLoad {
if ([self.paymentIdentifier isEqualToString:MIDTRANS_PAYMENT_BRI_EPAY]) {
self.title = @"BRI E-Pay";
}
else if ([self.paymentIdentifier isEqualToString:MIDTRANS_PAYMENT_AKULAKU]) {
self.title = @"Akulaku";
}
else if ([self.paymentIdentifier isEqualToString:MIDTRANS_PAYMENT_BCA_KLIKPAY]) {
self.title = @"BCA KlikPay";
}
Expand Down Expand Up @@ -82,10 +85,11 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {

- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSString *requestURL = webView.request.URL.absoluteString;

if (([self.paymentIdentifier isEqualToString:MIDTRANS_PAYMENT_CIMB_CLICKS] && [requestURL containsString:@"cimb-clicks/response"]) ||
([self.paymentIdentifier isEqualToString:MIDTRANS_PAYMENT_BCA_KLIKPAY] && [requestURL containsString:@"id="]) ||
([self.paymentIdentifier isEqualToString:MIDTRANS_PAYMENT_MANDIRI_ECASH] && [requestURL containsString:@"notify"]) ||
([self.paymentIdentifier isEqualToString:MIDTRANS_PAYMENT_AKULAKU] && [requestURL containsString:@"akulaku/callback"]) ||
([self.paymentIdentifier isEqualToString:MIDTRANS_PAYMENT_BRI_EPAY] && [requestURL containsString:@"briPayment"])) {

if ([self.delegate respondsToSelector:@selector(webPaymentController_transactionPending:)]) {
Expand Down
17 changes: 16 additions & 1 deletion MidtransCoreKit/MidtransCoreKit/MidtransTokenizeRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,23 @@ - (instancetype)initWithTwoClickToken:(NSString *)token

- (NSDictionary *)dictionaryValue {
NSMutableDictionary *result = [NSMutableDictionary new];
switch ([CONFIG currency]) {
case MidtransCurrencyIDR:
self.grossAmount = [NSNumber numberWithInteger:self.grossAmount.integerValue];
break;
case MidtransCurrencySGD:
self.grossAmount = [NSNumber numberWithDouble:self.grossAmount.doubleValue];
break;
default:
self.grossAmount = [NSNumber numberWithInteger:self.grossAmount.integerValue];
break;
}
switch (self.featureType) {
case MTCreditCardPaymentTypeTwoclick: {
[result setDictionary:@{@"client_key":[CONFIG clientKey],
@"secure":self.secure ? @"true":@"false",
@"gross_amount":[MidtransHelper nullifyIfNil:self.grossAmount],
@"currency":[MidtransHelper stringFromCurrency:[CONFIG currency]],
@"two_click":@"true",
@"token_id":[MidtransHelper nullifyIfNil:self.token]}];
if (self.cvv) {
Expand All @@ -97,7 +109,9 @@ - (NSDictionary *)dictionaryValue {
@"card_number":self.creditCard.number,
@"card_type":[MidtransCreditCardHelper nameFromString: self.creditCard.number],
@"secure":self.secure ? @"true":@"false",
@"gross_amount":[MidtransHelper nullifyIfNil:self.grossAmount]}];
@"gross_amount":[MidtransHelper nullifyIfNil:self.grossAmount],
@"currency":[MidtransHelper stringFromCurrency:[CONFIG currency]]
}];
if (self.creditCard.expiryYear) {
[result setObject:self.creditCard.expiryYear forKey:@"card_exp_year"];
}
Expand All @@ -114,6 +128,7 @@ - (NSDictionary *)dictionaryValue {
@"card_type":[MidtransCreditCardHelper nameFromString: self.creditCard.number],
@"secure":self.secure ? @"true":@"false",
@"gross_amount":[MidtransHelper nullifyIfNil:self.grossAmount],
@"currency":[MidtransHelper stringFromCurrency:[CONFIG currency]],
@"installment":self.installment? @"true":@"false",
@"installment_term":[MidtransHelper nullifyIfNil:self.installmentTerm],
@"two_click":self.twoClick? @"true":@"false"}];
Expand Down
Loading

0 comments on commit 414be5a

Please sign in to comment.