Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added merchant-private-data to Google Checkout XML.

Usage::

    gc.add_fields({
        'private_data': 'some private data',
        ...
    })
  • Loading branch information...
commit b2d20e1a39b9b75cad39d39bea10c2126a0a4e08 1 parent d2ee4a3
@mikery authored
View
8 billing/integrations/google_checkout_integration.py
@@ -64,6 +64,11 @@ def generate_cart_xml(self):
items = doc.createElement('items')
cart.appendChild(items)
+ merchant_private_data = doc.createElement('merchant-private-data')
+ cart.appendChild(merchant_private_data)
+ private_data = unicode(self.fields.get("private_data", ""))
+ merchant_private_data.appendChild(doc.createTextNode(private_data))
+
ip_items = self.fields.get("items", [])
for item in ip_items:
it = doc.createElement("item")
@@ -93,7 +98,9 @@ def generate_cart_xml(self):
return_url.appendChild(doc.createTextNode(self.fields["return_url"]))
merchant_checkout_flow.appendChild(return_url)
+
cart_xml = doc.toxml(encoding="utf-8")
+ print cart_xml
hmac_signature = hmac.new(settings.GOOGLE_CHECKOUT_MERCHANT_KEY,
cart_xml,
hashlib.sha1).digest()
@@ -173,6 +180,7 @@ def gc_new_order_notification(self, request):
"financial-order-state" : "financial_order_state",
"fulfillment-order-state" : "fulfillment_order_state",
"timestamp" : "timestamp",
+ "shopping-cart.merchant-private-data": "private_data",
}
for (key, val) in resp_fields.iteritems():
View
3  billing/models/gc_models.py
@@ -6,6 +6,9 @@ class GCNewOrderNotification(models.Model):
serial_number = models.CharField(max_length=255)
google_order_number = models.CharField(max_length=255)
buyer_id = models.CharField(max_length=255)
+
+ # Private merchant data
+ private_data = models.CharField(max_length=255, blank=True)
# Buyer Shipping Address details
shipping_contact_name = models.CharField(max_length=255, blank=True)
Please sign in to comment.
Something went wrong with that request. Please try again.