在 RazorPay-Cordova 插件中获取弃用的方法和警告
Getting Deprecated methods and warning in RazorPay-Cordova Plugin
我正在尝试使用 ionic 框架构建 ios 应用程序。我正在使用 razorypay(支付网关)接受付款。
Razorpay 可以在浏览器中正常工作,但是当我尝试使用 ionic cordova build ios
构建它时
在浏览器上正常工作。
任务完成
- ionic cordova 平台添加 ios
- ionic cordova build ios(收到有关弃用方法的警告)
- 在 Main.m 文件中添加了 RazorPay 的导入指令。
- 已在浏览器上测试。
import { Component } from '@angular/core';
import { Router } from '@angular/router';
declare var RazorpayCheckout: any;
@Component({
selector: 'app-razorpay',
templateUrl: './razorpay.page.html',
styleUrls: ['./razorpay.page.scss'],
})
export class RazorpayPage {
amount: number;
currency = 'INR';
razorKey = 'somekeyoverhere';
paymentAmount = this.amount;
constructor(public router: Router) { }
payWithRazor() {
const options = {
description: 'Credits towards consultation',
currency: this.currency, // your 3 letter currency code
key: this.razorKey, // your Key Id from Razorpay dashboard
amount: this.paymentAmount, // Payment amount in smallest denomiation e.g. cents for USD
name: 'Techmave Solutions',
prefill: {
email: 'yash@techmavesolution.com',
contact: '9561555479',
name: 'Enappd'
},
theme: {
color: '#F37254'
},
modal: {
ondismiss: () => {
alert('dismissed');
this.goToResponseError();
}
}
};
const successCallback = paymentId => {
this.goToResponseSuccess(paymentId);
};
const cancelCallback = error => {
// alert(error.description + ' (Error ' + error.code + ')');
// this.goToResponseError(error.code);
};
RazorpayCheckout.open(options, successCallback, cancelCallback);
}
goToResponseSuccess(paymentId) {
this.router.navigate(['/response', paymentId]);
}
goToResponseError() {
this.router.navigate(['/response']);
}
}
我收到如下所示的警告。
/Users/yashtalegaonkar/Desktop/ionic-code/myapp/platforms/ios/MyApp/Plugins/com.razorpay.cordova/Razorpay/Main.m:28:1: warning:
implementing deprecated method [-Wdeprecated-implementations]
- (void)onPaymentError:(int)code
^
In module '
Razorpay
' imported from
/Users/yashtalegaonkar/Desktop/ionic-code/myapp/platforms/ios/MyApp/Plugins/com.razorpay.cordova/Razorpay/Main.h
:
2
:
MyApp/Plugins/com.razorpay.cordova/Razorpay.framework/Headers/Razorpay-Swift.h
:
275
:
1
:
note: method
'onPaymentError:description:andData:'
declared
here
- (void)onPaymentError:(int32_t)code description:(NSString * _Nonnull)str andData:(NSDictionary * _Nullable)response SW...
^
/Users/yashtalegaonkar/Desktop/ionic-code/myapp/platforms/ios/MyApp/Plugins/com.razorpay.cordova/Razorpay/Main.m:10:17: warning:
class 'Main' does not conform to protocol 'ExternalWalletSelectionProtocol' [-Wprotocol]
@implementation Main
^
/Users/yashtalegaonkar/Desktop/ionic-code/myapp/platforms/ios/MyApp/Plugins/com.razorpay.cordova/Razorpay/Main.m:10:17: note:
add stubs for missing protocol requirements
@implementation Main
^
2 warnings generated.
警告是因为 cordova 和 razorpay 中的代码已弃用,因此它会输出警告。
警告不会成为 运行 应用程序或部署它 的问题,因为我已经对其进行了研究。 Cordova 有多个已弃用的方法,因此它可以帮助我们在较低版本的 iOS (9^) 上 运行。
我遵循的步骤
Enable Bitecode
Embed Libraries of Cordova
Embed Razorpay Framework
我正在尝试使用 ionic 框架构建 ios 应用程序。我正在使用 razorypay(支付网关)接受付款。
Razorpay 可以在浏览器中正常工作,但是当我尝试使用 ionic cordova build ios
在浏览器上正常工作。
任务完成
- ionic cordova 平台添加 ios
- ionic cordova build ios(收到有关弃用方法的警告)
- 在 Main.m 文件中添加了 RazorPay 的导入指令。
- 已在浏览器上测试。
import { Component } from '@angular/core';
import { Router } from '@angular/router';
declare var RazorpayCheckout: any;
@Component({
selector: 'app-razorpay',
templateUrl: './razorpay.page.html',
styleUrls: ['./razorpay.page.scss'],
})
export class RazorpayPage {
amount: number;
currency = 'INR';
razorKey = 'somekeyoverhere';
paymentAmount = this.amount;
constructor(public router: Router) { }
payWithRazor() {
const options = {
description: 'Credits towards consultation',
currency: this.currency, // your 3 letter currency code
key: this.razorKey, // your Key Id from Razorpay dashboard
amount: this.paymentAmount, // Payment amount in smallest denomiation e.g. cents for USD
name: 'Techmave Solutions',
prefill: {
email: 'yash@techmavesolution.com',
contact: '9561555479',
name: 'Enappd'
},
theme: {
color: '#F37254'
},
modal: {
ondismiss: () => {
alert('dismissed');
this.goToResponseError();
}
}
};
const successCallback = paymentId => {
this.goToResponseSuccess(paymentId);
};
const cancelCallback = error => {
// alert(error.description + ' (Error ' + error.code + ')');
// this.goToResponseError(error.code);
};
RazorpayCheckout.open(options, successCallback, cancelCallback);
}
goToResponseSuccess(paymentId) {
this.router.navigate(['/response', paymentId]);
}
goToResponseError() {
this.router.navigate(['/response']);
}
}
我收到如下所示的警告。
/Users/yashtalegaonkar/Desktop/ionic-code/myapp/platforms/ios/MyApp/Plugins/com.razorpay.cordova/Razorpay/Main.m:28:1: warning:
implementing deprecated method [-Wdeprecated-implementations]
- (void)onPaymentError:(int)code
^
In module '
Razorpay
' imported from
/Users/yashtalegaonkar/Desktop/ionic-code/myapp/platforms/ios/MyApp/Plugins/com.razorpay.cordova/Razorpay/Main.h
:
2
:
MyApp/Plugins/com.razorpay.cordova/Razorpay.framework/Headers/Razorpay-Swift.h
:
275
:
1
:
note: method
'onPaymentError:description:andData:'
declared
here
- (void)onPaymentError:(int32_t)code description:(NSString * _Nonnull)str andData:(NSDictionary * _Nullable)response SW...
^
/Users/yashtalegaonkar/Desktop/ionic-code/myapp/platforms/ios/MyApp/Plugins/com.razorpay.cordova/Razorpay/Main.m:10:17: warning:
class 'Main' does not conform to protocol 'ExternalWalletSelectionProtocol' [-Wprotocol]
@implementation Main
^
/Users/yashtalegaonkar/Desktop/ionic-code/myapp/platforms/ios/MyApp/Plugins/com.razorpay.cordova/Razorpay/Main.m:10:17: note:
add stubs for missing protocol requirements
@implementation Main
^
2 warnings generated.
警告是因为 cordova 和 razorpay 中的代码已弃用,因此它会输出警告。
警告不会成为 运行 应用程序或部署它 的问题,因为我已经对其进行了研究。 Cordova 有多个已弃用的方法,因此它可以帮助我们在较低版本的 iOS (9^) 上 运行。
我遵循的步骤
Enable Bitecode
Embed Libraries of Cordova
Embed Razorpay Framework