标签: subscriptions

如何在 Woocommerce 订阅中设置下一次付款日期?

我想在创建初始(第一个)订单后更改活动订阅的下一个付款日期。

当前代码不起作用。为什么?我错过了什么?

//fires when new order payment is complete (NOT RENEWAL but original order!)
add_action('woocommerce_payment_complete', 'fm_upate_next_payment_datetime');

function fm_upate_next_payment_datetime ( $order_id ) {

if (WC_Subscriptions_Order::order_contains_subscription( $order_id ) == false) return;      
$subscription_key = WC_Subscriptions_Manager::get_subscription_key( $order_id, $product_id
= '');

 //hard code next payment date...(must be in future)
$next_payment = date( 'Y-m-d H:i:s', '2016-05-20 00:10:10' );

//set the new payment date  
WC_Subscriptions_Manager::set_next_payment_date( $subscription_key, $user_id = '', $next_payment );

}
Run Code Online (Sandbox Code Playgroud)

php wordpress subscriptions woocommerce

6
推荐指数
2
解决办法
7023
查看次数

GraphQL订阅:最大侦听器超出警告

我们使用GraphQL订阅和pubsub订阅帖子.

当超过10个订阅发生时,我们得到节点警告"MaxListenersExceededWarning:检测到可能的EventEmitter内存泄漏".

是否可以在pubsub类中引发最大侦听器?

pubsub类位于一个单独的模块中,如下所示:

import { PubSub } from 'graphql-subscriptions';

const pubsub = new PubSub();

export { pubsub };
Run Code Online (Sandbox Code Playgroud)

订阅服务器如下所示:

import { SubscriptionManager } from 'graphql-subscriptions';
import { createServer } from 'http';
import { SubscriptionServer } from 'subscriptions-transport-ws';

import { pubsub } from './subscriptions';
import executableSchema from './executableSchema';

const WS_PORT = 8080;

const websocketServer = createServer((request, response) => {
  response.writeHead(404);
  response.end();
});

websocketServer.listen(WS_PORT, () => console.log(
  `Websocket Server is now running on http://localhost:${WS_PORT}`
));

