Merge pull request #6648 from saurabh6790/paypal_subscription_date_fix

[fix] setup subscription datetime in utc format
This commit is contained in:
Ameya Shenoy 2018-12-19 11:15:17 +05:30 committed by GitHub
commit 48b6364941
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,12 +66,12 @@ More Details:
from __future__ import unicode_literals
import frappe
import json
import pytz
from frappe import _
from datetime import datetime
from six.moves.urllib.parse import urlencode
from frappe.model.document import Document
from frappe.integrations.utils import create_request_log, make_post_request, create_payment_gateway
from frappe.utils import get_url, call_hook_method, cint, get_timestamp, cstr, now, date_diff, get_datetime
from frappe.utils import get_url, call_hook_method, cint, get_datetime
api_path = '/api/method/frappe.integrations.doctype.paypal_settings.paypal_settings'
@ -309,9 +309,11 @@ def create_recurring_profile(token, payerid):
"INITAMT": data.get("upfront_amount")
})
starts_at = get_datetime(subscription_details.get("start_date")) or frappe.utils.now_datetime()
status_changed_to = 'Completed' if data.get("starting_immediately") or updating else 'Verified'
starts_at = get_datetime(subscription_details.get("start_date")) or frappe.utils.now_datetime()
starts_at = starts_at.replace(tzinfo=pytz.timezone(frappe.utils.get_time_zone())).astimezone(pytz.utc)
#"PROFILESTARTDATE": datetime.utcfromtimestamp(get_timestamp(starts_at)).isoformat()
params.update({
"PROFILESTARTDATE": starts_at.isoformat()