Skip to content

Commit

Permalink
Rename RN native module's name to RNRazorpayCheckout
Browse files Browse the repository at this point in the history
  • Loading branch information
philly25 committed Oct 9, 2020
1 parent 22a2da4 commit ea490ff
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion RazorpayCheckout.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RazorpayCheckout {
rejectFn(data);
removeSubscriptions();
});
NativeModules.RazorpayCheckout.open(options);
NativeModules.RNRazorpayCheckout.open(options);
});
}
static onExternalWalletSelection(externalWalletCallback) {
Expand Down
8 changes: 4 additions & 4 deletions android/src/main/java/com/razorpay/rn/RazorpayModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public RazorpayModule(ReactApplicationContext reactContext) {

@Override
public String getName() {
return "RazorpayCheckout";
return "RNRazorpayCheckout";
}

@ReactMethod
Expand All @@ -65,7 +65,7 @@ public void open(ReadableMap options) {
currentActivity.startActivityForResult(intent, Checkout.RZP_REQUEST_CODE);
} catch (Exception e) {}
}

public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
onActivityResult(requestCode, resultCode, data);
}
Expand All @@ -85,7 +85,7 @@ private void sendEvent(String eventName, WritableMap params) {

@Override
public void onPaymentSuccess(String razorpayPaymentId, PaymentData paymentData) {
sendEvent("Razorpay::PAYMENT_SUCCESS", Utils.jsonToWritableMap(paymentData.getData()));
sendEvent("Razorpay::PAYMENT_SUCCESS", Utils.jsonToWritableMap(paymentData.getData()));
}

@Override
Expand All @@ -100,7 +100,7 @@ public void onPaymentError(int code, String description, PaymentData paymentData
sendEvent("Razorpay::PAYMENT_ERROR", Utils.jsonToWritableMap(paymentDataJson));
}

@Override
@Override
public void onExternalWalletSelected(String walletName, PaymentData paymentData){
sendEvent("Razorpay::EXTERNAL_WALLET_SELECTED", Utils.jsonToWritableMap(paymentData.getData()));
}
Expand Down
2 changes: 1 addition & 1 deletion ios/RazorpayCheckout.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

#import "RCTBridgeModule.h"

@interface RazorpayCheckout : NSObject <RCTBridgeModule>
@interface RNRazorpayCheckout : NSObject <RCTBridgeModule>

@end
8 changes: 4 additions & 4 deletions ios/RazorpayCheckout.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@

typedef RazorpayCheckout Razorpay;

@interface RazorpayCheckout () <RazorpayPaymentCompletionProtocolWithData,
@interface RNRazorpayCheckout () <RazorpayPaymentCompletionProtocolWithData,
ExternalWalletSelectionProtocol>

@end

@implementation RazorpayCheckout
@implementation RNRazorpayCheckout

RCT_EXPORT_MODULE()

RCT_EXPORT_METHOD(open : (NSDictionary *)options) {

NSString *keyID = (NSString *)[options objectForKey:@"key"];
dispatch_sync(dispatch_get_main_queue(), ^{
Razorpay *razorpay = [Razorpay initWithKey:keyID
andDelegateWithData:self];
[razorpay setExternalWalletSelectionDelegate:self];

NSMutableDictionary * tempOptions = [[NSMutableDictionary alloc] initWithDictionary:options];
// tempOptions[@"integration_version"] = [self findReactNativeVersion];
tempOptions[@"integration"] = @"react-native";
Expand Down

0 comments on commit ea490ff

Please sign in to comment.