google-wallet / passes-rest-samples

Server-side samples for the Google Pay API for Passes
Apache License 2.0
95 stars 48 forks source link

suggestion (PHP): Possible additional member functions for RestMethods.php #28

Closed hchian13 closed 1 year ago

hchian13 commented 3 years ago

I see the corresponding functions in Walletobjects.php, but couldn't find a way to get a list of classes by Issuer ID or get a list of objects by class ID. These two functions might help someone else.

public function listOfferClass() {
    $response = NULL;

    $service = new Google_Service_Walletobjects($this->client);

    try {
        $response = $service->offerclass->listOfferclass(array('issuerId'=>ISSUER_ID));
        $response["code"] = 200;
    } catch (Google_Service_Exception $gException)  {
        $response = $gException->getErrors();
        $response["code"] = $gException->getCode();
        echo("\n>>>> [START] Google Server Error response:");
        var_dump($response);
        echo("\n>>>> [END] Google Server Error response\n");
    } catch (Exception $e){
        var_dump($e->getMessage());
    }

    return $response;
}
public function listOfferObject($classId){
    $response = NULL;

    $service = new Google_Service_Walletobjects($this->client);

    try {
        $response = $service->offerobject->listOfferobject(array('classId'=>$classId));
        $response["code"] = 200;
    } catch (Google_Service_Exception $gException)  {
        $response = $gException->getErrors();
        $response["code"] = $gException->getCode();
        echo("\n>>>> [START] Google Server Error response:");
        var_dump($response);
        echo("\n>>>> [END] Google Server Error response\n");
    } catch (Exception $e){
        var_dump($e->getMessage());
    }

    return $response;
}
ncalteen commented 1 year ago

Hello,

I apologize, but this repository is being archived and replaced by google-pay/wallet-samples going forward. If you still have a question, please open a new issue in that repository.

Thank you!