Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
joules-o
@joules-o
Cool, thank you!
lightningudemy
@lightningudemy

Good afternoon all, I am seeking information on where I went wrong with my code. I am receiving an error code stating the public key could not be found.

Here is my backend code:

import {fetch} from 'wix-fetch';  
import {wixData} from 'wix-data';


export function postLoyalty() {
 let options ={
 "headers": {        
 "X-Public": "pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76"
        }
  }
 const url = 'https://whisqr.com/api/v1.2/user/customer/';
 const key = '<pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76>';
     console.log("Url: ");

 return fetch(url, {method: 'post'})
    .then(response => {
 return response.json();
    })
    .then((data) => {
      console.log(data);
 return data;
    });
}

Here is my page code

import {postLoyalty} from 'backend/Loyalty.jsw';
import {wixData} from 'wix-data';
import wixLocation from "wix-location";
import {myFunction} from 'public/core.js';
import wixUsers from 'wix-users';


$w.onReady(function () {
 let publickey = 'pk_live_ba43e74df464cbf521dd07ee20443ff754c3afc11adc16df2594facb2147cd76';
    myFunction(publickey)
    .then( (response) => {
        console.log(response); //your base64 encoded string
    })});

export function page1_viewportEnter(event) {
 //Add your code for this event here: 
 let email = wixUsers.currentUser.getEmail();
postLoyalty(email)
        .then(LoyaltyInfo => {
            console.log(LoyaltyInfo)
            $w("#text1").text = LoyaltyInfo.Results.Value;
        })
}

I know this is a lot but I am at my wits end on how to deal with this. Any and all feedback is greatly appreciated!

Yutao Zhang
@lava1206
Hello
How are you doing?
I am going to add rating function to wix estore site and I need help on how to do it. I have searched the video and tried to find way, but it's all demo and not the way I want.
I want users can submit reviews and rating and they can see the overall rating of the service. The idea is clear, but due to the lack of wix experience I can't even edit current service page. I am open to anyone's voice who has similar experience.
Yutao Zhang
@lava1206
I am STUCK right now and really WANT your HELP.
Thank you first
Tomer Gabel
@holograph
@lava1206 @lightningudemy As I have previously explained, this channel pertains specifically to the Accord library. Most people here aren’t necessarily knowledgeable about Wix Code, and in either case this isn’t the right channel for these questions.
Yutao Zhang
@lava1206
@holograph I see thank you
where are the real wix chat room
none of them are responding
all are vain rooms
Tomer Gabel
@holograph
Sorry @lava1206, I honestly don’t have a clue, I was in a different group and no longer employed by Wix regardless
Yutao Zhang
@lava1206
OK, thank you
Fredrik Wärnsberg
@frekw
I can't seem to figure out a good way to do dependent validation. I.e I want to specify a validation for some input objects, but in order to determine if the input is valid or not I need some other pieces of data. I guess a super simple example would be something like
case class ReplaceInStringVector(
  index: Int,
  value: String
)

implicit val replaceValidator = validator[ReplaceInStringVector] { r =>
  r.index should be >= 0
  r.index should be <= vector.length // <- how to get vector in here
}
So what I'm currently doing is doing it in two passes, where the first one uses Accord and a second pass uses plain logic, but returns the same datastructures as Accord. But it doesn't feel super elegant
I've also toyed with defining validations for e.g Tuple[ReplaceInStringVecotor, Vector[String]], but that mangles the validation errors quite a bit :)
Tomer Gabel
@holograph
You should be able to refer to static members (I.e. companion objects), or even class members if you’re instantiating your validators on the fly
Tomer Gabel
@holograph
Fredrik Wärnsberg
@frekw
@holograph ah, clever! I'll try it out tomorrow. Thanks!
Tomer Gabel
@holograph
@frekw Cool, let me know if that helps or not :-)
Fredrik Wärnsberg
@frekw
Still sorta new to Scala, neat that you can dynamically define implicits like that :)
I don't know why I always considered them as static
Tomer Gabel
@holograph
They’re often used as statics, but nothing is forcing you to do so...
Fredrik Wärnsberg
@frekw
Is it possible to make validators short-circuit somehow using and? I.e get this to work?
(r.index is between (0, v.length - 1)) and (r.value == v(r.index))
(I could use if, but then I need to implement the index check twice)
Tomer Gabel
@holograph
Not without a custom validator; the rationale is that, For validation, you want ALL rules to be evaluated (in order to produce a full error). That’s why and doesn’t short circuit.
Fredrik Wärnsberg
@frekw
Ah, fair enough
Andy Czerwonka
@andyczerwonka
Does anyone know who we can contact around Accord? Activity looks stagnant, does anyone know if it's a maintained project?
Tomer Gabel
@holograph
Hi Andy, I'm still involved but no longer have maintainer privileges. https://github.com/noam-almog is your guy.
It might help to mention you, @andyczerwonka :-)
Andy Czerwonka
@andyczerwonka
Thanks @holograph
@holograph given there's a pretty healthy backlog https://github.com/wix/accord/issues and not significant commits in months, is it because users are using it "as is" and it's "good enough", or have people moved off of Accord to something else?
Andy Czerwonka
@andyczerwonka
I created an issue wix/accord#153 to see if I could collect some feedback.
Tomer Gabel
@holograph
I suspect it’s a combination of both. The biggest user is Wix, where I developed Accord, but I haven’t been working for the company over two years so no clue how they’re doing
Andy Czerwonka
@andyczerwonka
Thanks. I wasn't sure how to contact the maintainers, so I figured creating an issue might be best. We'll see.
It feels like https://github.com/krzemin/octopus is inspired by Accord
Sidra Tariq
@sidratariqq

