Razorpay 的付款对象没有任何字段
Razorpay's Payment object do not have any fields
我刚刚开始阅读 Razorpay
文档。根据他们的文档,他们的 Payment
对象具有结构
{
"id": "pay_29QQoUBi66xm2f",
"entity": "payment",
"amount": 5000,
"currency": "INR",
"status": "captured",
"method": "card",
"description": "Payment for adidas shoes",
"amount_refunded": 0,
"refund_status": null,
"email": "test@razorpay.com",
"contact": "9364591752",
"notes": {},
"fee": 1145,
"tax": 145,
"error_code": null,
"error_description": null,
"created_at": 1400826750
}
但是当我导入他们的对象 import com.razorpay.Payment
并在我的代码编辑器中单击那个 class 时,我发现没有字段。
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.razorpay;
import org.json.JSONObject;
public class Payment extends Entity {
public Payment(JSONObject jsonObject) {
super(jsonObject);
}
}
没有字段和吸气剂。那么如何将 Payment
对象内容映射到我的自定义 class?我的理解有误吗?
谢谢。
您使用 get()
方法(在 Entity
class 中定义)来获取您想要的值。见 documentation of Razorpay Java SDK:
Payment payment = razorpayClient.Payments.fetch("payment_id");
// The the Entity.get("attribute_key") method has flexible return types depending on the attribute
int amount = payment.get("amount");
String id = payment.get("id");
Date createdAt = payment.get("created_at");
我刚刚开始阅读 Razorpay
文档。根据他们的文档,他们的 Payment
对象具有结构
{
"id": "pay_29QQoUBi66xm2f",
"entity": "payment",
"amount": 5000,
"currency": "INR",
"status": "captured",
"method": "card",
"description": "Payment for adidas shoes",
"amount_refunded": 0,
"refund_status": null,
"email": "test@razorpay.com",
"contact": "9364591752",
"notes": {},
"fee": 1145,
"tax": 145,
"error_code": null,
"error_description": null,
"created_at": 1400826750
}
但是当我导入他们的对象 import com.razorpay.Payment
并在我的代码编辑器中单击那个 class 时,我发现没有字段。
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.razorpay;
import org.json.JSONObject;
public class Payment extends Entity {
public Payment(JSONObject jsonObject) {
super(jsonObject);
}
}
没有字段和吸气剂。那么如何将 Payment
对象内容映射到我的自定义 class?我的理解有误吗?
谢谢。
您使用 get()
方法(在 Entity
class 中定义)来获取您想要的值。见 documentation of Razorpay Java SDK:
Payment payment = razorpayClient.Payments.fetch("payment_id"); // The the Entity.get("attribute_key") method has flexible return types depending on the attribute int amount = payment.get("amount"); String id = payment.get("id"); Date createdAt = payment.get("created_at");