mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 08:58:30 +01:00
201 lines
17 KiB
Python
201 lines
17 KiB
Python
from flask import url_for
|
|
|
|
from tests.api.utils import get_new_user_and_api_key
|
|
|
|
|
|
def test_apple_process_payment(flask_client):
|
|
user, api_key = get_new_user_and_api_key()
|
|
|
|
receipt_data = """MIIUHgYJKoZIhvcNAQcCoIIUDzCCFAsCAQExCzAJBgUrDgMCGgUAMIIDvwYJKoZIhvcNAQcBoIIDsASCA6wxggOoMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgEDAgEBBAMMATIwCwIBCwIBAQQDAgEAMAsCAQ8CAQEEAwIBADALAgEQAgEBBAMCAQAwCwIBGQIBAQQDAgEDMAwCAQoCAQEEBBYCNCswDAIBDgIBAQQEAgIAjjANAgENAgEBBAUCAwH8/TANAgETAgEBBAUMAzEuMDAOAgEJAgEBBAYCBFAyNTMwGAIBBAIBAgQQS28CkyUrKkayzHXyZEQ8/zAbAgEAAgEBBBMMEVByb2R1Y3Rpb25TYW5kYm94MBwCAQUCAQEEFCvruJwvAhV9s7ODIiM3KShyPW3kMB4CAQwCAQEEFhYUMjAyMC0wNC0xOFQxNjoyOToyNlowHgIBEgIBAQQWFhQyMDEzLTA4LTAxVDA3OjAwOjAwWjAgAgECAgEBBBgMFmlvLnNpbXBsZWxvZ2luLmlvcy1hcHAwSAIBBwIBAQRAHWlCA6fQTbOn0QFDAOH79MzMxIwODI0g6I8LZ6OyThRArQ6krRg6M8UPQgF4Jq6lIrz0owFG+xn0IV2Rq8ejFzBRAgEGAgEBBEkx7BUjdVQv+PiguvEl7Wd4pd+3QIrNt+oSRwl05KQdBeoBKU78eBFp48fUNkCFA/xaibj0U4EF/iq0Lgx345M2RSNqqWvRbzsIMIIBoAIBEQIBAQSCAZYxggGSMAsCAgatAgEBBAIMADALAgIGsAIBAQQCFgAwCwICBrICAQEEAgwAMAsCAgazAgEBBAIMADALAgIGtAIBAQQCDAAw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irHDx22TZxeY8hLgBdQqorV2uT80AkHN7B1dSExggHLMIIBxwIBATCBozCBljELMAkGA1UEBhMCVVMxEzARBgNVBAoMCkFwcGxlIEluYy4xLDAqBgNVBAsMI0FwcGxlIFdvcmxkd2lkZSBEZXZlbG9wZXIgUmVsYXRpb25zMUQwQgYDVQQDDDtBcHBsZSBXb3JsZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9ucyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eQIIDutXh+eeCY0wCQYFKw4DAhoFADANBgkqhkiG9w0BAQEFAASCAQCjIWg69JwLxrmuZL7R0isYWjNGR0wvs3YKtWSwHZG/gDaxPWlgZI0oszcMOI07leGl73vQRVFO89ngbDkNp1Mmo9Mmbc/m8EJtvaVkJp0gYICKpWyMMJPNL5CT+MinMj9gBkRrd5rwFlfRkNBSmD6bt/I23B1AKcmmMwklAuF/mxGzOF4PFiPukEtaQAOe7j4w+QLzEeEAi57DIQppp+uRupKQpZRnn/Q9MyGxXA30ei6C1suxPCoRqCKrRXfWp73UsGP5jH6tOLigkVoO4CtJs3fLWpkLi9by6/K6eoGbP5MOklsBJWYGVZbRRDiNROxqPOgWnS1+p+/KGIdIC4+u"""
|
|
|
|
r = flask_client.post(
|
|
url_for("api.apple_process_payment"),
|
|
headers={"Authentication": api_key.code},
|
|
json={"receipt_data": receipt_data},
|
|
)
|
|
|
|
# will fail anyway as there's apple secret is not valid
|
|
assert r.status_code == 400
|
|
assert r.json == {"error": "Processing failed"}
|
|
|
|
|
|
def test_apple_update_notification(flask_client):
|
|
user, api_key = get_new_user_and_api_key()
|
|
|
|
payload = {
|
|
"unified_receipt": {
|
|
"latest_receipt": "long string",
|
|
"pending_renewal_info": [
|
|
{
|
|
"is_in_billing_retry_period": "0",
|
|
"auto_renew_status": "0",
|
|
"original_transaction_id": "1000000654277043",
|
|
"product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"expiration_intent": "1",
|
|
"auto_renew_product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
}
|
|
],
|
|
"environment": "Sandbox",
|
|
"status": 0,
|
|
"latest_receipt_info": [
|
|
{
|
|
"expires_date_pst": "2020-04-20 21:11:57 America/Los_Angeles",
|
|
"purchase_date": "2020-04-21 03:11:57 Etc/GMT",
|
|
"purchase_date_ms": "1587438717000",
|
|
"original_purchase_date_ms": "1587420715000",
|
|
"transaction_id": "1000000654329911",
|
|
"original_transaction_id": "1000000654277043",
|
|
"quantity": "1",
|
|
"expires_date_ms": "1587442317000",
|
|
"original_purchase_date_pst": "2020-04-20 15:11:55 America/Los_Angeles",
|
|
"product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"subscription_group_identifier": "20624274",
|
|
"web_order_line_item_id": "1000000051891577",
|
|
"expires_date": "2020-04-21 04:11:57 Etc/GMT",
|
|
"is_in_intro_offer_period": "false",
|
|
"original_purchase_date": "2020-04-20 22:11:55 Etc/GMT",
|
|
"purchase_date_pst": "2020-04-20 20:11:57 America/Los_Angeles",
|
|
"is_trial_period": "false",
|
|
},
|
|
{
|
|
"expires_date_pst": "2020-04-20 20:11:57 America/Los_Angeles",
|
|
"purchase_date": "2020-04-21 02:11:57 Etc/GMT",
|
|
"purchase_date_ms": "1587435117000",
|
|
"original_purchase_date_ms": "1587420715000",
|
|
"transaction_id": "1000000654313889",
|
|
"original_transaction_id": "1000000654277043",
|
|
"quantity": "1",
|
|
"expires_date_ms": "1587438717000",
|
|
"original_purchase_date_pst": "2020-04-20 15:11:55 America/Los_Angeles",
|
|
"product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"subscription_group_identifier": "20624274",
|
|
"web_order_line_item_id": "1000000051890729",
|
|
"expires_date": "2020-04-21 03:11:57 Etc/GMT",
|
|
"is_in_intro_offer_period": "false",
|
|
"original_purchase_date": "2020-04-20 22:11:55 Etc/GMT",
|
|
"purchase_date_pst": "2020-04-20 19:11:57 America/Los_Angeles",
|
|
"is_trial_period": "false",
|
|
},
|
|
{
|
|
"expires_date_pst": "2020-04-20 19:11:54 America/Los_Angeles",
|
|
"purchase_date": "2020-04-21 01:11:54 Etc/GMT",
|
|
"purchase_date_ms": "1587431514000",
|
|
"original_purchase_date_ms": "1587420715000",
|
|
"transaction_id": "1000000654300800",
|
|
"original_transaction_id": "1000000654277043",
|
|
"quantity": "1",
|
|
"expires_date_ms": "1587435114000",
|
|
"original_purchase_date_pst": "2020-04-20 15:11:55 America/Los_Angeles",
|
|
"product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"subscription_group_identifier": "20624274",
|
|
"web_order_line_item_id": "1000000051890161",
|
|
"expires_date": "2020-04-21 02:11:54 Etc/GMT",
|
|
"is_in_intro_offer_period": "false",
|
|
"original_purchase_date": "2020-04-20 22:11:55 Etc/GMT",
|
|
"purchase_date_pst": "2020-04-20 18:11:54 America/Los_Angeles",
|
|
"is_trial_period": "false",
|
|
},
|
|
{
|
|
"expires_date_pst": "2020-04-20 18:11:54 America/Los_Angeles",
|
|
"purchase_date": "2020-04-21 00:11:54 Etc/GMT",
|
|
"purchase_date_ms": "1587427914000",
|
|
"original_purchase_date_ms": "1587420715000",
|
|
"transaction_id": "1000000654293615",
|
|
"original_transaction_id": "1000000654277043",
|
|
"quantity": "1",
|
|
"expires_date_ms": "1587431514000",
|
|
"original_purchase_date_pst": "2020-04-20 15:11:55 America/Los_Angeles",
|
|
"product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"subscription_group_identifier": "20624274",
|
|
"web_order_line_item_id": "1000000051889539",
|
|
"expires_date": "2020-04-21 01:11:54 Etc/GMT",
|
|
"is_in_intro_offer_period": "false",
|
|
"original_purchase_date": "2020-04-20 22:11:55 Etc/GMT",
|
|
"purchase_date_pst": "2020-04-20 17:11:54 America/Los_Angeles",
|
|
"is_trial_period": "false",
|
|
},
|
|
{
|
|
"expires_date_pst": "2020-04-20 17:11:54 America/Los_Angeles",
|
|
"purchase_date": "2020-04-20 23:11:54 Etc/GMT",
|
|
"purchase_date_ms": "1587424314000",
|
|
"original_purchase_date_ms": "1587420715000",
|
|
"transaction_id": "1000000654285464",
|
|
"original_transaction_id": "1000000654277043",
|
|
"quantity": "1",
|
|
"expires_date_ms": "1587427914000",
|
|
"original_purchase_date_pst": "2020-04-20 15:11:55 America/Los_Angeles",
|
|
"product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"subscription_group_identifier": "20624274",
|
|
"web_order_line_item_id": "1000000051888827",
|
|
"expires_date": "2020-04-21 00:11:54 Etc/GMT",
|
|
"is_in_intro_offer_period": "false",
|
|
"original_purchase_date": "2020-04-20 22:11:55 Etc/GMT",
|
|
"purchase_date_pst": "2020-04-20 16:11:54 America/Los_Angeles",
|
|
"is_trial_period": "false",
|
|
},
|
|
{
|
|
"expires_date_pst": "2020-04-20 16:11:54 America/Los_Angeles",
|
|
"purchase_date": "2020-04-20 22:11:54 Etc/GMT",
|
|
"purchase_date_ms": "1587420714000",
|
|
"original_purchase_date_ms": "1587420715000",
|
|
"transaction_id": "1000000654277043",
|
|
"original_transaction_id": "1000000654277043",
|
|
"quantity": "1",
|
|
"expires_date_ms": "1587424314000",
|
|
"original_purchase_date_pst": "2020-04-20 15:11:55 America/Los_Angeles",
|
|
"product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"subscription_group_identifier": "20624274",
|
|
"web_order_line_item_id": "1000000051888825",
|
|
"expires_date": "2020-04-20 23:11:54 Etc/GMT",
|
|
"is_in_intro_offer_period": "false",
|
|
"original_purchase_date": "2020-04-20 22:11:55 Etc/GMT",
|
|
"purchase_date_pst": "2020-04-20 15:11:54 America/Los_Angeles",
|
|
"is_trial_period": "false",
|
|
},
|
|
],
|
|
},
|
|
"auto_renew_status_change_date": "2020-04-21 04:11:33 Etc/GMT",
|
|
"environment": "Sandbox",
|
|
"auto_renew_status": "false",
|
|
"auto_renew_status_change_date_pst": "2020-04-20 21:11:33 America/Los_Angeles",
|
|
"latest_expired_receipt": "long string",
|
|
"latest_expired_receipt_info": {
|
|
"original_purchase_date_pst": "2020-04-20 15:11:55 America/Los_Angeles",
|
|
"quantity": "1",
|
|
"subscription_group_identifier": "20624274",
|
|
"unique_vendor_identifier": "4C4DF6BA-DE2A-4737-9A68-5992338886DC",
|
|
"original_purchase_date_ms": "1587420715000",
|
|
"expires_date_formatted": "2020-04-21 04:11:57 Etc/GMT",
|
|
"is_in_intro_offer_period": "false",
|
|
"purchase_date_ms": "1587438717000",
|
|
"expires_date_formatted_pst": "2020-04-20 21:11:57 America/Los_Angeles",
|
|
"is_trial_period": "false",
|
|
"item_id": "1508744966",
|
|
"unique_identifier": "b55fc3dcc688e979115af0697a0195be78be7cbd",
|
|
"original_transaction_id": "1000000654277043",
|
|
"expires_date": "1587442317000",
|
|
"transaction_id": "1000000654329911",
|
|
"bvrs": "3",
|
|
"web_order_line_item_id": "1000000051891577",
|
|
"version_external_identifier": "834289833",
|
|
"bid": "io.simplelogin.ios-app",
|
|
"product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"purchase_date": "2020-04-21 03:11:57 Etc/GMT",
|
|
"purchase_date_pst": "2020-04-20 20:11:57 America/Los_Angeles",
|
|
"original_purchase_date": "2020-04-20 22:11:55 Etc/GMT",
|
|
},
|
|
"password": "22b9d5a110dd4344a1681631f1f95f55",
|
|
"auto_renew_status_change_date_ms": "1587442293000",
|
|
"auto_renew_product_id": "io.simplelogin.ios_app.subscription.premium.yearly",
|
|
"notification_type": "DID_CHANGE_RENEWAL_STATUS",
|
|
}
|
|
|
|
r = flask_client.post(
|
|
url_for("api.apple_update_notification"),
|
|
headers={"Authentication": api_key.code},
|
|
json=payload,
|
|
)
|
|
|
|
# will fail anyway as there's no such AppleSub in Test DB
|
|
assert r.status_code == 400
|
|
assert r.json == {"error": "Processing failed"}
|