【发布时间】:2017-04-29 06:14:05
【问题描述】:
我无法获得 PayPal 将通过其 PayPal 按钮管理器 API 接受的日期格式。 “指定的开始日期无效。”是错误。
尝试1:直接从文档中复制字符串:
"start_date": "2017-12-22T09:13:49Z"
我看到了这个https://github.com/paypal/PayPal-Ruby-SDK/issues/107所以尝试了
strftime('%Y-%m-%dT%H:%M:%SZ') and utc.iso8601
start_date = "1980-02-19T00:37:04Z"
start_date = (DateTime.now - 10.years).utc.iso8601
start_date = (DateTime.now - 10.years).utc
@bm_build_button_search = @api.build_bm_button_search({ "start_date" => start_date })
# Make API call & get response
@bm_button_search_response = @api.BMButtonSearch(@bm_build_button_search)
@Errors=[#<PayPal::SDK::ButtonManager::DataTypes::ErrorType:0x007fa58b12e110 @ShortMessage="Invalid Argument", @LongMessage="The start date specified is invalid.", @ErrorCode="11998
(byebug) @bm_build_button_search.start_date.class
PayPal::SDK::Core::API::DataTypes::SimpleTypes::DateTime
So it looks like PayPal is fine with this DateTime format but when I call
@api.BMButtonSearch(@bm_build_button_search)
我收到错误@LongMessage="指定的开始日期无效。"
【问题讨论】: