@infrab4a/connect 5.7.9 → 5.7.10-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -10765,20 +10765,24 @@ class PagarMeV5RequestHelper {
10765
10765
  };
10766
10766
  }
10767
10767
  static getCardOrder(checkout, card) {
10768
+ const billingAddress = {
10769
+ line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
10770
+ zip_code: checkout.billingAddress.zip,
10771
+ city: checkout.billingAddress.city,
10772
+ state: checkout.billingAddress.state,
10773
+ country: 'BR',
10774
+ };
10775
+ // Tokenized charges (e.g. shopping recurrence renewals) must not send empty/undefined CVV.
10776
+ // First checkout still passes cardCvv when the shopper types it.
10777
+ const cardPayload = {
10778
+ billing_address: billingAddress,
10779
+ ...(card.cardCvv ? { cvv: card.cardCvv } : {}),
10780
+ };
10768
10781
  return {
10769
10782
  installments: card.installments,
10770
10783
  statement_descriptor: checkout.shop === exports.Shops.GLAMSHOP ? 'loja glam' : 'mens market',
10771
10784
  card_id: card.cardId,
10772
- card: {
10773
- cvv: card.cardCvv,
10774
- billing_address: {
10775
- line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
10776
- zip_code: checkout.billingAddress.zip,
10777
- city: checkout.billingAddress.city,
10778
- state: checkout.billingAddress.state,
10779
- country: 'BR',
10780
- },
10781
- },
10785
+ card: cardPayload,
10782
10786
  };
10783
10787
  }
10784
10788
  static buildAdditionalInfo(checkout) {
package/index.esm.js CHANGED
@@ -10759,20 +10759,24 @@ class PagarMeV5RequestHelper {
10759
10759
  };
10760
10760
  }
10761
10761
  static getCardOrder(checkout, card) {
10762
+ const billingAddress = {
10763
+ line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
10764
+ zip_code: checkout.billingAddress.zip,
10765
+ city: checkout.billingAddress.city,
10766
+ state: checkout.billingAddress.state,
10767
+ country: 'BR',
10768
+ };
10769
+ // Tokenized charges (e.g. shopping recurrence renewals) must not send empty/undefined CVV.
10770
+ // First checkout still passes cardCvv when the shopper types it.
10771
+ const cardPayload = {
10772
+ billing_address: billingAddress,
10773
+ ...(card.cardCvv ? { cvv: card.cardCvv } : {}),
10774
+ };
10762
10775
  return {
10763
10776
  installments: card.installments,
10764
10777
  statement_descriptor: checkout.shop === Shops.GLAMSHOP ? 'loja glam' : 'mens market',
10765
10778
  card_id: card.cardId,
10766
- card: {
10767
- cvv: card.cardCvv,
10768
- billing_address: {
10769
- line_1: `${checkout.billingAddress.number}, ${checkout.billingAddress.street}, ${checkout.billingAddress.district}`,
10770
- zip_code: checkout.billingAddress.zip,
10771
- city: checkout.billingAddress.city,
10772
- state: checkout.billingAddress.state,
10773
- country: 'BR',
10774
- },
10775
- },
10779
+ card: cardPayload,
10776
10780
  };
10777
10781
  }
10778
10782
  static buildAdditionalInfo(checkout) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infrab4a/connect",
3
- "version": "5.7.9",
3
+ "version": "5.7.10-alpha.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org"
6
6
  },
@@ -1,8 +1,7 @@
1
1
  import { Shops } from '../../../catalog/models/enums/shops.enum';
2
2
  import { BaseModel, GenericIdentifier } from '../../../generic/model/base.model';
3
3
  import { User, UserAddress } from '../../../users';
4
- import { PaymentMethod } from '../../types';
5
- import { PaymentProvider } from '../../types/payment-provider.type';
4
+ import { CardForPaymentInfo, PaymentMethod } from '../../types';
6
5
  import { Coupon } from '../coupons/coupon';
7
6
  import { ShoppingRecurrenceCycle } from '../enums/shopping-recurrence-cycle.enum';
8
7
  import { ShoppingRecurrenceStatus } from '../enums/shopping-recurrence-status.enum';
@@ -23,10 +22,7 @@ export declare class ShoppingRecurrence extends BaseModel<ShoppingRecurrence> {
23
22
  discount?: number;
24
23
  totalPrice: number;
25
24
  paymentMethod: PaymentMethod;
26
- cards: Array<{
27
- paymentProvider: PaymentProvider;
28
- cardId: string;
29
- }>;
25
+ cards: CardForPaymentInfo[];
30
26
  originalOrderId: string;
31
27
  lastOrderId?: string;
32
28
  user: User;
@@ -5,7 +5,7 @@ import { FirestoreRepository, FirestoreSubRepository } from '../types';
5
5
  export declare const withHelpers: <TMixinBase extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: MixinCtor<any, any[]> & TMixinBase) => {
6
6
  new (...args: any[]): {
7
7
  [x: string]: any;
8
- toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T, import("firebase/firestore").DocumentData> | QueryDocumentSnapshot<T, import("firebase/firestore").DocumentData>[]): T[];
8
+ toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T> | QueryDocumentSnapshot<T>[]): T[];
9
9
  isSubCollection<T_1 extends ModelBaseStructure<T_1, T_1["identifiersFields"][number]>, E extends ModelBaseStructure<E, E["identifiersFields"][number]>>(repository: FirestoreRepository<T_1> | FirestoreSubRepository<T_1, E>): repository is FirestoreSubRepository<T_1, E>;
10
10
  };
11
11
  } & TMixinBase;
@@ -65,7 +65,8 @@ export type PagarMeV5OrderPaymentCardInfo = {
65
65
  statement_descriptor: string;
66
66
  card_id: string;
67
67
  card: {
68
- cvv: string;
68
+ /** Present only on first charge when the shopper types CVV. Omitted for tokenized renewals. */
69
+ cvv?: string;
69
70
  billing_address?: {
70
71
  line_1: string;
71
72
  zip_code: string;