NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - JHojka

Pages: [1] 2 3 4
1
Fresh day with fresh results.  ;D. I used the name of the view 'MSCView' and not what I was shown in debugview++ 'View|1'. Once I changed this I saw the translation take place for my return results.

What worked is in BuildResultsFields at Priority 5000 I added code similar to the following.

        renameView = 'view|1'
        renameViewField = UPPER('MSCVER:VersionSequence')
        renameViewJson = 'VersionSequence'
        json.reflection.SetRename(renameView, renameViewField, renameViewJson)

Jeff

2
I have several tables that I need to change the way the json is created. I originally had used the external name of the table field to force the json to use upper and lower case. This worked great but, I have to convert these tables to the IPDriver which has proven to not like external names on any fields. Removing the external names fixes all my IPDriver problems but now my nettalk web service methods are not properly setup to translate the json. I found that reflection might be able to solve my issue. I have been able to use json.reflection.walk() to see what is being done with the json. I have been able to use json.reflection.rename() to change the reflection entry. I am not able to figure out where to put this code as I am not getting the results I would like. Nothing is actually getting renamed. I only see that I will need to make these translations on loading and saving of the table for gets as well as updates and adds.

from debugview

797   611.954211   7984   MSCClientWeb.exe   [3][rf]FIELD: GroupName=[MSCVERView] ColumnName=[MSCVER:VERSIONSEQUENCE] Num=[0] Type=[rf:NotSet] Rename=[VersionSequence] Pic=[] Attributes=[]


Any help would be appreciated on this.

3
Web Server - Share Knowledge / CyberSource Payment API
« on: April 13, 2023, 07:07:23 AM »
Code for creating the post and header information.

  MAP
CyberSource:FormatMessage (),STRING
CyberSource:GenerateHeader (*NetWebClient pWeb,STRING PostString)
CyberSource:GenerateSignatureFromParams(STRING signatureParams, STRING secretKey),STRING
  END

CODE
      PostURL = 'https://apitest.cybersource.com/pts/v2/payments'
      PostString = CyberSource:FormatMessage()
      CyberSource:GenerateHeader(ThisWebClient, PostString)     
      ThisWebClient.Post(PostURL,PostString)

CyberSource:FormatMessage PROCEDURE

element                  Group,Name('element')
clientReferenceInformation Group,Name('clientReferenceInformation')
code_                        STRING(255),Name('code')
                           End
paymentInformation         Group,Name('paymentInformation')
card                         Group,Name('card')
number                         STRING(255),Name('number')
expirationMonth                STRING(255),Name('expirationMonth')
expirationYear                 STRING(255),Name('expirationYear')
                             End
                           End
orderInformation           Group,Name('orderInformation')
amountDetails                Group,Name('amountDetails')
totalAmount                    STRING(255),Name('totalAmount')
currency                       STRING(255),Name('currency')
                             End
billTo                       Group,Name('billTo')
firstName                      STRING(255),Name('firstName')
lastName                       STRING(255),Name('lastName')
address1                       STRING(255),Name('address1')
locality                       STRING(255),Name('locality')
administrativeArea             STRING(255),Name('administrativeArea')
postalCode                     STRING(255),Name('postalCode')
country                        STRING(255),Name('country')
email                          STRING(255),Name('email')
phoneNumber                    STRING(255),Name('phoneNumber')
                             End
                           End
                         End

json                     jsonClass
strElement StringTheory

  CODE

  CLEAR(element)
  element.clientReferenceInformation.code_ = 'TC50171_3'
  element.paymentInformation.card.number = '4111111111111111'
  element.paymentInformation.card.expirationMonth = '12'
  element.paymentInformation.card.expirationYear = '2031'
  element.orderInformation.amountDetails.totalAmount = '102.21'
  element.orderInformation.amountDetails.currency = 'USD'
  element.orderInformation.billTo.firstName = 'John'
  element.orderInformation.billTo.lastName = 'Doe'
  element.orderInformation.billTo.address1 = '1 Market St'
  element.orderInformation.billTo.locality = 'san francisco'
  element.orderInformation.billTo.administrativeArea = 'CA'
  element.orderInformation.billTo.postalCode = '94105'
  element.orderInformation.billTo.country = 'US'
  element.orderInformation.billTo.email = 'test@cybs.com'
  element.orderInformation.billTo.phoneNumber = '4158880000'
  json.start()
  json.SetTagCase(jf:CaseAsIs)
  json.Save(element,strElement)
  strElement.LineEndings(st:Unix)
  return strElement.GetValue()

CyberSource:GenerateHeader PROCEDURE  (*NetWebClient pWeb,STRING PostString)

lSecretKey STRING(100)
KeyId STRING(100)
MerchantId  STRING(100)
HostName  STRING(100)
HostTarget  STRING(100)