trait ControlSegmentConfigStructure {
  val ISAHeader: Option[ISAHeaderStructureImpl]
  val GSHeader: Option[GSHeaderStructureImpl]
  val STHeader: Option[STHeaderStructureImpl]
  val BHTHeader: Option[BHTHeaderStructureImpl]
  val `1000A`: Option[`1000AStructureImpl`]
  val `1000B`: Option[`1000BStructureImpl`]
  val   traceNumber :Option[String]
}
trait ControlSegmentConfigStructureValidator[T <: ControlSegmentConfigStructure] {
  import com.wix.accord.dsl._

  def controlSegmentConfigStructureValidator(transactionType: Int): TransformedValidator[T] = validator[T] { o =>

    o.ISAHeader.isDefined as InvalidStructureValidationError("ControlSegmentConfig","ISAHeader").toString is equalTo(true)
    o.ISAHeader.each is valid

    o.GSHeader.isDefined as InvalidStructureValidationError("ControlSegmentConfig","GSHeader").toString is equalTo(true)
    o.GSHeader.each is valid

  }
]
Here is my scala code where scala accord is implemented. I am unable to figure out how toString is equalTo(true) is working here.
I need to implement a validation for traceNumber. So it's always 10
Tomer Gabel
@holograph

I suspect you’re reading it wrong - it’s not toString is equalTo(...), but rather o.GSetc as (etc.toString) is equalTo(...).

I’d be happy to explain further as needed...

Sidra Tariq
@sidratariqq
@holograph wix/accord don't have InvalidStructureValidationError it should be defined in my codebase which i don't seem to find. Is this case?
Tomer Gabel
@holograph
I'm... not sure where you got that code, but in either case that's not an Accord type.
Webb Lin
@webblin034

Hi, we found some Accord's limitations when defining a validator, but they doesn't be documented in the official sites, for examples:

  1. Can’t use "pattern match" in very first position.
  2. Can't use "if-else if-else" to verify multiple assertions.
  3. Can’t use multiple conditions in "if" statement.
  4. Can't use "if" condition in a pattern match.
  5. Can’t extract out a value variable from pattern match results.

Can you help us eliminate these issues, thanks.

Tomer Gabel
@holograph
All of these are intended to be supported, can you please open a bug (ideally with a reproduction sample)?
By intended I mean “supposed to be”
Webb Lin
@webblin034
Please support to eliminate these possible issues as following :
Accord Issue #155 : Can’t use “pattern match” in very first position when defining validator with DSL
Accord Issue #156 : Can’t extract out a value variable from pattern match results when defining validator with DSL
Accord Issue #157 : Can’t use “if-else if-else” or “if-else” to verify multiple assertions when defining validator with DSL
Accord Issue #158 : Can’t use “if-else” in very first position when defining validator with DSL
Accord Issue #159 : Can’t use “if” condition in a pattern match when defining validator with DSL
Accord Issue #160 : Need to add “()” to imply discarded non-Unit value to suppress error when defining validator with DSL
refer to https://github.com/wix/accord/issues
Webb Lin
@webblin034
Hi @holograph any idea about these issues mentioned as above ?
Tomer Gabel
@holograph
Well, it’s an open source project, so the volunteers that contribute (myself included) will get to it eventually. Otherwise, pull requests welcome :-)