Skocz do zawartości

Allegro Poczta Polska

Polecane posty

Witam,

Z racji tego, że na przesyłki Allegro Poczta Polska nie potrzeba podpisywać umowy z Pocztą, tylko bezpośrednio są rozliczane paczki z Allegro myślałem nad tym aby również u nas takie opcje wysyłki uruchomić.

Aby wczytać paczki w EN, używamy transformaty, z tym że jak przeglądałem dokumentację techniczną, to jest albo telefon albo adres e-mail do wczytania danych z pliku xml. Czy jest taka możliwość aby adres e-mail oraz numer telefonu zostały zaczytywane do EN przez plik xml? Ktoś spotkał się z tym problemem?

Ewentualnie zostały by Prosta Paczka, lecz to rozwiązanie byłoby w ostateczności.

Pozdrawiam

Link to postu
12 minut temu, Bartosz Rosa napisał:

W strukturze adresowej w danych eksportu są pola s:PhoneNumber oraz s:Email więc można się nimi posłużyć w transformacie.

W pliku który znalazłem z 2010 roku https://e-nadawca.poczta-polska.pl/?action=GetIntegration Specyfikacja Interfejsu Wymiany Danych (XML) jest informacja:

Typ=””
Nazwa=”KontaktAdresata”

CHAR (50)
lub
CHAR (9)

Informuje o konkretnej wartości dla
sposobu powiadomienia adresata:
e-mail (50 znaków), SMS (9 cyfr)

Część, która odpowiada za export e-mail oraz telefonu (formułę exportu adresu e-mail dostałem sam)

				<xsl:variable name="phone" select="translate(s:DeliveryAddress/s:PhoneNumber,'- ()/','')"/>
				<xsl:variable name="phone2" select="format-number(substring($phone,string-length($phone)-8,9),'000000000')"/>
				<xsl:choose>
					<xsl:when test="starts-with($phone2,'50') or starts-with($phone2,'51') or starts-with($phone2,'53') or starts-with($phone2,'57') or starts-with($phone2,'60') or starts-with($phone2,'66') or starts-with($phone2,'69') or starts-with($phone2,'72') or starts-with($phone2,'73') or starts-with($phone2,'78') or starts-with($phone2,'79') or starts-with($phone2,'88')">
						<xsl:element name="Atrybut">
							<xsl:attribute name="Typ"/>
							<xsl:attribute name="Nazwa">KontaktAdresata</xsl:attribute>
							<xsl:value-of select="$phone2"/>
						</xsl:element>
					</xsl:when>
					<!--Jeśli klient poda numer komórkowy to wstawi się jego numer komórkowy-->
					<xsl:otherwise>
						<xsl:if test="string-length(s:DeliveryAddress/s:NIP) = 6">
							<xsl:element name="Atrybut">
								<xsl:attribute name="Typ"/>
								<xsl:attribute name="Nazwa">KontaktAdresata</xsl:attribute>
								<!--Powyżej zamiast 123456789 wpisujemy swój numer komórki, jeśli klient poda numer stacjonarny i będzie to odbiór w punkcie to powiadomienie przyjdzie na nasz numer komórki, bo jakąś komórkę trzeba wtedy podać-->
								<!--Jeśli klient poda numer stacjonarny i będzie to zwykła biznesówka to wstawi się puste pole, a telefon klienta można wstawić w pole opisu przesyłki -->
							</xsl:element>
						</xsl:if>
					</xsl:otherwise>
				</xsl:choose>
<xsl:variable name="email" select="s:DeliveryAddress/s:Email"/>
						<xsl:element name="Atrybut">
							<xsl:attribute name="Typ"/>
							<xsl:attribute name="Nazwa">KontaktAdresata</xsl:attribute>
							<xsl:value-of select="$email"/>
						</xsl:element>

