This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:io'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:in_app_purchase/in_app_purchase.dart'; | |
import 'package:cloud_functions/cloud_functions.dart'; | |
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; | |
import 'package:in_app_purchase_storekit/in_app_purchase_storekit.dart'; | |
import 'package:in_app_purchase_storekit/store_kit_wrappers.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PACKAGE_NAME_ANDROID = "(PUT YOUR APP PACKAGE NAME. ex. com.example.your.app)"; | |
const RECEIPT_VERIFICATION_ENDPOINT_FRO_ANDROID = "https://androidpublisher.googleapis.com/androidpublisher/v3/applications/"; | |
const SERVICE_CLIENT_EMAIL_FOR_ANDROID = "(PUT YOUR CLIENT EMAIL)"; | |
const SERVICE_PRIVATE_KEY_FOR_ANDROID = "(PUT YOUR PRIVATE KEY)" | |
// Android検証用のAuthClient | |
const authClient = new google.auth.JWT({ | |
email: SERVICE_CLIENT_EMAIL_FOR_ANDROID, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 定期 最終支払 検証用 | |
const PACKAGE_NAME_IOS = "(PUT YOUR APP PACKAGE NAME. ex. com.example.your.app)"; | |
const RECEIPT_VERIFICATION_ENDPOINT_FOR_IOS_SANDBOX = "https://sandbox.itunes.apple.com/verifyReceipt"; | |
const RECEIPT_VERIFICATION_ENDPOINT_FOR_IOS_PROD = "https://buy.itunes.apple.com/verifyReceipt"; | |
const RECEIPT_VERIFICATION_PASSWORD_FOR_IOS = "(PUT YOUR VERIFICATION PASSWORD)"; | |
async function verifyReceiptIos(verificationData, auth) { | |
let response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.verifySubscriptionAndroid = functions.pubsub.schedule('0 2 * * 0').timeZone('Asia/Tokyo').onRun(async (context) => { | |
// 該当レシートを検索 | |
const now = Date.now(); | |
const termTime = 24 * 60 * 60 * 1000; // 24時間間隔でチェックするため | |
const minTime = now - termTime; | |
const receiptsSnapshot = await admin.firestore().collectionGroup("receipts") | |
.where("expires_date_ms", "<=", now) | |
.where("expires_date_ms", ">", minTime) | |
.orderBy("expires_date_ms") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.verifySubscriptionIos = functions.pubsub.schedule('0 1 * * 0').timeZone('Asia/Tokyo').onRun(async (context) => { | |
// 該当レシートを検索 | |
const now = Date.now(); | |
const termTime = 24 * 60 * 60 * 1000; // 24時間間隔でチェックするため | |
const minTime = now - termTime; | |
const receiptsSnapshot = await admin.firestore().collectionGroup("receipts") | |
.where("expires_date_ms", "<=", now) | |
.where("expires_date_ms", ">", minTime) | |
.orderBy("expires_date_ms") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.verifyAndroid = functions.https.onCall(async (data, context) => { | |
if (context.auth === null) { | |
return { result: NO_AUTH }; | |
} | |
const uid = context.auth.uid; | |
const verificationData = data["data"]; | |
const latestReceipt = await verifyReceiptAndroid( | |
verificationData, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.verifyIos = functions.https.onCall(async (data, context) => { | |
if (context.auth === null) { | |
return { result: NO_AUTH }; | |
} | |
const uid = context.auth.uid; | |
const verificationData = data["data"]; | |
const latestReceipt = await verifyReceiptIos( | |
verificationData, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.6.6 | |
# Japanese fonts | |
RUN apt-get update && apt-get install -y locales && \ | |
locale-gen ja_JP.UTF-8 && \ | |
apt-get install -y fonts-vlgothic | |
ENV LANG ja_JP.UTF-8 | |
ENV LC_CTYPE ja_JP.UTF-8 | |
RUN localedef -f UTF-8 -i ja_JP ja_JP.utf8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
web: | |
# image: ruby:2.6.6 | |
build: | |
context: . | |
dockerfile: Dockerfile-web | |
depends_on: | |
- db | |
ports: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
require 'mail' | |
require 'json' | |
notify_term = 7 | |
buy_now_body = "" | |
yet_body = "" | |
File.open("item-list.json", "r+:UTF-8") do |f| |
NewerOlder