kmitgroup / google-checkout-php-sample-code

Automatically exported from code.google.com/p/google-checkout-php-sample-code
0 stars 0 forks source link

Ability to receive redirect url from GoogleCart::CheckoutServer2Server() #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create and add items to a new GoogleCart ($cart)
2. Use $cart->CheckoutServer2Server() to send the cart to Google
3. $cart->()CheckoutServer2Server() then calls
$GRequest->SendServer2ServerCart(), but it doesn't pass a second parameter
($die). So SendServer2ServerCart() automatically redirects, and doesn't to
return the redirect url (which I need).

What is the expected output? What do you see instead?

I would like to be able to pass a third parameter to
GoogleCart::CheckoutServer2Server() called $die (default to true), and then
pass that parameter in the last line of that function, like this:

$GRequest->SendServer2ServerCart($this->GetXML(), $die)

What version of the product are you using? On what operating system?

1.2.5c, Mac OS X (development), Linux (production)

Please provide any additional information below.

This change would allow me to store the shopping cart ID (from the redirect
url) in my database before the user is redirected, and then more easily
line up digital delivery downloads with order numbers.  This change would
not affect existing sites, since it is simply adding another parameter with
the default set to how it's already behaving.

Original issue reported on code.google.com by stein.j...@gmail.com on 7 May 2008 at 4:30

GoogleCodeExporter commented 9 years ago
This seems to be more of a feature request than a bug.  

Original comment by peng.y...@gmail.com on 7 May 2008 at 4:54

GoogleCodeExporter commented 9 years ago
Yeah, sorry... I don't know how to do feature requests.

Original comment by stein.j...@gmail.com on 7 May 2008 at 4:56

GoogleCodeExporter commented 9 years ago
I don't know if diffs are useful for you, but here's the diff for this 
enhancement:

--- googlecart.php
+++ (clipboard)
@@ -957,7 +960,7 @@
      * @return array with the returned http status code (200 if OK) in index 0 
      *               and the redirect url returned by the server in index 1
      */
-    function CheckoutServer2Server($proxy=array(), $certPath='') {
+    function CheckoutServer2Server($proxy=array(), $certPath='', $die=true) {
       ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.'.');
       require_once('library/googlerequest.php');
       $GRequest = new GoogleRequest($this->merchant_id, 
@@ -968,7 +971,7 @@
       $GRequest->SetProxy($proxy);
       $GRequest->SetCertificatePath($certPath);

-      return $GRequest->SendServer2ServerCart($this->GetXML());
+      return $GRequest->SendServer2ServerCart($this->GetXML(), $die);
     }

     /**

Original comment by stein.j...@gmail.com on 8 May 2008 at 8:02

GoogleCodeExporter commented 9 years ago

Original comment by peng.y...@gmail.com on 16 May 2008 at 10:37