REQ。获取标头中的嵌套变量

时间:2015-05-07 09:56:59

标签: node.js amazon-pay

如何获得SellerId

req.headers['user-agent']将用户代理返回给我,但是使用多维数组进一步嵌套并不会让我前进。

e.g。 console.log(JSON.stringify(req.headers['user-agent']['message']));

返回undefined

POST / HTTP/1.1
x-amz-sns-message-type: Notification
x-amz-sns-message-id: 0000000-0000-00000-0000-00000EXAMPLE
x-amz-sns-topic-arn: arn:aws:sns:EXAMPLE:11111EXAMPLE:TestTopic
x-amz-sns-subscription-arn: arn:aws:sns:EXAMPLE:11111EXAMPLE:TestTopic: EXAMPLE
Content-Length: 999
Content-Type: text/plain; charset=UTF-8
Host: ec2-EXAMPLE.compute-1.amazonaws.com
Connection: Keep-Alive
User-Agent: Amazon Simple Notification Service Agent
{
    Type : Notification,
    MessageId : xxxxxx-xxxx-xxxx-xxxx-xxxxxEXAMPLE,
    TopicArn : arn:aws:sns:EXAMPLE:11111EXAMPLE:TestTopic,
    Message :
    {
        NotificationReferenceId: 1111111-1111-11111-1111-11111EXAMPLE,
        NotificationType:  PaymentAuthorize,
        SellerId: A3PJMS5WFYSRB4,
        ReleaseEnvironment: Sandbox,
        Version: 2013-01-01,
        NotificationData:<?xml version="1.0" encoding="UTF-8"?>
                <AuthorizationNotification xmlns="https://mws.amazonservices.com/ipn/OffAmazonPayments/2013-01-01">
                <AuthorizationDetails>
                <AmazonAuthorizationId>P01-0000000-0000000-000000</AmazonAuthorizationId>
                <AuthorizationReferenceId>P01-0000000-0000000-000000</AuthorizationReferenceId>
                <AuthorizationAmount>
                    <Amount>100.0</Amount>
                    <CurrencyCode>USD</CurrencyCode>
                </AuthorizationAmount>
                <CapturedAmount>
                    <Amount>10.0</Amount>
                    <CurrencyCode>USD</CurrencyCode>
                </CapturedAmount>
                <AuthorizationFee>
                    <Amount>1.0</Amount>
                    <CurrencyCode>USD</CurrencyCode>
                </AuthorizationFee>
                <IdList />
                <CreationTimestamp>2013-01-01T01:01:01.001Z</CreationTimestamp>
                <ExpirationTimestamp>2013-01-01T01:01:01.001Z</ExpirationTimestamp>
                <AuthorizationStatus>
                    <State>Completed</State>   
                    <LastUpdateTimestamp>2013-01-01T01:01:01.001Z</LastUpdateTimestamp>
                    <ReasonCode>None</ReasonCode>
                </AuthorizationStatus>
                <OrderItemCategories />
                <CaptureNow>true</CaptureNow>
                <SoftDescriptor>AMZ*softDescriptor</SoftDescriptor>
            </AuthorizationDetails>
            </AuthorizationNotification>,
        Timestamp:2013-01-01T01:01:01Z
    }
    Timestamp : 2013-01-01T01:01:001Z,
    SignatureVersion : 1,
    Signature : rkne..9=kOUhF,
    SigningCertURL : https://sns.EXAMPLE.amazonaws.com/SimpleNotificationService-aaaaaabbbbbbccccccEXAMPLE.pem,
    UnsubscribeURL : https://sns.EXAMPLE.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:EXAMPLE:11111EXAMPLE:TestTopic:GUID
}

0 个答案:

没有答案