Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistent create date time format #13

Open
8ctopus opened this issue Oct 2, 2023 · 6 comments
Open

inconsistent create date time format #13

8ctopus opened this issue Oct 2, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@8ctopus
Copy link

8ctopus commented Oct 2, 2023

Contact Details

[email protected]

Describe the Issue

All webhook events have inconsistent create date time format as shown in the example below.

  • Event create_time is 2023-09-29T05:31:20.578Z which corresponds to RFC3339_EXTENDED.
  • Event resource.create_time is 2023-09-29T05:31:20Z which corresponds to RFC3339.
{
    "id": "WH-4Y606300TA357863S-3Y259958BU9969527",
    "event_version": "1.0",
    "create_time": "2023-09-29T05:31:20.578Z",
    "resource_type": "subscription",
    "resource_version": "2.0",
    "event_type": "BILLING.SUBSCRIPTION.CREATED",
    "summary": "Subscription created",
    "resource": {
        "start_time": "2023-09-29T05:31:20Z",
        "quantity": "1",
        "create_time": "2023-09-29T05:31:20Z",
        "links": [
            {
                "href": "https://www.sandbox.paypal.com/webapps/billing/subscriptions?ba_token=BA-9T8593239B086700M",
                "rel": "approve",
                "method": "GET"
            },
            {
                "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-FA415DTVC6B9",
                "rel": "edit",
                "method": "PATCH"
            },
            {
                "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-FA415DTVC6B9",
                "rel": "self",
                "method": "GET"
            }
        ],
        "id": "I-FA415DTVC6B9",
        "plan_overridden": false,
        "plan_id": "P-1CF03610GT7629518MUCCY2A",
        "status": "APPROVAL_PENDING"
    },
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-4Y606300TA357863S-3Y259958BU9969527",
            "rel": "self",
            "method": "GET"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-4Y606300TA357863S-3Y259958BU9969527/resend",
            "rel": "resend",
            "method": "POST"
        }
    ]
}

Steps To Reproduce

N/A

What type of Operating System are you seeing the problem on?

N/A

What type of browser are you seeing the problem on?

N/A

Screenshots or Videos

No response

Code to produce this issue.

No response

@8ctopus 8ctopus added the bug Something isn't working label Oct 2, 2023
@cnallam
Copy link
Contributor

cnallam commented Oct 2, 2023

@8ctopus - Acknowledge the issue, working to get the right team engaged.

@8ctopus
Copy link
Author

8ctopus commented Oct 3, 2023

@cnallam Maybe there is a reason that create_time at the event level is more precise: get an exact order of events that occurred within the same second? Just a hypothesis. Also changing the format at either level would introduce a breaking change.

@cnallam
Copy link
Contributor

cnallam commented Oct 5, 2023

@8ctopus Yes I agree, this is a breaking change. Changing the format at either level will create a breaking change.
Is this date format RFC3339_EXTENDED an issue for you? If not we can close this issue.

@8ctopus
Copy link
Author

8ctopus commented Oct 10, 2023

No, it's not an issue per se, but it creates inconsistencies along the code base.

@cnallam
Copy link
Contributor

cnallam commented Oct 17, 2023

Yeah it might create some inconsistencies. But can you parse the date "yyyy-MM-dd'T'HH:mm:ss" ignoring milliseconds, in that way you can avoid inconsistencies in code.
public class Main { public static void main(String[] args) throws ParseException { System.out.println( new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse("2023-09-29T05:31:20.578Z")); System.out.println( new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").parse("2023-09-29T05:31:20Z")); } }

@8ctopus
Copy link
Author

8ctopus commented Oct 18, 2023

Here's another inconsistency:

I simulate a PAYMENT.SALE.REVERSED event and just found out that the create_time is in RFC3339 instead of the expected RFC3339_EXTENDED.

Is it a bug of the simulation event, or does a real PAYMENT.SALE.REVERSED use a different create_time format?

{
    "id": "WH-3EC545679X386831C-3D038940937933201",
    "event_version": "1.0",
    "create_time": "2014-10-23T00:19:27Z",
    "resource_type": "sale",
    "event_type": "PAYMENT.SALE.REVERSED",
    "summary": "A $ 0.49 USD sale payment was reversed",
    "resource": {
        "id": "77689802DL785834G",
        "create_time": "2014-10-23T00:19:12Z",
        "state": "completed",
        "amount": {
            "total": "-0.49",
            "currency": "USD",
            "details": {
                "subtotal": "-0.64",
                "tax": "0.08",
                "shipping": "0.07"
            }
        },
        "links": [
            {
                "href": "https:\/\/api.sandbox.paypal.com\/v1\/payments\/refund\/77689802DL785834G",
                "rel": "self",
                "method": "GET"
            }
        ]
    },
    "links": [
        {
            "href": "https:\/\/api.sandbox.paypal.com\/v1\/notifications\/webhooks-events\/WH-3EC545679X386831C-3D038940937933201",
            "rel": "self",
            "method": "GET"
        },
        {
            "href": "https:\/\/api.sandbox.paypal.com\/v1\/notifications\/webhooks-events\/WH-3EC545679X386831C-3D038940937933201\/resend",
            "rel": "resend",
            "method": "POST"
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants