Giter Club home page Giter Club logo

rest-samples's Introduction

Google Wallet Samples

This project contains samples for using the Google Wallet REST APIs in the following languages:

Within each language's directory, you'll find standalone samples for each of the pass types supported by the Google Wallet APIs.

Each sample demonstrates the following:

  • Authenticating using a Google Cloud service account
  • Creating, updating, and patching a pass class
  • Adding messages to a pass class
  • Creating, updating, and patching a pass object
  • Adding messages to a pass object
  • Expiring a pass object
  • Creating a signed JWT and a "Add to Google Wallet" URL
  • Performing batch API calls to improve performance

rest-samples's People

Contributors

aaronball avatar alexrodriguezartells avatar amuramoto avatar corruptedphazite avatar dmengelt avatar johnksterling avatar ncalteen avatar nick-alteen avatar razvanphp avatar sagarkothari avatar samkingdev avatar stephenmcd avatar yanaga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rest-samples's Issues

How to add "Add to Google Wallet" button in email

I am in the business of selling event tickets. When ticket is sold we send confirmation email to our customer. In email we have button called "Add to Apple Wallet". This button links to our backed and when pressed download special file (a "bundle" in Apple's language) that can be added to Apple Wallet.

I would like to add similar functionality for Google Wallet. I looked at docs as well as samples in this repo and I am confused. In order to create "object" I always have to call Google Wallet REST APIs. Only then I can create a link in form of $"https://pay.google.com/gp/v/save/{token}" that is can be embedded into email. This means that I have to "register" our tickets in your system regardless if someone is using Google Wallet or not.

Is there a way to create "object" on my own, on our server?

Walletobjects api service not on Maven?

I am looking to implement the Google Wallet API in Java, and have been following the instructions here. However I noticed that the google-api-services-walletobjects artifact is not in Maven, and is only available as a jar download here, and is also not made available within the Google API Java Client. Why is this, and can it be added to Maven so my project can access the artifact without having to download and install the jar locally? Thanks!

Java Implementation

Having trouble implementing a pass, it generates a very basic pass even though I've populated both class and object values. Here is what I'm getting:
image

But here is what I'm attempting to generate:
image

Here is how I configured my code to build both the class and object. My question is despite me populating all the fields in the template object. Why is none of the info generated?

`public String CreateJWTNewObjects(String issuerId, String classSuffix, String objectSuffix) {
GenericClass newClass = new GenericClass()
.setId(String.format("%s.%s", issuerId, classSuffix))
.setClassTemplateInfo(
new ClassTemplateInfo()
.setCardTemplateOverride(
new CardTemplateOverride()
.setCardRowTemplateInfos(Arrays.asList(
new CardRowTemplateInfo().setThreeItems(
new CardRowThreeItems()
.setStartItem(new TemplateItem().setFirstValue(new FieldSelector().setFields(Arrays.asList( new FieldReference().setFieldPath("object.textModulesData['group_#']")))))
.setMiddleItem(new TemplateItem().setFirstValue(new FieldSelector().setFields(Arrays.asList( new FieldReference().setFieldPath("object.textModulesData['suffix']")))))
.setEndItem(new TemplateItem().setFirstValue(new FieldSelector().setFields(Arrays.asList( new FieldReference().setFieldPath("object.textModulesData['family_id']")))))),
new CardRowTemplateInfo().setThreeItems(
new CardRowThreeItems()
.setStartItem(new TemplateItem().setFirstValue(new FieldSelector().setFields(Arrays.asList( new FieldReference().setFieldPath("object.textModulesData['pkg']")))))
.setMiddleItem(new TemplateItem().setFirstValue(new FieldSelector().setFields(Arrays.asList( new FieldReference().setFieldPath("object.textModulesData['rxbin']")))))
.setEndItem(new TemplateItem().setFirstValue(new FieldSelector().setFields(Arrays.asList( new FieldReference().setFieldPath("object.textModulesData['rxpcn']")))))),
new CardRowTemplateInfo().setOneItem(
new CardRowOneItem()
.setItem(new TemplateItem().setFirstValue(new FieldSelector().setFields(Arrays.asList( new FieldReference().setFieldPath("object.textModulesData['rxgrp']")))))
)))));

// See link below for more information on required properties
// https://developers.google.com/wallet/generic/rest/v1/genericobject
GenericObject newObject =
        new GenericObject()
                .setId(String.format("%s.%s", issuerId, objectSuffix))
                .setClassId(String.format("%s.%s", issuerId, classSuffix))
                .setState("ACTIVE")
                .setTextModulesData(
                        Arrays.asList(
                                new TextModuleData()
                                        .setHeader("GROUP #")
                                        .setBody("V09999")
                                        .setId("group_#"),
                                new TextModuleData()
                                        .setHeader("SUFFIX")
                                        .setBody("00")
                                        .setId("suffix"),
                                new TextModuleData()
                                        .setHeader("FAMILY ID")
                                        .setBody("00101212")
                                        .setId("family_id"),
                                new TextModuleData()
                                        .setHeader("PKG")
                                        .setBody("SLV2")
                                        .setId("pkg"),
                                new TextModuleData()
                                        .setHeader("RXBIN")
                                        .setBody("001122")
                                        .setId("rxbin"),
                                new TextModuleData()
                                        .setHeader("RXPCN")
                                        .setBody("0A8")
                                        .setId("rxpcn"),
                                new TextModuleData()
                                        .setHeader("RXGRP")
                                        .setBody("RX4")
                                        .setId("rxgrp")
                        ))
                .setBarcode(new Barcode().setType("QR_CODE").setValue("QR code value"))
                .setCardTitle(
                        new LocalizedString()
                                .setDefaultValue(
                                        new TranslatedString().setLanguage("en-US").setValue("random txt")))
                .setHeader(
                        new LocalizedString()
                                .setDefaultValue(
                                        new TranslatedString().setLanguage("en-US").setValue("Jackie Jill")))
                .setHexBackgroundColor("#296044")
                .setLogo(
                        new Image()
                                .setSourceUri(
                                        new ImageUri()
                                                .setUri("https://storage.cloud.google.com/viva-logos/google_wallet_logo.png"))
                                .setContentDescription(
                                        new LocalizedString()
                                                .setDefaultValue(
                                                        new TranslatedString()
                                                                .setLanguage("en-US")
                                                                .setValue("random txt"))));

// Create the JWT as a HashMap object
HashMap<String, Object> claims = new HashMap<String, Object>();
claims.put("iss", ((ServiceAccountCredentials) credentials).getClientEmail());
claims.put("aud", "google");
claims.put("origins", new ArrayList<>());
claims.put("typ", "savetowallet");

// Create the Google Wallet payload and add to the JWT
HashMap<String, Object> payload = new HashMap<String, Object>();
payload.put("genericClasses", Arrays.asList(newClass));
payload.put("genericObjects", Arrays.asList(newObject));
claims.put("payload", payload);

// The service account credentials are used to sign the JWT
Algorithm algorithm =
        Algorithm.RSA256(
                null, (RSAPrivateKey) ((ServiceAccountCredentials) credentials).getPrivateKey());
String token = JWT.create().withPayload(claims).sign(algorithm);

System.out.println("Add to Google Wallet link");
System.out.println(String.format("https://pay.google.com/gp/v/save/%s", token));

return String.format("https://pay.google.com/gp/v/save/%s", token);

}`

Python-offercerd-shortage

offercard.py has shortages. No logo, no subheader, no background color in the code.
Please advise how to add these to my code.

Error: permission denied when inserting event ticket class or object

I have followed all the steps for creating a service account, giving permissions etc. and I have this code trying to implement skinny jwt flow in node.js :

const serviceAccountInfo = {
   "type": "service_account",
   "project_id": "XXXX",
   "private_key_id": "XXXXX",
   "private_key": "XXXXX",
   "client_email": "[email protected]",
   "client_id": "XXX",
   "auth_uri": "https://accounts.google.com/o/oauth2/auth",
   "token_uri": "https://oauth2.googleapis.com/token",
   "auth_provider_x509_cert_url": "",
   "client_x509_cert_url": ""
}

// Issuer ID obtained from Google Pay Business Console.
const issuerId = XXXXXXXXXX...

// Developer defined ID for the wallet class, this is the 'test-eventTicket-class-id'
const classUid = "EVENTTICKET_CLASS_4ba7141a-9ac7-4a11-b252-7e2f85ac7953"
const classId = `${issuerId}.${classUid}`

// Developer defined ID for the user, eg an email address: '[email protected]'
const userId = "[email protected]"

// ID for the wallet object, must be in the form `issuerId.userId` where userId is alphanumeric.
const objectId = `${issuerId}.${userId.replace(/[^\w.-]/g, "_")}-${classUid}`
 
const google_api_base_url= "https://walletobjects.googleapis.com/walletobjects/v1"

//skinny jwt flow
   //1.create EventClass (json representation)

   const logoUri ="https://www.crowdpolicy.com/wp-content/uploads/2020/01/kit-cp-icon-black.png"
   let eventTicketClass
   try {
       eventTicketClass = createEventClass(logoUri, issuerId)
   } catch ( err ) {
       console.log("event Ticket Class error: ", err)
   }
   console.log("event Ticket Class created: ", eventTicketClass)

   //2.post request to insert EventClass in the Google Pay API for Passes server
   //const credentials = require(serviceAccountFile)
   let insertClassResult
   try{
       const httpClient = new GoogleAuth({
           credentials: serviceAccountInfo,
           scopes: "https://www.googleapis.com/auth/wallet_object.issuer"
       })
       insertClassResult = await httpClient.request({url: google_api_base_url+"/eventTicketClass", method: 'POST', data: eventTicketClass})    
       console.log("insertClassResult: ", insertClassResult)
   } catch ( err ) {
       console.log("insertClassResult error: ", err)
           
       res.send({
           success: false,
           error: err
       })
       return 
   }
//this event id is unique random str -64 characters- for every pass event e.g. cityon pass, so that the grouping of the passes of the same event will be stable
const eventId =
 "kLNIQ02OHDjhbu3xkNp8USxl6nOLSqv5HOLanEtK72I+9Gs9tdAZzFekY4G8DQ=="

function createEventClass(logoUri, issuerId) {
 //the function creates and returns EventClass (json representation)

 const eventName = {
   translatedValues: [
     {
       kind: "walletobjects#eventTicketClass",
       language: "en-US",
       value: "RESIDENT CARD",
     },
   ],
   defaultValue: {
     kind: "walletobjects#eventTicketClass",
     language: "el-GR",
     value: "ΚΑΡΤΑ ΔΗΜΟΤΗ",
   },
 }

 const logo = {
   sourceUri: {
     uri: logoUri,
   },
   contentDescription: {
     translatedValues: [
       {
         kind: "walletobjects#eventTicketClass",
         language: "en-US",
         value: "Cityon Pass Logo",
       },
     ],
     defaultValue: {
       kind: "walletobjects#eventTicketClass",
       language: "el-GR",
       value: "Cityon Pass Logo",
     },
   },
 }

 const objectUid = "EVENTTICKET_OBJECT_" + uuidv4()
 const objectId = issuerId + "." + objectUid

 const localizedIssuerName = {
   translatedValues: [
     {
       language: "en-US",
       value: "Crowdpolicy",
     },
   ],
   defaultValue: {
     language: "el-GR",
     value: "Crowdpolicy",
   },
 }

 const eventTicketClass = {
   eventName: eventName,
   eventId: eventId,
   logo: logo,
   id: objectId,
   issuerName: "Crowdpolicy",
   reviewStatus: "UNDER_REVIEW", //"APPROVED" will be when class is sent
   review: {
     comments: "This is a comment!",
   },
   countryCode: "en-US",
   enableSmartTap: false,
   hexBackgroundColor: "#03A5B9",
   localizedIssuerName: localizedIssuerName,
   multipleDevicesAndHoldersAllowedStatus: "ONE_USER_ALL_DEVICES",
 }

 return eventTicketClass
}

But I am always getting this error :
insertClassResult error: GaxiosError: Permission denied. at Gaxios._request (/usr/src/app/node_modules/gaxios/build/src/gaxios.js:130:23) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async JWT.requestAsync (/usr/src/app/node_modules/google-auth-library/build/src/auth/oauth2client.js:368:18) at async exports.generateGpayPass (/usr/src/app/src/controllers/generateGpayPass.js:96:29) at async exports.getUserInfo (/usr/src/app/src/controllers/getUserInfo.js:438:25) { response: { config: { url: 'https://walletobjects.googleapis.com/walletobjects/v1/eventTicketClass', method: 'POST', data: [Object], headers: [Object], paramsSerializer: [Function: paramsSerializer], body: '{"eventName":{"translatedValues":[{"kind":"walletobjects#eventTicketClass","language":"en-US","value":"RESIDENT CARD"}],"defaultValue":{"kind":"walletobjects#eventTicketClass","language":"el-GR","value":"ΚΑΡΤΑ ΔΗΜΟΤΗ"}},"eventId":"kLNIQ02OHDjhbu3xkNp8USxl6nOLSqv5HOLanEtK72I+9Gs9tdAZzFekY4G8DQ==","logo":{"sourceUri":{"uri":"https://www.crowdpolicy.com/wp-content/uploads/2020/01/kit-cp-icon-black.png"},"contentDescription":{"translatedValues":[{"kind":"walletobjects#eventTicketClass","language":"en-US","value":"Cityon Pass Logo"}],"defaultValue":{"kind":"walletobjects#eventTicketClass","language":"el-GR","value":"Cityon Pass Logo"}}},"id":"3388000000022115000.EVENTTICKET_OBJECT_0dd423dd-ccfd-4af9-b15a-87684bdf1916","issuerName":"Crowdpolicy","reviewStatus":"UNDER_REVIEW","review":{"comments":"This is a comment!"},"countryCode":"en-US","enableSmartTap":false,"hexBackgroundColor":"#03A5B9","localizedIssuerName":{"translatedValues":[{"language":"en-US","value":"Crowdpolicy"}],"defaultValue":{"language":"el-GR","value":"Crowdpolicy"}},"multipleDevicesAndHoldersAllowedStatus":"ONE_USER_ALL_DEVICES"}', validateStatus: [Function: validateStatus], responseType: 'json' }, data: { error: [Object] }, headers: { 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'cache-control': 'private', connection: 'close', 'content-encoding': 'gzip', 'content-type': 'application/json; charset=UTF-8', date: 'Tue, 09 Aug 2022 14:11:44 GMT', server: 'ESF', 'transfer-encoding': 'chunked', vary: 'Origin, X-Origin, Referer', 'x-content-type-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '0' }, status: 403, statusText: 'Forbidden', request: { responseURL: 'https://walletobjects.googleapis.com/walletobjects/v1/eventTicketClass' } }, config: { url: 'https://walletobjects.googleapis.com/walletobjects/v1/eventTicketClass', method: 'POST', data: { eventName: [Object], eventId: 'kLNIQ02OHDjhbu3xkNp8USxl6nOLSqv5HOLanEtK72I+9Gs9tdAZzFekY4G8DQ==', logo: [Object], id: '3388000000022115000.EVENTTICKET_OBJECT_0dd423dd-ccfd-4af9-b15a-87684bdf1916', issuerName: 'Crowdpolicy', reviewStatus: 'UNDER_REVIEW', review: [Object], countryCode: 'en-US', enableSmartTap: false, hexBackgroundColor: '#03A5B9', localizedIssuerName: [Object], multipleDevicesAndHoldersAllowedStatus: 'ONE_USER_ALL_DEVICES' }, headers: { Authorization: 'Bearer ya29.c.b0AXv0zTPfam2a9PzXQsnXtbr0rUqlmM3lYY8vuY2CBxtnTwjhyphJRaCfvgFu_SGaB3TEpQrhRap_fc_GOOYxaocgr-DYhdYRdQSPRISSksxDF0PUFlLACh3MhHwt7Iy9yy6QxvaHcz6_YKk0iDst0buF23A3vRj1tEurcd4Flbu6LEl6HPMBgEZHWbbNPAhMpvyMX_NqF4eq7-tQE0BiCVUWJAMYL0w........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................', 'User-Agent': 'google-api-nodejs-client/8.1.0', 'x-goog-api-client': 'gl-node/14.20.0 auth/8.1.0', 'Content-Type': 'application/json', Accept: 'application/json' }, paramsSerializer: [Function: paramsSerializer], body: '{"eventName":{"translatedValues":[{"kind":"walletobjects#eventTicketClass","language":"en-US","value":"RESIDENT CARD"}],"defaultValue":{"kind":"walletobjects#eventTicketClass","language":"el-GR","value":"ΚΑΡΤΑ ΔΗΜΟΤΗ"}},"eventId":"kLNIQ02OHDjhbu3xkNp8USxl6nOLSqv5HOLanEtK72I+9Gs9tdAZzFekY4G8DQ==","logo":{"sourceUri":{"uri":"https://www.crowdpolicy.com/wp-content/uploads/2020/01/kit-cp-icon-black.png"},"contentDescription":{"translatedValues":[{"kind":"walletobjects#eventTicketClass","language":"en-US","value":"Cityon Pass Logo"}],"defaultValue":{"kind":"walletobjects#eventTicketClass","language":"el-GR","value":"Cityon Pass Logo"}}},"id":"3388000000022115000.EVENTTICKET_OBJECT_0dd423dd-ccfd-4af9-b15a-87684bdf1916","issuerName":"Crowdpolicy","reviewStatus":"UNDER_REVIEW","review":{"comments":"This is a comment!"},"countryCode":"en-US","enableSmartTap":false,"hexBackgroundColor":"#03A5B9","localizedIssuerName":{"translatedValues":[{"language":"en-US","value":"Crowdpolicy"}],"defaultValue":{"language":"el-GR","value":"Crowdpolicy"}},"multipleDevicesAndHoldersAllowedStatus":"ONE_USER_ALL_DEVICES"}', validateStatus: [Function: validateStatus], responseType: 'json' }, code: 403, errors: [ { message: 'Permission denied.', domain: 'walletobjects', reason: 'permissionDenied' } ] }

Loyalty Pass update when data changes .NET Core

Hello, I have successfully integrated the Google Wallet Loyalty Pass into my .NET Core web application and I have passed to it some dynamic data like points, user tier, etc... However, these data will get updated upon redeeming offers or winning points. I need to know how I can update the loyalty card when the data changes, I read the official documentation of Google Wallet Official Documentation - Update A Loyalty Card but it has nothing technical and it's very ambiguous. If anyone could please help me understand it better.
Thanks in advance.

Notifications not working

For loyaltyClass, location based and addMessage notification not showing in lock screen. Is this working for loyalty also?
It says so on your home page.

PHP example with ServiceAccountCredentials class vs keyFilePath

Would it make more sense to use the ServiceAccountCredentials instance to retrieve the private key and client_email for signing the JWT token? Is this even possible?

I see it is instantiated in the demo...

$this->credentials = new ServiceAccountCredentials(
$scope,
$this->keyFilePath
);

... but never used:

// The service account credentials are used to sign the JWT
$serviceAccount = json_decode(file_get_contents($this->keyFilePath), true);
// Create the JWT as an array of key/value pairs
$claims = [
'iss' => $serviceAccount['client_email'],
'aud' => 'google',
'origins' => ['www.example.com'],
'typ' => 'savetowallet',
'payload' => $objectsToAdd
];
$token = JWT::encode(
$claims,
$serviceAccount['private_key'],
'RS256'
);

Asking because I'm trying to make my code as flexible as possible, for example using other authentication methods like in Google App Engine or GKE service account, I guess those don't really need the service account json file, right?

Thank you for clarification!
R

on java payload is always invalid not sure what's going on

Exception in thread "main" com.google.api.client.http.HttpResponseException: 400 Bad Request
POST https://walletobjects.googleapis.com/walletobjects/v1/genericClass/
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name "": Root element must be a message.",
"errors": [
{
"message": "Invalid JSON payload received. Unknown name "": Root element must be a message.",
"reason": "invalid"
}
],
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name "": Root element must be a message."
}
]
}
]
}
}

at com.google.api.client.http.HttpResponseException$Builder.build(HttpResponseException.java:293)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1118)
at DemoGeneric.main(DemoGeneric.java:111)

Creating generic pass with template info using google client library

Hello

Could you please let us know how to create programmatically a generic card pass in .net using google client library?
Would like to know to to define the filed path for my texmodules.

Something like this:

GenericObject newObject = new GenericObject
{
      TextModulesData = new List<TextModuleData>
                    {
                        new TextModuleData
                        {
                        Header = eventTicketDTO.NameLabel,
                        Body = eventTicketDTO.Name,
                        Id = "nome"


                        },
                        new TextModuleData
                        {
                        Header = eventTicketDTO.AssociatedLabel,
                        Body = eventTicketDTO.Associated,
                        Id = "socio"
                        },

                        new TextModuleData
                        {
                        Header = eventTicketDTO.BenchLabel,
                        Body = eventTicketDTO.Bench,
                        Id = "bancada",

                        }
            }
}

and class like

GenericClass newClass = new GenericClass
                {
                    Id = $"{issuerId}.{classSuffix}",
                    ClassTemplateInfo = new ClassTemplateInfo
                    {
                        CardTemplateOverride = new CardTemplateOverride
                        {
                            CardRowTemplateInfos = new List<CardRowTemplateInfo>
                            {
                                new CardRowTemplateInfo()
                                {
                                    OneItem = new CardRowOneItem
                                    {
                                       Item = new TemplateItem
                                       {
                                            FirstValue= new FieldSelector
                                            {
                                                Fields = new List<FieldReference>
                                                {
                                                    new FieldReference
                                                    {
                                                        FieldPath = "object.payload.genericObjects[0].textModulesData[0].id"

                                                    }
                                                }
                                            },
                                            SecondValue= new FieldSelector
                                            {
                                                Fields = new List<FieldReference>
                                                {
                                                    new FieldReference
                                                    {
                                                        FieldPath = "object.payload.genericObjects[0].textModulesData[0].id"
                                                    }
                                                }
                                            }


                                       }
                                    }
                                },
                    }
         }
    }

For some reason all of my attemps its not working, its not defining a template and referencing the values

Thanks a lot!

Generic Pass Upcoming Notifications .NET Core

Greetings, I have successfully integrated the google wallet API in my .NET Core application and used the generic pass template.
I need to know how to implement the upcoming notifications feature in it, I have seen the official wallet documentation but couldn't figure it out if anyone has implemented it. I really appreciate any help I can get.

Getting permission denied while creating passClass

#STEPS FOLLOWED:

  • Created service account and created new key.
  • Downloaded service.json file.
  • Loaded service.json file,and initialize the google client.
  • Setuped the axios api call with required payload.
  • After verifying the error comes,after api call,It return's wallet object permission access denied.

@stephenmcd Suggest me the best solution to rectify the issue and let me know the steps to provide the access to particular service account for wallet object permission.

Thank You!!

In python some pip errors

First:
from google.auth.transport.requests import AuthorizedSession
ModuleNotFoundError: No module named 'google'
Second: ### Solved
'pipenv' is not recognized as an internal or external command,
operable program or batch file
I solved the second one by searching the internet and downloading it.

save url not working

Hello,

I'm working on the node example to test the generation of the generic wallet pass, however, I can't seem to generate a valid save url using the example code provided,

is there anything that I'm missing required to successfully create the pass?

Wallet countries supported still a big question mark

How does Google expect developers to engage with the Wallet APis when you keep locked up the list of countries where Google Wallet will be available?

Also, Google ensures there's no way for developers to send suggestions or comments regarding APIs. All your blogs lack feedback section, YouTube comments are universally ignored, and so on.

Issue when we make an api call

We are getting error as - "Service account email address did not have edit access on the issuer."

This error appears when we make an api call after creating a service account and given admin role. What could be the issue?

Add message in pass always gives error regarding the message type

Hello,
I am trying to use this endpoint : https://developers.google.com/wallet/tickets/events/rest/v1/eventticketobject/addmessage, in order to send a message to the user that has added the pass ij the GPay. I am building the message body like this :
message: { kind: "walletobjects#walletObjectMessage", header: header, body: body, // displayInterval: { // kind: "walletobjects#timeInterval", // start: { // date: start_date // }, // end: { // date: end_date // } // }, id: "message_id", messageType: { type: "string", enum: ["NOTIFICATION_EXPIRY"] } } and I am always getting this error :

  code: 400,
   errors: [
     {
         message: "Invalid value at 'add_message_request.message' (message_type), Starting an object on a scalar field",
         reason: 'invalid'
     }
  ] 

Is there an other way to use enum in json ?

Error 403

class POST response: { "error": { "code": 403, "message": "Permission denied.", "errors": [ { "message": "Permission denied.", "domain": "walletobjects", "reason": "permissionDenied" } ] } } object GET or POST response: { "error": { "code": 403, "message": "Permission denied.", "errors": [ { "message": "Permission denied.", "domain": "walletobjects", "reason": "permissionDenied" } ] } } https://pay.google.com/gp/v/save/eyJ0eXAi...

Does someone know why I get this error?

Pass fields font

Is it possible to change the pass fields font in the google passes that we have?

Invalid resource ID

When i put something as a classid for creating a ticket example i recive this

 code: 400,
  errors: [
    {
      message: 'Invalid resource ID: invitio.invitioticket',
      domain: 'walletobjects',
      reason: 'invalidResource'
    }
  ]

Google Wallet Generic Pass Removing Card Title and Custom Font Color

Prerequisites

I am working on the dotnet implementation of the Generic Pass and as per our need I don't want to display the Card Title and I also want to display a custom font color for the text on the front side of the Generic Pass. But when the card title field is set to null the card is not added in the wallet rather it displays Something went wrong message in Google Wallet.

Expected Behavior

  • When I set the card title to null in the GenericObject the title should be set to null or empty string, and it should not be displayed when the card is added to Google Wallet via Google Pay API link.
  • The card should be added successfully to the wallet regardless of the CardTitle added or not in the JWT Payload

Current Behavior

  • The card is not added in the Google Wallet and instead the message Something went wrong appears.

Steps to Reproduce

  1. Remove the CardTitle field from the GenericObject or set the field to string.Empty or " " or null
  2. Convert the model to JwtObject and create the payload
  3. Create the JWT token add/concat it to the Google Pay API link
  4. Use the link to add the card to the Google Wallet

Context

  • Operating System: Windows 10
  • Browser: Microsoft Edge
  • Android Version: 13
  • Google Apis Version: 1.62.0

Screenshots

No Card Title Added

Barcode type must be set error since update

Hello,

I'm using the PHP generic card sample.

Since I updated my dependencies:

  • Upgrading google/auth (v1.30.0 => v1.34.0)
  • Upgrading google/apiclient-services (v0.317.0 => v0.332.0)
  • Upgrading google/apiclient (v2.15.1 => v2.15.3)

I got this error from Google API:
{ "error": { "code": 400, "message": "Barcode type must be set.", "errors": [ { "message": "Barcode type must be set.", "domain": "walletobjects", "reason": "invalidResource" } ] } }

Did you experience something like this recently ?

Thanks

修改会员卡信息

请问Node.js中创建了会员卡之后, 如何修改会员卡中的积分以及有效期

Problem with generate google passes using .Net C#

Hi,

I tried to implement C# code to generate google generic pass but no success I got. I tried lost of docs & article but didn't found a fruitful result. Anyone can help me to generate google pass using .NET C# please? I've tried all those steps with VS 2022 like below:

Prerequisites

Environment variables

The following environment variables must be set. Alternatively, you can update
the code files to set the values directly. They can be found in the constructor
for each class file.

Enviroment variable Description Example
GOOGLE_APPLICATION_CREDENTIALS Path to a Google Cloud service account key file /path/to/key.json

How to use the code samples

  1. Open the wallet-rest-samples.csproj file
    in your .NET editor of choice.

  2. Copy the path to the Google Wallet API Client library (
    Google.Apis.Walletobjects.v1.csproj file) you downloaded. If needed, update
    the path in wallet-rest-samples.csproj (line
    19).

    <CodeFiles Include="lib/Google.Apis.Walletobjects.v1.cs" />
  3. Build the project to install the dependencies.

  4. In your C# code, import a demo class and call its method(s).

Google service "Walletobjects" does not exist or was removed previously

Hello,

I am going to add google wallet feature in my laravel website, i did follow instruction which added in readme file. I update my composer file as bellow :

{
"require": {
"google/auth": "^1.18",
"guzzlehttp/guzzle": "*",
"google/apiclient": "^2.15",
"google/apiclient-services": "~0.300"
},
"scripts": {
"pre-autoload-dump": "Google\Task\Composer::cleanup"
},
"extra": {
"google/apiclient-services": [
"Walletobjects"
]
}
}

ut when i am trying to run "composer install" command in my mac terminal return error :

[InvalidArgumentException]
Google service "Walletobjects" does not exist or was removed previously

Please give me some ideal how to resolve this problem or add this missing "Walletobjects" file?

GITHUB_TOKEN Permissions Actions: write Checks: write Contents: write Deployments: write Discussions: write Issues: write Metadata: read Packages: write Pages: write PullRequests: write RepositoryProjects: write SecurityEvents: write Statuses: write Secret source: Actions Prepare workflow directory Prepare all required actions Getting action download info Download action repository 'actions/checkout@v4' (SHA:b4ffde65f46336ab88eb53be808477a3936bae11) Download action repository 'actions/setup-python@v4' (SHA:65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236) Complete job name: update-date

problem running the example

  1. Hello, I've written a class:

    public class mainValter {
    public static void main(String[] args) {
    //Create and set up the window.
    try {
    DemoEventTicket demo = new DemoEventTicket();
    demo.Auth();
    // Create a pass class
    demo.CreateEventTicketClass("3388.............", "3388..............00eac45a-.............");
    } catch (Exception e) {

     		System.out.print ("Eccezione: " + e.getMessage());
     	}
    
     }
    

    }

mainValter.java in the same folder as the same java, compile is ok, but when i try to run it jar are missing, what to put into gradle.build to download jar so that i can put them in the classpath?

  1. using this gradle

plugins {
id 'java'
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}

configurations {
toCopy
}

dependencies {
// Replace with path to your local download of the Google Wallet library
implementation files('/Users/valtermazzola/Downloads/wallet-samples-main/java/libwalletobjects_public_java_lib_v1.jar')

toCopy 'com.auth0:java-jwt:3.19.1'
toCopy 'com.auth0:jwks-rsa:0.9.0'
toCopy 'com.fasterxml.jackson.core:jackson-databind:2.13.4'
toCopy 'com.google.apis:google-api-services-oauth2:v1-rev20190313-1.30.3'
toCopy 'com.google.api-client:google-api-client:1.25.0'
toCopy 'com.google.auth:google-auth-library-oauth2-http:1.10.0'
toCopy 'com.squareup.okhttp3:okhttp:4.3.1'
toCopy 'javax.json:javax.json-api:1.1'
toCopy 'org.glassfish:javax.json:1.1'
}

task download(type: Copy) {
from configurations.toCopy
into 'lib'
}

I was able to download jars:

-rw-r--r-- 1 valtermazzola staff 17536 12 Ott 12:50 annotations-13.0.jar
-rw-r--r-- 1 valtermazzola staff 7495 12 Ott 12:50 auto-value-annotations-1.9.jar
-rw-r--r-- 1 valtermazzola staff 5852 12 Ott 12:50 checker-compat-qual-2.5.5.jar
-rw-r--r-- 1 valtermazzola staff 208835 12 Ott 12:50 checker-qual-3.12.0.jar
-rw-r--r-- 1 valtermazzola staff 344339 12 Ott 12:50 commons-codec-1.13.jar
-rw-r--r-- 1 valtermazzola staff 214788 12 Ott 12:50 commons-io-2.6.jar
-rw-r--r-- 1 valtermazzola staff 61829 12 Ott 12:50 commons-logging-1.2.jar
-rw-r--r-- 1 valtermazzola staff 14835 12 Ott 12:50 error_prone_annotations-2.7.1.jar
-rw-r--r-- 1 valtermazzola staff 4617 12 Ott 12:50 failureaccess-1.0.1.jar
-rw-r--r-- 1 valtermazzola staff 205683 12 Ott 12:50 google-api-client-1.30.3.jar
-rw-r--r-- 1 valtermazzola staff 20641 12 Ott 12:50 google-api-services-oauth2-v1-rev20190313-1.30.3.jar
-rw-r--r-- 1 valtermazzola staff 5959 12 Ott 12:50 google-auth-library-credentials-1.10.0.jar
-rw-r--r-- 1 valtermazzola staff 214352 12 Ott 12:50 google-auth-library-oauth2-http-1.10.0.jar
-rw-r--r-- 1 valtermazzola staff 292703 12 Ott 12:50 google-http-client-1.42.2.jar
-rw-r--r-- 1 valtermazzola staff 10580 12 Ott 12:50 google-http-client-gson-1.42.2.jar
-rw-r--r-- 1 valtermazzola staff 8492 12 Ott 12:50 google-http-client-jackson2-1.32.0.jar
-rw-r--r-- 1 valtermazzola staff 66777 12 Ott 12:50 google-oauth-client-1.30.2.jar
-rw-r--r-- 1 valtermazzola staff 30073 12 Ott 12:50 grpc-context-1.27.2.jar
-rw-r--r-- 1 valtermazzola staff 249277 12 Ott 12:50 gson-2.9.0.jar
-rw-r--r-- 1 valtermazzola staff 2804059 12 Ott 12:50 guava-31.0.1-android.jar
-rw-r--r-- 1 valtermazzola staff 780321 12 Ott 12:50 httpclient-4.5.13.jar
-rw-r--r-- 1 valtermazzola staff 328324 12 Ott 12:50 httpcore-4.4.15.jar
-rw-r--r-- 1 valtermazzola staff 8781 12 Ott 12:50 j2objc-annotations-1.3.jar
-rw-r--r-- 1 valtermazzola staff 75717 12 Ott 12:50 jackson-annotations-2.13.4.jar
-rw-r--r-- 1 valtermazzola staff 374895 12 Ott 12:50 jackson-core-2.13.4.jar
-rw-r--r-- 1 valtermazzola staff 1536894 12 Ott 12:50 jackson-databind-2.13.4.jar
-rw-r--r-- 1 valtermazzola staff 57585 12 Ott 12:50 java-jwt-3.19.1.jar
-rw-r--r-- 1 valtermazzola staff 125521 12 Ott 12:50 javax.json-1.1.jar
-rw-r--r-- 1 valtermazzola staff 28540 12 Ott 12:50 javax.json-api-1.1.jar
-rw-r--r-- 1 valtermazzola staff 19936 12 Ott 12:50 jsr305-3.0.2.jar
-rw-r--r-- 1 valtermazzola staff 15235 12 Ott 12:50 jwks-rsa-0.9.0.jar
-rw-r--r-- 1 valtermazzola staff 1328852 12 Ott 12:50 kotlin-stdlib-1.3.61.jar
-rw-r--r-- 1 valtermazzola staff 170993 12 Ott 12:50 kotlin-stdlib-common-1.3.61.jar
-rw-r--r--@ 1 valtermazzola staff 361478 12 Ott 14:10 libwalletobjects_public_java_lib_v1.jar
-rw-r--r-- 1 valtermazzola staff 2199 12 Ott 12:50 listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
-rw-r--r-- 1 valtermazzola staff 752264 12 Ott 12:50 okhttp-4.3.1.jar
-rw-r--r-- 1 valtermazzola staff 240710 12 Ott 12:50 okio-jvm-2.4.1.jar
-rw-r--r-- 1 valtermazzola staff 355405 12 Ott 12:50 opencensus-api-0.31.1.jar
-rw-r--r-- 1 valtermazzola staff 23415 12 Ott 12:50 opencensus-contrib-http-util-0.31.1.jar

but executiong gives error:

java -cp /Users/aaaa/Downloads/wallet-samples-main/java/lib:/Users/aaaa/Downloads/wallet-samples-main/java/build/classes/java/main mainValter
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/auth/Credentials
at mainValter.main(mainValter.java:8)
Caused by: java.lang.ClassNotFoundException: com.google.auth.Credentials
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

What is the problem?

Thanks,
Valter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.