Cała transformata do co Biznesa wygląda następująco (jeszcze jej nie modyfikowałem do przesyłek Allegrowych, ale może komuś się przyda)

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.sello.pl/export">
	<xsl:variable name="NrUmowy"></xsl:variable>
	<xsl:variable name="KartaUmowy"></xsl:variable>
	<xsl:variable name="Gabaryt">XS</xsl:variable>
	<xsl:variable name="Firmowa">T</xsl:variable>
	<xsl:variable name="Miejscowa">T</xsl:variable>
	<xsl:variable name="Ubezpieczona"></xsl:variable>
	<xsl:variable name="Gabaryt2">A</xsl:variable>
	<xsl:variable name="FormaPowiadomieniaAdresata"></xsl:variable>
	<xsl:template name="TytulPrzelewu">
                <xsl:value-of select="translate(s:SendingNumber,'- ','')"/>
	</xsl:template>
	<xsl:template name="Opis">
		<xsl:value-of select="s:Symbol"/><xsl:text>  </xsl:text><xsl:value-of select="substring(s:Customer/s:Nick,0,15)"/>
	</xsl:template>
	<xsl:template name="PniUP">
                                <xsl:value-of select="substring(substring-after(s:DeliveryAddress/s:Name, '('), 1, 6)"/>
	</xsl:template>

	<xsl:template name="Opis2">
		<xsl:value-of select="s:Symbol"/><xsl:text>  </xsl:text><xsl:value-of select="substring(s:Customer/s:Nick,0,15)"/>
	</xsl:template>
	<xsl:param name="Year"/>
	<xsl:param name="Month"/>
	<xsl:param name="Day"/>
	<xsl:param name="Hour"/>
	<xsl:param name="Minute"/>
	<xsl:param name="Second"/>
	<xsl:template match="s:ExportData">
		<xsl:element name="Nadawca">
			<xsl:attribute name="Struktura">1.6</xsl:attribute>
			<xsl:attribute name="Nazwa">
				<xsl:value-of select="s:Company/s:Address/s:Company"/>
			</xsl:attribute>
			<xsl:attribute name="NazwaSkrocona">
				<xsl:variable name="companyName" select="s:Company/s:Address/s:Company"/>
				<xsl:value-of select="substring($companyName,0,10)"/>
			</xsl:attribute>
			<xsl:attribute name="Ulica">
				<xsl:value-of select="s:Company/s:Address/s:Street"/>
			</xsl:attribute>
			<xsl:attribute name="Dom">
				<xsl:value-of select="s:Company/s:Address/s:HouseNumber"/>
			</xsl:attribute>
			<xsl:attribute name="Lokal">
				<xsl:value-of select="s:Company/s:Address/s:FlatNumber"/>
			</xsl:attribute>
			<xsl:attribute name="Miejscowosc">
				<xsl:value-of select="s:Company/s:Address/s:City"/>
			</xsl:attribute>
			<xsl:attribute name="Kod">
				<xsl:value-of select="translate(s:Company/s:Address/s:ZipCode,'- ','')"/>
			</xsl:attribute>
			<xsl:attribute name="NIP">
				<xsl:value-of select="translate(s:Company/s:Address/s:NIP,'- ','')"/>
			</xsl:attribute>
			<xsl:attribute name="Zrodlo">NADAWCA</xsl:attribute>
			<xsl:attribute name="Guid">
				<xsl:value-of select="s:Company/s:GUID"/>
			</xsl:attribute>
			<xsl:element name="Zbior">
				<xsl:attribute name="Nazwa">
					<xsl:value-of select="concat(format-number($Day,'00'),'-',format-number($Month,'00'),'-',$Year,'\1')"/>
				</xsl:attribute>
				<xsl:attribute name="DataUtworzenia">
					<xsl:value-of select="concat($Year,'-',format-number($Month,'00'),'-',format-number($Day,'00'),'T',format-number($Hour,'00'),':',format-number($Minute,'00'),':',format-number($Second,'00'))"/>
				</xsl:attribute>
				<xsl:attribute name="Opis">Jakis dowolny opis</xsl:attribute>
				<xsl:attribute name="IloscPrzesylek">
					<xsl:value-of select="count(s:Package)"/>
				</xsl:attribute>
				<xsl:attribute name="Guid">
					<xsl:value-of select="s:GUID"/>
				</xsl:attribute>
				<xsl:apply-templates select="s:Package"/>
			</xsl:element>
		</xsl:element>
	</xsl:template>
	<xsl:template match="s:Package">
		<!--biznesowa 852-->
		<xsl:if test="s:DeliveryMethod/s:DeliveryName='PRZESYŁKA BIZNESOWA' or s:DeliveryMethod/s:DeliveryName='PRZESYŁKA BIZNESOWA POBRANIE' or s:DeliveryMethod/s:DeliveryName='Przesyłka pobraniowa ekonomiczna (Paczka48)' or s:DeliveryMethod/s:DeliveryName='PRZESYŁKA BIZNESOWA ODBIÓR W PUNKCIE' or s:DeliveryMethod/s:DeliveryName='E-PRZESYŁKA' or s:DeliveryMethod/s:DeliveryName='E-PRZESYŁKA po przedpłacie'">
			<xsl:element name="Przesylka">
				<xsl:attribute name="Guid">
					<xsl:value-of select="s:GUID"/>
				</xsl:attribute>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ">Adresat</xsl:attribute>
					<xsl:attribute name="Nazwa">Nazwa</xsl:attribute>
					<xsl:choose>
						<xsl:when test="s:DeliveryAddress/s:Company!=''">
							<xsl:value-of select="s:DeliveryAddress/s:Company"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="s:DeliveryAddress/s:Name"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
				<xsl:if test="s:DeliveryAddress/s:Company!='' and s:DeliveryAddress/s:Name!=''">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ">Adresat</xsl:attribute>
						<xsl:attribute name="Nazwa">NazwaII</xsl:attribute>
						<xsl:value-of select="s:DeliveryAddress/s:Name"/>
					</xsl:element>
				</xsl:if>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ">Adresat</xsl:attribute>
					<xsl:attribute name="Nazwa">Ulica</xsl:attribute>
					<xsl:value-of select="s:DeliveryAddress/s:Street"/>
				</xsl:element>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ">Adresat</xsl:attribute>
					<xsl:attribute name="Nazwa">Dom</xsl:attribute>
					<xsl:value-of select="s:DeliveryAddress/s:HouseNumber"/>
				</xsl:element>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ">Adresat</xsl:attribute>
					<xsl:attribute name="Nazwa">Lokal</xsl:attribute>
					<xsl:value-of select="s:DeliveryAddress/s:FlatNumber"/>
				</xsl:element>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ">Adresat</xsl:attribute>
					<xsl:attribute name="Nazwa">Miejscowosc</xsl:attribute>
					<xsl:value-of select="s:DeliveryAddress/s:City"/>
				</xsl:element>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ">Adresat</xsl:attribute>
					<xsl:attribute name="Nazwa">Kod</xsl:attribute>
					<xsl:value-of select="translate(s:DeliveryAddress/s:ZipCode,'- ','')"/>
				</xsl:element>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ">Adresat</xsl:attribute>
					<xsl:attribute name="Nazwa">Kraj</xsl:attribute>
					<xsl:choose>
						<xsl:when test="s:DeliveryAddress/s:Country=''">Polska</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="s:DeliveryAddress/s:Country"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
				<!--Atrybuty specyficzne dla przesyłki 852-->
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ"/>
					<xsl:attribute name="Nazwa">Symbol</xsl:attribute>852</xsl:element>
				<xsl:if test="$NrUmowy!=''">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ"/>
						<xsl:attribute name="Nazwa">Umowa</xsl:attribute>
						<xsl:value-of select="$NrUmowy"/>
					</xsl:element>
				</xsl:if>
				<xsl:if test="$KartaUmowy!=''">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ"/>
						<xsl:attribute name="Nazwa">KartaUmowy</xsl:attribute>
						<xsl:value-of select="$KartaUmowy"/>
					</xsl:element>
				</xsl:if>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ"/>
					<xsl:attribute name="Nazwa">SposobPobrania</xsl:attribute>
					<xsl:choose>
						<xsl:when test="s:DeliveryMethod/s:IsPayOnDelivery=1">S</xsl:when>
						<xsl:otherwise>T</xsl:otherwise>
					</xsl:choose>
				</xsl:element>
				<xsl:if test="s:Charge">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ"/>
						<xsl:attribute name="Nazwa">KwotaPobrania</xsl:attribute>
						<xsl:value-of select="round(number(s:Charge)*100)"/>
					</xsl:element>
				</xsl:if>
				<xsl:if test="s:Weight">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ"/>
						<xsl:attribute name="Nazwa">Masa</xsl:attribute>
						<xsl:value-of select="round(number(s:Weight)*1000)"/>
					</xsl:element>
				</xsl:if><xsl:element name="Atrybut">