strPost   StringTheory
strHost   StringTheory

  CODE

      lSecretKey = 'yourkey'
      KeyId = 'yourid'
      MerchantId = 'yourco'

      HostName = 'apitest.cybersource.com'
      HostTarget = 'post /pts/v2/payments/'

      strPost.SetValue(CLIP(PostString))
      strPost.SetValue(NetMakeHash(strPost.GetValuePtr(),strPost.Length(),net:CALG_SHA_256))
      strPost.Base64Encode()

      strHost.SetValue('host: ' & CLIP(HostName) & '<10>' &|
                                   '(request-target): ' & CLIP(HostTarget) & '<10>' &|
                                   'digest: SHA-256=' & strPost.GetValue() & '<10>' &|
                                   'v-c-merchant-id: ' & CLIP(MerchantId) & '')

      pWeb.CustomHeader = 'v-c-merchant-id: ' & CLIP(MerchantId) & '<13,10>' &|
                                   'v-c-date: "' & CLIP(pWeb.CreateGMTDate()) & '"' & '<13,10>' &|
                                   'digest: SHA-256=' & strPost.GetValue() & '<13,10>' &|
                                   'Signature: keyid="' & CLIP(KeyId) & '", algorithm="HmacSHA256",' &|
                                   ' headers="host (request-target) digest v-c-merchant-id", signature="' &|
                                   CyberSource:GenerateSignatureFromParams(strHost.GetValue(), lSecretKey) & '"'

CyberSource:GenerateSignatureFromParams PROCEDURE  (STRING signatureParams,STRING secretKey) ! Declare Procedure

strParams StringTheory
strKey StringTheory

  CODE

  strParams.SetValue(signatureParams,st:clip)
  strKey.SetValue(secretKey,st:clip)
  strKey.Base64Decode()
  strParams.ToUnicode()
  strParams.SetValue(NetMakeHMAC(strParams.GetValuePtr(), strParams.Length(), strKey.GetValue(), net:CALG_SHA_256))
  strParams.Base64Encode()
  return strParams.GetValue() 

4
Web Server - Ask For Help / WebService and SetSessionLoggedIn
« on: February 22, 2023, 10:56:42 AM »
I would like to have two services.

ServiceA is the login service call
ServiceB must have been logged in using ServiceA

Are there examples of how to use SetSessionLoggedIn with WebServices. I cant figure it out on my own. I saw that there was going to be a webinar on this but couldnt find it.

I tried SetSessionLoggedIn(True) in ServiceA but it appears that this has a different SessionID then when I try to GetSessionLoggedIn in ServiceB. I can see that there seams to be a cookie SessionIDX. but not sure if this is helpful or not. How I would use it in ServiceB.

I found this routine

CheckForToken  routine

Should I be swapping out the session ID here? If so then how is that done? On the client I am suing nettalk for all calls to the web services.

Jeff

5
Reading the docs is where its at!

Is the code I chose wrong? It works so I am curious to know if there is a different reason to use your coding method.

Jeff

6
This is what worked.

 json.LoadString(p_web.getvalue('_json_'))
 json.Load(element)

7
I put this exact line of code in my program and I no longer get a GPF. The result is that I now have a empty group without any of the post data. Not the result I had hoped for.

Here is my new code

  json.start()
  json.SetTagCase(jf:CaseAsIs)
  json.Load(element,p_web.getvalue('_json_'))
  json.Save(element,'D:\dev\json\webjson.txt')

Here is my POST

