feat: 接入微信小程序支付
This commit is contained in:
@@ -176,6 +176,18 @@ impl From<module_runtime::RuntimeProfileRechargeOrderCreateInput>
|
||||
}
|
||||
}
|
||||
|
||||
impl From<module_runtime::RuntimeProfileRechargeOrderPaidInput>
|
||||
for RuntimeProfileRechargeOrderPaidInput
|
||||
{
|
||||
fn from(input: module_runtime::RuntimeProfileRechargeOrderPaidInput) -> Self {
|
||||
Self {
|
||||
order_id: input.order_id,
|
||||
paid_at_micros: input.paid_at_micros,
|
||||
provider_transaction_id: input.provider_transaction_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<module_runtime::RuntimeProfileFeedbackSubmissionInput>
|
||||
for RuntimeProfileFeedbackSubmissionInput
|
||||
{
|
||||
@@ -2217,6 +2229,7 @@ pub(crate) fn map_runtime_profile_recharge_order_snapshot(
|
||||
status: map_runtime_profile_recharge_order_status_back(snapshot.status),
|
||||
payment_channel: snapshot.payment_channel,
|
||||
paid_at_micros: snapshot.paid_at_micros,
|
||||
provider_transaction_id: snapshot.provider_transaction_id,
|
||||
created_at_micros: snapshot.created_at_micros,
|
||||
points_delta: snapshot.points_delta,
|
||||
membership_expires_at_micros: snapshot.membership_expires_at_micros,
|
||||
@@ -5026,9 +5039,21 @@ pub(crate) fn map_runtime_profile_recharge_order_status_back(
|
||||
value: crate::module_bindings::RuntimeProfileRechargeOrderStatus,
|
||||
) -> module_runtime::RuntimeProfileRechargeOrderStatus {
|
||||
match value {
|
||||
crate::module_bindings::RuntimeProfileRechargeOrderStatus::Pending => {
|
||||
module_runtime::RuntimeProfileRechargeOrderStatus::Pending
|
||||
}
|
||||
crate::module_bindings::RuntimeProfileRechargeOrderStatus::Paid => {
|
||||
module_runtime::RuntimeProfileRechargeOrderStatus::Paid
|
||||
}
|
||||
crate::module_bindings::RuntimeProfileRechargeOrderStatus::Failed => {
|
||||
module_runtime::RuntimeProfileRechargeOrderStatus::Failed
|
||||
}
|
||||
crate::module_bindings::RuntimeProfileRechargeOrderStatus::Closed => {
|
||||
module_runtime::RuntimeProfileRechargeOrderStatus::Closed
|
||||
}
|
||||
crate::module_bindings::RuntimeProfileRechargeOrderStatus::Refunded => {
|
||||
module_runtime::RuntimeProfileRechargeOrderStatus::Refunded
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
use super::runtime_profile_recharge_center_procedure_result_type::RuntimeProfileRechargeCenterProcedureResult;
|
||||
use super::runtime_profile_recharge_order_paid_input_type::RuntimeProfileRechargeOrderPaidInput;
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
struct MarkProfileRechargeOrderPaidAndReturnArgs {
|
||||
pub input: RuntimeProfileRechargeOrderPaidInput,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for MarkProfileRechargeOrderPaidAndReturnArgs {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
/// Extension trait for access to the procedure `mark_profile_recharge_order_paid_and_return`.
|
||||
///
|
||||
/// Implemented for [`super::RemoteProcedures`].
|
||||
pub trait mark_profile_recharge_order_paid_and_return {
|
||||
fn mark_profile_recharge_order_paid_and_return(
|
||||
&self,
|
||||
input: RuntimeProfileRechargeOrderPaidInput,
|
||||
) {
|
||||
self.mark_profile_recharge_order_paid_and_return_then(input, |_, _| {});
|
||||
}
|
||||
|
||||
fn mark_profile_recharge_order_paid_and_return_then(
|
||||
&self,
|
||||
input: RuntimeProfileRechargeOrderPaidInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileRechargeCenterProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
impl mark_profile_recharge_order_paid_and_return for super::RemoteProcedures {
|
||||
fn mark_profile_recharge_order_paid_and_return_then(
|
||||
&self,
|
||||
input: RuntimeProfileRechargeOrderPaidInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileRechargeCenterProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, RuntimeProfileRechargeCenterProcedureResult>(
|
||||
"mark_profile_recharge_order_paid_and_return",
|
||||
MarkProfileRechargeOrderPaidAndReturnArgs { input },
|
||||
__callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -367,6 +367,7 @@ pub mod list_puzzle_works_procedure;
|
||||
pub mod list_square_hole_works_procedure;
|
||||
pub mod list_visual_novel_runtime_history_procedure;
|
||||
pub mod list_visual_novel_works_procedure;
|
||||
pub mod mark_profile_recharge_order_paid_and_return_procedure;
|
||||
pub mod match_3_d_agent_message_finalize_input_type;
|
||||
pub mod match_3_d_agent_message_row_type;
|
||||
pub mod match_3_d_agent_message_submit_input_type;
|
||||
@@ -616,6 +617,7 @@ pub mod runtime_profile_recharge_center_get_input_type;
|
||||
pub mod runtime_profile_recharge_center_procedure_result_type;
|
||||
pub mod runtime_profile_recharge_center_snapshot_type;
|
||||
pub mod runtime_profile_recharge_order_create_input_type;
|
||||
pub mod runtime_profile_recharge_order_paid_input_type;
|
||||
pub mod runtime_profile_recharge_order_snapshot_type;
|
||||
pub mod runtime_profile_recharge_order_status_type;
|
||||
pub mod runtime_profile_recharge_product_kind_type;
|
||||
@@ -1177,6 +1179,7 @@ pub use list_puzzle_works_procedure::list_puzzle_works;
|
||||
pub use list_square_hole_works_procedure::list_square_hole_works;
|
||||
pub use list_visual_novel_runtime_history_procedure::list_visual_novel_runtime_history;
|
||||
pub use list_visual_novel_works_procedure::list_visual_novel_works;
|
||||
pub use mark_profile_recharge_order_paid_and_return_procedure::mark_profile_recharge_order_paid_and_return;
|
||||
pub use match_3_d_agent_message_finalize_input_type::Match3DAgentMessageFinalizeInput;
|
||||
pub use match_3_d_agent_message_row_type::Match3DAgentMessageRow;
|
||||
pub use match_3_d_agent_message_submit_input_type::Match3DAgentMessageSubmitInput;
|
||||
@@ -1426,6 +1429,7 @@ pub use runtime_profile_recharge_center_get_input_type::RuntimeProfileRechargeCe
|
||||
pub use runtime_profile_recharge_center_procedure_result_type::RuntimeProfileRechargeCenterProcedureResult;
|
||||
pub use runtime_profile_recharge_center_snapshot_type::RuntimeProfileRechargeCenterSnapshot;
|
||||
pub use runtime_profile_recharge_order_create_input_type::RuntimeProfileRechargeOrderCreateInput;
|
||||
pub use runtime_profile_recharge_order_paid_input_type::RuntimeProfileRechargeOrderPaidInput;
|
||||
pub use runtime_profile_recharge_order_snapshot_type::RuntimeProfileRechargeOrderSnapshot;
|
||||
pub use runtime_profile_recharge_order_status_type::RuntimeProfileRechargeOrderStatus;
|
||||
pub use runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind;
|
||||
|
||||
@@ -18,7 +18,8 @@ pub struct ProfileRechargeOrder {
|
||||
pub amount_cents: u64,
|
||||
pub status: RuntimeProfileRechargeOrderStatus,
|
||||
pub payment_channel: String,
|
||||
pub paid_at: __sdk::Timestamp,
|
||||
pub paid_at: Option<__sdk::Timestamp>,
|
||||
pub provider_transaction_id: Option<String>,
|
||||
pub created_at: __sdk::Timestamp,
|
||||
pub points_delta: i64,
|
||||
pub membership_expires_at: Option<__sdk::Timestamp>,
|
||||
@@ -41,7 +42,8 @@ pub struct ProfileRechargeOrderCols {
|
||||
pub status:
|
||||
__sdk::__query_builder::Col<ProfileRechargeOrder, RuntimeProfileRechargeOrderStatus>,
|
||||
pub payment_channel: __sdk::__query_builder::Col<ProfileRechargeOrder, String>,
|
||||
pub paid_at: __sdk::__query_builder::Col<ProfileRechargeOrder, __sdk::Timestamp>,
|
||||
pub paid_at: __sdk::__query_builder::Col<ProfileRechargeOrder, Option<__sdk::Timestamp>>,
|
||||
pub provider_transaction_id: __sdk::__query_builder::Col<ProfileRechargeOrder, Option<String>>,
|
||||
pub created_at: __sdk::__query_builder::Col<ProfileRechargeOrder, __sdk::Timestamp>,
|
||||
pub points_delta: __sdk::__query_builder::Col<ProfileRechargeOrder, i64>,
|
||||
pub membership_expires_at:
|
||||
@@ -61,6 +63,10 @@ impl __sdk::__query_builder::HasCols for ProfileRechargeOrder {
|
||||
status: __sdk::__query_builder::Col::new(table_name, "status"),
|
||||
payment_channel: __sdk::__query_builder::Col::new(table_name, "payment_channel"),
|
||||
paid_at: __sdk::__query_builder::Col::new(table_name, "paid_at"),
|
||||
provider_transaction_id: __sdk::__query_builder::Col::new(
|
||||
table_name,
|
||||
"provider_transaction_id",
|
||||
),
|
||||
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
|
||||
points_delta: __sdk::__query_builder::Col::new(table_name, "points_delta"),
|
||||
membership_expires_at: __sdk::__query_builder::Col::new(
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
|
||||
#[sats(crate = __lib)]
|
||||
pub struct RuntimeProfileRechargeOrderPaidInput {
|
||||
pub order_id: String,
|
||||
pub paid_at_micros: i64,
|
||||
pub provider_transaction_id: Option<String>,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for RuntimeProfileRechargeOrderPaidInput {
|
||||
type Module = super::RemoteModule;
|
||||
}
|
||||
@@ -18,7 +18,8 @@ pub struct RuntimeProfileRechargeOrderSnapshot {
|
||||
pub amount_cents: u64,
|
||||
pub status: RuntimeProfileRechargeOrderStatus,
|
||||
pub payment_channel: String,
|
||||
pub paid_at_micros: i64,
|
||||
pub paid_at_micros: Option<i64>,
|
||||
pub provider_transaction_id: Option<String>,
|
||||
pub created_at_micros: i64,
|
||||
pub points_delta: i64,
|
||||
pub membership_expires_at_micros: Option<i64>,
|
||||
|
||||
@@ -8,7 +8,15 @@ use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
#[sats(crate = __lib)]
|
||||
#[derive(Copy, Eq, Hash)]
|
||||
pub enum RuntimeProfileRechargeOrderStatus {
|
||||
Pending,
|
||||
|
||||
Paid,
|
||||
|
||||
Failed,
|
||||
|
||||
Closed,
|
||||
|
||||
Refunded,
|
||||
}
|
||||
|
||||
impl __sdk::InModule for RuntimeProfileRechargeOrderStatus {
|
||||
|
||||
@@ -268,6 +268,42 @@ impl SpacetimeClient {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn mark_profile_recharge_order_paid(
|
||||
&self,
|
||||
order_id: String,
|
||||
paid_at_micros: i64,
|
||||
provider_transaction_id: Option<String>,
|
||||
) -> Result<
|
||||
(
|
||||
RuntimeProfileRechargeCenterRecord,
|
||||
RuntimeProfileRechargeOrderRecord,
|
||||
),
|
||||
SpacetimeClientError,
|
||||
> {
|
||||
let procedure_input = module_runtime::build_runtime_profile_recharge_order_paid_input(
|
||||
order_id,
|
||||
paid_at_micros,
|
||||
provider_transaction_id,
|
||||
)
|
||||
.map_err(SpacetimeClientError::validation_failed)?
|
||||
.into();
|
||||
|
||||
self.call_after_connect(move |connection, sender| {
|
||||
connection
|
||||
.procedures()
|
||||
.mark_profile_recharge_order_paid_and_return_then(
|
||||
procedure_input,
|
||||
move |_, result| {
|
||||
let mapped = result
|
||||
.map_err(SpacetimeClientError::from_sdk_error)
|
||||
.and_then(map_runtime_profile_recharge_order_procedure_result);
|
||||
send_once(&sender, mapped);
|
||||
},
|
||||
);
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_profile_feedback(
|
||||
&self,
|
||||
user_id: String,
|
||||
|
||||
Reference in New Issue
Block a user