<xsl:attribute name="Typ"/>
<xsl:attribute name="Nazwa">Uslugi</xsl:attribute>U</xsl:element>
<xsl:element name="Atrybut">
<xsl:attribute name="Typ"/>
<xsl:attribute name="Nazwa">UbezpieczenieOpcja</xsl:attribute>D</xsl:element>
<xsl:element name="Atrybut">
<xsl:attribute name="Typ"/>
<xsl:attribute name="Nazwa">UbezpieczenieKwota</xsl:attribute>100000</xsl:element>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ"/>
					<xsl:attribute name="Nazwa">Strefa</xsl:attribute>
					<xsl:value-of select="$Gabaryt"/>
				</xsl:element>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ"/>
					<xsl:attribute name="Nazwa">Ilosc</xsl:attribute>1</xsl:element>
				<xsl:if test="s:SendingNumber!=''">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ"/>
						<xsl:attribute name="Nazwa">NrNadania</xsl:attribute>
						<xsl:value-of select="translate(s:SendingNumber,'- ','')"/>
					</xsl:element>
				</xsl:if>
				<xsl:variable name="phone" select="translate(s:DeliveryAddress/s:PhoneNumber,'- ()/','')"/>
				<xsl:variable name="phone2" select="format-number(substring($phone,string-length($phone)-8,9),'000000000')"/>
				<xsl:choose>
					<xsl:when test="starts-with($phone2,'50') or starts-with($phone2,'51') or starts-with($phone2,'53') or starts-with($phone2,'57') or starts-with($phone2,'60') or starts-with($phone2,'66') or starts-with($phone2,'69') or starts-with($phone2,'72') or starts-with($phone2,'73') or starts-with($phone2,'78') or starts-with($phone2,'79') or starts-with($phone2,'88')">
						<xsl:element name="Atrybut">
							<xsl:attribute name="Typ"/>
							<xsl:attribute name="Nazwa">KontaktAdresata</xsl:attribute>
							<xsl:value-of select="$phone2"/>
						</xsl:element>
					</xsl:when>
					<!--Jeśli klient poda numer komórkowy to wstawi się jego numer komórkowy-->
					<xsl:otherwise>
						<xsl:if test="string-length(s:DeliveryAddress/s:NIP) = 6">
							<xsl:element name="Atrybut">
								<xsl:attribute name="Typ"/>
								<xsl:attribute name="Nazwa">KontaktAdresata</xsl:attribute>
								<!--Powyżej zamiast 123456789 wpisujemy swój numer komórki, jeśli klient poda numer stacjonarny i będzie to odbiór w punkcie to powiadomienie przyjdzie na nasz numer komórki, bo jakąś komórkę trzeba wtedy podać-->
								<!--Jeśli klient poda numer stacjonarny i będzie to zwykła biznesówka to wstawi się puste pole, a telefon klienta można wstawić w pole opisu przesyłki -->
							</xsl:element>
						</xsl:if>
					</xsl:otherwise>
				</xsl:choose>
