Skip to content

Commit

Permalink
updated Razorpay typedef and events.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nautiyalsachin authored Apr 3, 2020
1 parent bf5504b commit c08feb9
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions ios/RazorpayCheckout.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
#import "RazorpayCheckout.h"
#import "RazorpayEventEmitter.h"

//#import <Razorpay/Razorpay.h>
#import <Razorpay/Razorpay-Swift.h>

typedef RazorpayCheckout Razorpay;

@interface RazorpayCheckout () <RazorpayPaymentCompletionProtocolWithData,
ExternalWalletSelectionProtocol>

Expand All @@ -29,9 +30,52 @@ @implementation RazorpayCheckout
andDelegateWithData:self];
[razorpay setExternalWalletSelectionDelegate:self];

[razorpay open:options];
NSMutableDictionary * tempOptions = [[NSMutableDictionary alloc] initWithDictionary:options];
// tempOptions[@"integration_version"] = [self findReactNativeVersion];
tempOptions[@"integration"] = @"react-native";
tempOptions[@"FRAMEWORK"] = @"react-native";
[razorpay open:tempOptions];
});
}

/*
- (NSString *)findReactNativeVersion {
static dispatch_once_t onceToken;
static NSString *BSGReactNativeVersion = nil;
dispatch_once(&onceToken, ^{
#ifdef RCT_REACT_NATIVE_VERSION
// for react-native versions prior 0.55
// see https://github.com/react-native-community/releases/blob/451f8e7fa53f80daec9c2381c7984bee73efa51d/CHANGELOG.md#ios-specific-additions
NSDictionary *versionMap = RCT_REACT_NATIVE_VERSION;
#else
NSDictionary *versionMap = RCTGetReactNativeVersion();
#endif
NSNumber *major = versionMap[@"major"];
NSNumber *minor = versionMap[@"minor"];
NSNumber *patch = versionMap[@"patch"];
NSString *prerelease = versionMap[@"prerelease"];
NSMutableString *versionString = [NSMutableString new];
if (![major isEqual:[NSNull null]]) {
[versionString appendString:[major stringValue]];
[versionString appendString:@"."];
}
if (![minor isEqual:[NSNull null]]) {
[versionString appendString:[minor stringValue]];
[versionString appendString:@"."];
}
if (![patch isEqual:[NSNull null]]) {
[versionString appendString:[patch stringValue]];
}
if (![prerelease isEqual:[NSNull null]]) {
[versionString appendString:@"-"];
[versionString appendString:prerelease];
}
BSGReactNativeVersion = [NSString stringWithString:versionString];
});
return BSGReactNativeVersion;
}
*/

- (void)onPaymentSuccess:(nonnull NSString *)payment_id
andData:(nullable NSDictionary *)response {
Expand Down

5 comments on commit c08feb9

@uday5162
Copy link

@uday5162 uday5162 commented on c08feb9 Apr 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2020-04-06 at 6 00 29 PM

@Nautiyalsachin this update is failing here

@Nautiyalsachin
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uday5162 : Try replacing the whole line with @compatibility_alias Razorpay RazorpayCheckout;

@TarunNarula
Copy link

@TarunNarula TarunNarula commented on c08feb9 Apr 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2020-04-29 at 3 05 38 PM
@Nautiyalsachin Adding @compatibility_alias Razorpay RazorpayCheckout; failing as well.

@Nautiyalsachin
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you share a sample app with me ? So that I can debug this in more detail. Thanks!

@TarunNarula
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was actually the problem with the Xcode version, this version does not work with Xcode 9.4.1 because it does not support swift 5.2, then I updated the Xcode to 11.4.1 which support swift 5.2 and it worked.

Thanks :)

Please sign in to comment.