POST / HTTP/1.1
Host: 127.0.0.1:88
Connection: keep-alive
Content-Length: 434
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="101", "Google Chrome";v="101"
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36
sec-ch-ua-platform: "Windows"
Content-Type: application/json
Accept: */*
Origin: chrome-extension://gmmkjpcadciiokjpikmkkmapphbmdjok
Sec-Fetch-Site: none
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: SESSIONIDX=7jL0Kz8nZLNojwuLMN3hmVMJaV3SxK

{"notificationId":"e73d5945-f462-46aa-b757-37e4635c7fac","eventType":"net.authorize.customer.subscription.expiring","eventDate":"2022-05-11T09:21:04.1574729Z","webhookId":"5f77108b-039f-4c20-9157-b0b9049c4ddf","payload":{"name":"TEST PERSON","amount":100,"status":"active","profile":{"customerProfileId":505297168,"customerPaymentProfileId":508334454,"customerShippingAddressId":507148838},"entityName":"subscription","id":"8119550"}}

Here is my result.

{
   "notificationId" : "",
   "eventType" : "",
   "eventDate" : "",
   "webhookId" : "",
   "payload" : {
      "responseCode" : 0,
      "authCode" : "",
      "avsResponse" : "",
      "authAmount" : 0,
      "invoiceNumber" : "",
      "entityName" : "",
      "id" : ""
   }
}

What am I not understanding

Jeff

8
Web Server - Ask For Help / load Webhook POST data load to a queue
« on: May 10, 2022, 08:32:27 AM »
How can I access the POST data section and load this into a group.

The data is in json format. I have tried my best to work with p_web.RequestData.

Here is the group

element                  Group,Name('element')
notificationId             STRING(255),Name('notificationId')
eventType                  STRING(255),Name('eventType')
eventDate                  STRING(255),Name('eventDate')
webhookId                  STRING(255),Name('webhookId')
payload                    Group,Name('payload')
responseCode                 Real,Name('responseCode')
authCode                     STRING(255),Name('authCode')
avsResponse                  STRING(255),Name('avsResponse')
authAmount                   Real,Name('authAmount')
invoiceNumber                STRING(255),Name('invoiceNumber')
entityName                   STRING(255),Name('entityName')
id                           STRING(255),Name('id')
                           End
                         End

json                     jsonClass

  json.start()
  json.SetTagCase(jf:CaseAsIs)
  json.Load(element,p_web.RequestData.DataStringTheory) ! Load From a StringTheory object

This code GPF's

This is the POST data

{"notificationId":"1a5bf2dd-e05d-4224-8157-459f0f11f40e","eventType":"net.authorize.payment.authcapture.created","eventDate":"2022-05-06T08:49:50.3674712Z","webhookId":"5f77108b-039f-4c20-9157-b0b9049c4ddf","payload":{"responseCode":1,"authCode":"AQSOEP","avsResponse":"P","authAmount":123.1,"invoiceNumber":"211210110","entityName":"transaction","id":"40091147498"}}

Jeff


9
Send button click to server seems to be what I am looking for.


10
I want to run a source procedure from a betwebbrowse button

I created my button and onclick I put the name of the procedure. When I run my website I get a message that the page is not found.

What I want to do is add a button to a browse (I think I figured this out) call my source (not sure i understand how this works) and have my source re serve the browse it was called from.

Ideally an example app i can look at would be fantastic!

Here is my source.

UpdateMSCCLSource             PROCEDURE  (NetWebServerWorker p_web) ! Declare Procedure
FilesOpened     BYTE(0)
  CODE
      DO OpenFiles
      MSCCS:SystemGUID = p_web.GetSessionValue('MSCCS:SystemGUID')
      IF Access:MSCCS.Fetch(MSCCS:SystemGUIDKey) = Level:Benign AND MSCCS:SessionState <> 'Inactive'
        MSCCS:Action = 0
        Access:MSCCS.Update()
      END
      DO CloseFiles 

OpenFiles  ROUTINE
  Access:MSCCS.Open()
  Access:MSCCS.UseFile() 
  FilesOpened = True

CloseFiles ROUTINE
  IF FilesOpened THEN
     Access:MSCCS.Close()
     FilesOpened = False
  END

Thank You.

11
I noticed a small mistake in my message which i already corrected in my code. .msc-OptionButton should be .msc-optionbutton since CSS is case sensitive. I tried your idea to add a space but this did nothing different.

Does it look like I am doing this correctly?

Jeff

12
I have a custom css file located in

application folder\web\styles\custom.css

I added a class like the following

.msc-OptionButton {
 display: block;
 width: 5em;
 height: 2em;
 border: none;
 background-color: red;
 color: black;
 padding: 1px 1px;
 font-size: 48px !important;
 text-align: center;
 }

I the NetTalk ThisWebServer under Settings->styles->Files->CSS Style Files  have my Custom.css file listed 'Custom.css' Browser all and is included in themese.css checked.

Under NetWeb Form->Actions->Fields->Properties->Field BUTTON properties->CSS->Button CSS Class='msc-optionbutton'

When I inspect the element in chrome I see the following

<button type="button" name="WebLookup_AccountDetail_btn" id="WebLookup_AccountDetail_btnh8o8" value="Account Detail" class="nt-flex msc-optionbutton ui-button ui-corner-all ui-widget" onclick="location.href='WebLookup_AccountDetailMenu?&amp;PressedButton='" data-form="weblookup_accountpage">Account Detail</button>

I first see that my css class is listed before the ui-button class. I also can not get my button to use the css class.

Can someone help me put together the step I am missing? Is there a step by step on how to start using CSS?

Jeff Hojka
Khojant LLC

13
Web Server - Ask For Help / Re: Browse button for a report
« on: April 21, 2020, 04:37:16 AM »
Thank you very much. WindowOpen is such an odd name for a web procedure. Option A) does the trick and it allows me select the page which is a bonus.

Jeff

14
Web Server - Ask For Help / Browse button for a report
« on: April 20, 2020, 08:49:38 AM »
I have a browse button that calls a report. I need to have a browse that I conditionally load before the report is called.

Should I use redirection? If so how do I redirect from one nettalk webpage to another?

Jeff

15
Never mind! The site uses an XML file to store the path of the web folder. Changing this worked.

Jeff

Pages: [1] 2 3 4