<xsl:variable name="email" select="s:DeliveryAddress/s:Email"/>
						<xsl:element name="Atrybut">
							<xsl:attribute name="Typ"/>
							<xsl:attribute name="Nazwa">KontaktAdresata</xsl:attribute>
							<xsl:value-of select="$email"/>
						</xsl:element>			
				<xsl:variable name="title">
					<xsl:call-template name="TytulPrzelewu"/>
				</xsl:variable>
				<xsl:if test="$title!='' and s:DeliveryMethod/s:IsPayOnDelivery=1">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ"/>
						<xsl:attribute name="Nazwa">PrzelewTytul</xsl:attribute>
						<xsl:value-of select="$title"/>
					</xsl:element>
				</xsl:if>
				<xsl:element name="Atrybut">
					<xsl:attribute name="Typ"/>
					<xsl:attribute name="Nazwa">Wersja</xsl:attribute>1</xsl:element>
				<xsl:variable name="description">
					<xsl:call-template name="Opis"/>
				</xsl:variable>
				<xsl:if test="$description!=''">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ"/>
						<xsl:attribute name="Nazwa">Uwagi</xsl:attribute>
						<xsl:value-of select="$description"/>
					</xsl:element>
				</xsl:if>
				<xsl:variable name="PniUP">
					<xsl:call-template name="PniUP"/>
				</xsl:variable>
				<xsl:if test="$PniUP!=''">
					<xsl:element name="Atrybut">
						<xsl:attribute name="Typ"/>
						<xsl:attribute name="Nazwa">PniUP</xsl:attribute>
						<xsl:value-of select="$PniUP"/>
					</xsl:element>
				</xsl:if>
			</xsl:element>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>

W pliku, który się eksportuje są wartości e-mail oraz telefon jako KontaktAdresata, lecz po wczytaniu do EN, zaczytuje się jedynie adres e-mail klienta. Wcześniej tego nie potrzebowaliśmy, więc nr telefonu wystarczał, ale do przesyłek Allegrowych potrzebny jest również adres e-mail. Tu niestety mam problem, ponieważ nie wiem jak "zmapować" w pliku pola, tak aby EN zaczytywał numer telefonu oraz adres e-mail klienta.

Czy mógłby, ktoś z tym pomóc, kto ma większą wiedzę ode mnie? ?

Link to postu
  • 1 rok później...

Dołącz do dyskusji

Możesz dodać zawartość już teraz a zarejestrować się później. Jeśli posiadasz już konto, zaloguj się aby dodać zawartość za jego pomocą.
Uwaga: Twój wpis zanim będzie widoczny, będzie wymagał zatwierdzenia moderatora.

Użytkownik forum
Odpowiedz...

×   Wklejono zawartość z formatowaniem.   Usuń formatowanie

  Dozwolonych jest tylko 75 emoji.

×   Odnośnik został automatycznie osadzony.   Przywróć wyświetlanie jako odnośnik

×   Przywrócono poprzednią zawartość.   Wyczyść edytor

×   Nie możesz bezpośrednio wkleić grafiki. Dodaj lub załącz grafiki z adresu URL.

×
×
  • Dodaj nową pozycję...