const subscriptionManager = new SubscriptionManager({
  schema: …
Run Code Online (Sandbox Code Playgroud)

subscriptions node.js graphql graphql-subscriptions

6
推荐指数
3
解决办法
1669
查看次数

每个 azure 帐户的订阅数量有限制吗?

我知道我们可以为每个 azure 帐户创建多个订阅。单个 windows azure 帐户中的订阅数量有限制吗?

limit subscriptions azure

5
推荐指数
1
解决办法
5070
查看次数

应用内订阅 - 应用程序的库存查询是否有限制?

我的应用程序每天可以发送的库存查询是否有限制?(通过调用 mHelper.queryInventoryAsync(mGotInventoryListener) )

\n\n

我想知道是否可以在每次应用程序启动时检查用户是否仍然拥有有效的订阅?或者也许我应该为更少的请求实现逻辑?

\n\n

我知道,由于应用内结算 v3 数据由 Google Play 服务本地缓存:\n http://developer.android.com/training/in-app-billing/purchase-iab-products.html#QueryPurchases

\n\n
\n

成功购买后,用户\xe2\x80\x99s 购买数据将由 Google Play\xe2\x80\x99s 应用内结算服务在本地\n 缓存。最好\n 经常查询应用内结算服务以了解用户\xe2\x80\x99s 的购买情况,\n 例如,每当应用程序启动或恢复时\n,以便用户\xe2\x80\x99s\n当前的应用内产品所有权信息始终反映在您的应用中。\n

\n
\n\n

但另一方面,通过 Google Play Android Developer API(配额)有 200k 请求限制:\n http://developer.android.com/google/play/billing/gp-purchase-status-api.html#using

\n\n

编辑:\n我不使用任何后端服务器。

\n

android subscriptions in-app-purchase in-app-billing

5
推荐指数
1
解决办法
1323
查看次数

无法注册订阅; CKError 0x19030580,"服务不可用"

每当我尝试注册订阅时,我都会收到错误:CKError 0x19030580: "Service Unavailable" (6/2022); server message = "refused to install an older schema (68f93710-7456-11e4-b13e-008cfac0c800) since we already have 693359e0-7456-11e4-8e42-008cfac03128"; uuid = 42F42F6B-98FB-4774-B735-271C1AEF07F1; container ID = "iCloud.com.*.*".当我尝试获取服务器上的所有订阅时,我什么也得不到.

为什么我收到CKError 0x19030580?为什么我无法检索订阅?我应该怎么解决它们?


码:

    NSPredicate *truePredicate = [NSPredicate predicateWithValue:YES];
    CKSubscription *itemSubscription = [[CKSubscription alloc] initWithRecordType:ItemAssetRecordType
                                                                        predicate:truePredicate
                                                                          options:CKSubscriptionOptionsFiresOnRecordCreation | CKSubscriptionOptionsFiresOnRecordUpdate];


    CKNotificationInfo *notification = [[CKNotificationInfo alloc] init];
    notification.shouldSendContentAvailable = YES;

    notification.alertLocalizationKey = @"New Item available.";
    notification.shouldBadge = NO;

    itemSubscription.notificationInfo = notification;

    [self.privateDatabase saveSubscription:itemSubscription completionHandler:^(CKSubscription *subscription, NSError *error) {
        if (error) {

        } else { …
Run Code Online (Sandbox Code Playgroud)

subscriptions ios8 cloudkit

5
推荐指数
1
解决办法
635
查看次数

iOS - 自动续订订阅到期

问题 1:

我已经阅读了有关订阅的 Apple 文档,但我仍然不确定是否可以从收据中获取自动续订订阅的到期日期,而无需联系 iOS 9 的 Apple 服务器?这有意义吗?

问题2

目前我正在做的是让自动续订订阅到期:

  • 使用 [[NSBundle mainBundle] appStoreReceiptURL] 并继续将收据转换为 base 64 字符串

  • 创建一个字典,其中包含此收据数据和共享机密

  • 将此字典转换为 JSON 字符串

  • 将此 JSON 字符串发送到https://sandbox.itunes.apple.com/verifyReceipt

  • 返回从应用商店作为回复收到的 JSONized 收据字典

  • 从 latest_receipt_info 字典中的 expires_date_ms 中获取到期日期

我不完全确定这是否正确,因为根据文档,不可能在 App Store 和设备之间实现安全链接(我目前正在这样做)。事实上,文档指出我需要自己的服务器来为我与 App Store 通信(https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#/ /apple_ref/doc/uid/TP40010573-CH104-SW1)。

这是可以接受的方法还是我需要自己的服务器?如果我需要我自己的服务器,有人可以指导我如何设置它的正确方向吗?

注意:每当使用 OpenSSL 使用本地验证进行购买时,我都会对非消耗性和消耗性应用内购买执行收据验证。所以应该没问题。

提前致谢。

json date subscriptions ios

5
推荐指数
1
解决办法
672
查看次数

graphql 订阅的集成测试

如何在不使用 apollo 的情况下测试我的 graphql 模式的发布/订阅?

是否可以只使用 subscriptions-transport-ws 来完成?我的 SubscriptionServer 是使用默认设置设置的,我可以通过使用 graphql 调用突变查询来看到发布。我已经使用我的快速服务器设置了一个 websocket 连接

const WebSocket = require('ws');
const myServer = require('../../bin/www');
const wsServer = new WebSocket.Server({
  server: myServer
});

const client = new SubscriptionClient(`ws://localhost:3000/subscriptions`, {}, WebSocket);

client.subscribe(
  {
    query: `subscription roomSubscription(placeId: "someid") {
        user {
            id,
            name
        }
    }`,
  },
  (error, result) => {
      console.log({error, result});
  }
);


const query = `
    mutation { 
        roomAddOrUpdate(placeId: "some id") {
            user {
                name
            }
        }
    }`;
   const result = await graphql(schema, …
Run Code Online (Sandbox Code Playgroud)

subscriptions graphql

5
推荐指数
0
解决办法
416
查看次数

如何解决GraphQL订阅服务器中的WebSocket错误

我基本上创建了快速服务器,然后添加了SubscriptionServer。

/*
*   GRAPHQL SERVER
*/

const graphqlServer = express()
graphqlServer.use(cors())
graphqlServer.use('/graphql', bodyParser.json(), graphqlExpress({ schema: schema }))
graphqlServer.get('/graphiql', graphiqlExpress({ endpointURL: '/graphql', subscriptionsEndpoint: `ws://localhost:${process.env.GRAPHQL_PORT}/subscriptions`, }))

graphqlServer.listen(process.env.GRAPHQL_PORT, () => {

  SubscriptionServer.create(
    {
      schema,
      execute,
      subscribe,
    },
    {
      server: graphqlServer,
      path: '/subscriptions',
    },
  )

  console.log(`
    - GraphQL server listening on http://localhost:${process.env.GRAPHQL_PORT}
    - GraphQL subscriptions listening on ws://localhost:${process.env.GRAPHQL_PORT}/subscriptions
    `)
})
Run Code Online (Sandbox Code Playgroud)

比当我尝试在GraphQLi订阅服务器上进行连接时,它引发了错误。

WebSocket connection to 'ws://localhost:10005/subscriptions' failed: Connection closed before receiving a handshake response
Run Code Online (Sandbox Code Playgroud)

我不知道这意味着什么,也不知道问题在哪里。

如果有人做过类似的项目,给我发github链接可能会很有帮助:)

非常感谢

subscriptions express apollo graphql

5
推荐指数
1
解决办法
577
查看次数

取消订阅服务内的 Observables?

在查看代码示例时,我经常看到服务内部的可观察对象未被取消订阅的情况。

这是一个例子:

export class AuthGuard implements CanActivate {

    private isLoggedIn: boolean;
    private isLoggedIn$: Observable<boolean>;


    constructor(private authService: AuthService, private router: Router) {
        this.isLoggedIn$ = this.authService.isLoggedIn();

        this.isLoggedIn$.subscribe(res => {
            if (res) {
                this.isLoggedIn = true;
            } 
            else {
                this.isLoggedIn = false;
            }
        });
    }

    canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
        if (this.isLoggedIn) {
            return true;
        }
        else {
            this.router.navigate(['login']);
            return false;
        }     
    }
} 
Run Code Online (Sandbox Code Playgroud)

在这种情况下,您是否有理由不取消订阅可观察的 this.isLoggedIn$ ?或者上面的例子只是错误的编码导致内存泄漏?

subscriptions unsubscribe observable typescript angular

5
推荐指数
1
解决办法
4785
查看次数

是否有一种简单的方法可以检查用户在 App Store 上的订阅状态,或者唯一的方法是进行收据和订阅验证?

有谁知道在应用程序加载时检查用户是否已经购买订阅的简单方法?

我只需要检查用户是否已经购买了订阅,不需要其他任何东西。看起来很容易,但实际上并不容易,因为我需要验证收据并检查订阅日期......订阅验证技术似乎不是一件容易的任务,我没有找到好的教程或好的指南描述了如何逐步实施它。我在这里阅读了Apple文档 是否有任何简单的本地收据验证和订阅验证技术来检查用户是否订阅?

也许有人知道一个框架或一种快速完成它的方法?任何帮助表示赞赏。

使用:Swift 4、Xcode 9.4

subscriptions subscription storekit ios swift

5
推荐指数
1
解决办法
2916
查看次数