@blockchyp/blockchyp-ts 2.28.0 → 2.30.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockchyp/blockchyp-ts",
3
- "version": "2.28.0",
3
+ "version": "2.30.0",
4
4
  "description": "BlockChyp Typescript Client",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -72,7 +72,6 @@
72
72
  "@noble/hashes": "^1.5.0",
73
73
  "glob": "^13.0.0",
74
74
  "moment": "^2.22.2",
75
- "npm": "^11.6.3",
76
75
  "stream-browserify": "^3.0.0",
77
76
  "uuidv4": "^6.2.13"
78
77
  }
package/src/client.ts CHANGED
@@ -317,6 +317,13 @@ export class BlockChypClient {
317
317
  return this._gatewayRequest('post', '/api/terminal-locate', request);
318
318
  }
319
319
 
320
+ /**
321
+ * Calculates surcharge information for a payment request.
322
+ */
323
+ surchargeReview(request: Models.PricingRequest): Promise<AxiosResponse<Models.PricingResponse>> {
324
+ return this._gatewayRequest('post', '/api/surcharge-review', request);
325
+ }
326
+
320
327
  /**
321
328
  * Captures a preauthorization.
322
329
  */
package/src/models.ts CHANGED
@@ -2595,20 +2595,54 @@ export class AuthorizationRequest {
2595
2595
  cardMetadataLookup?: boolean;
2596
2596
 
2597
2597
  /**
2598
- * The shipping cost associated with the transaction
2598
+ * The total discount amount for the transaction, and will overide additive logic for
2599
+ * line item discounts.
2600
+ */
2601
+ totalDiscountAmount?: string;
2602
+
2603
+ /**
2604
+ * The shipping cost associated with the transaction.
2599
2605
  */
2600
2606
  shippingAmount?: string;
2601
2607
 
2602
2608
  /**
2603
- * The processor ID associated with the transaction
2609
+ * The duty amount associated with the transaction.
2610
+ */
2611
+ dutyAmount?: string;
2612
+
2613
+ /**
2614
+ * The processor ID associated with the transaction.
2604
2615
  */
2605
2616
  processorId?: string;
2606
2617
 
2607
2618
  /**
2608
- * The external customer ID associated with the transaction
2619
+ * The external customer ID associated with the transaction.
2609
2620
  */
2610
2621
  externalCustomerId?: string;
2611
2622
 
2623
+ /**
2624
+ * Three character, numeric, ship-to country code. Defaults to '840' (USA) if not
2625
+ * specified.
2626
+ */
2627
+ destinationCountryCode?: string;
2628
+
2629
+ /**
2630
+ * Nine character postal code for shipping origin addresses. For US addresses, this is a
2631
+ * 5+4 ZIP or five digit ZIP.
2632
+ */
2633
+ shipFromPostalCode?: string;
2634
+
2635
+ /**
2636
+ * Nine character postal code for shipping destination addresses. For US addresses,
2637
+ * this is a 5+4 ZIP or five digit ZIP.
2638
+ */
2639
+ shipToPostalCode?: string;
2640
+
2641
+ /**
2642
+ * The purchase order date.
2643
+ */
2644
+ orderDate?: Date;
2645
+
2612
2646
  // Constructor with default values for optional fields
2613
2647
  constructor(
2614
2648
  timeout: number | null = null,
@@ -2684,9 +2718,15 @@ export class AuthorizationRequest {
2684
2718
  healthcareTotal: string | undefined = undefined,
2685
2719
  ebtTotal: string | undefined = undefined,
2686
2720
  cardMetadataLookup: boolean = false,
2721
+ totalDiscountAmount: string | undefined = undefined,
2687
2722
  shippingAmount: string | undefined = undefined,
2723
+ dutyAmount: string | undefined = undefined,
2688
2724
  processorId: string | undefined = undefined,
2689
2725
  externalCustomerId: string | undefined = undefined,
2726
+ destinationCountryCode: string | undefined = undefined,
2727
+ shipFromPostalCode: string | undefined = undefined,
2728
+ shipToPostalCode: string | undefined = undefined,
2729
+ orderDate: Date | undefined = undefined,
2690
2730
  ) {
2691
2731
  this.timeout = timeout;
2692
2732
  this.test = test;
@@ -2761,9 +2801,15 @@ export class AuthorizationRequest {
2761
2801
  this.healthcareTotal = healthcareTotal;
2762
2802
  this.ebtTotal = ebtTotal;
2763
2803
  this.cardMetadataLookup = cardMetadataLookup;
2804
+ this.totalDiscountAmount = totalDiscountAmount;
2764
2805
  this.shippingAmount = shippingAmount;
2806
+ this.dutyAmount = dutyAmount;
2765
2807
  this.processorId = processorId;
2766
2808
  this.externalCustomerId = externalCustomerId;
2809
+ this.destinationCountryCode = destinationCountryCode;
2810
+ this.shipFromPostalCode = shipFromPostalCode;
2811
+ this.shipToPostalCode = shipToPostalCode;
2812
+ this.orderDate = orderDate;
2767
2813
  }
2768
2814
  }
2769
2815
 
@@ -4236,6 +4282,12 @@ export class CaptureRequest {
4236
4282
  */
4237
4283
  shipmentNumber: number | null = null;
4238
4284
 
4285
+ /**
4286
+ * A passthrough surcharge amount. This surcharge amount will be passed directly to the
4287
+ * gateway and is not directly calculated.
4288
+ */
4289
+ passthroughSurcharge?: string;
4290
+
4239
4291
  // Constructor with default values for optional fields
4240
4292
  constructor(
4241
4293
  timeout: number | null = null,
@@ -4259,6 +4311,7 @@ export class CaptureRequest {
4259
4311
  taxAmount: string | undefined = undefined,
4260
4312
  shipmentCount: number | null = null,
4261
4313
  shipmentNumber: number | null = null,
4314
+ passthroughSurcharge: string | undefined = undefined,
4262
4315
  ) {
4263
4316
  this.timeout = timeout;
4264
4317
  this.test = test;
@@ -4281,6 +4334,7 @@ export class CaptureRequest {
4281
4334
  this.taxAmount = taxAmount;
4282
4335
  this.shipmentCount = shipmentCount;
4283
4336
  this.shipmentNumber = shipmentNumber;
4337
+ this.passthroughSurcharge = passthroughSurcharge;
4284
4338
  }
4285
4339
  }
4286
4340
 
@@ -7660,6 +7714,22 @@ export class TransactionDisplayItem {
7660
7714
  */
7661
7715
  discounts: TransactionDisplayDiscount[] | null = null;
7662
7716
 
7717
+ /**
7718
+ * The amount of any value added taxes which apply to the item.
7719
+ */
7720
+ taxAmount?: string;
7721
+
7722
+ /**
7723
+ * The tax rate as a percentage. Example: '8.5' for 8.5% tax rate.
7724
+ */
7725
+ taxRate?: string;
7726
+
7727
+ /**
7728
+ * How tax was applied to discounted items. '0' = no discount, '1' = tax calculated after
7729
+ * discount, '2' = taxcalculated before discount.
7730
+ */
7731
+ discountCode?: string;
7732
+
7663
7733
  // Constructor with default values for optional fields
7664
7734
  constructor(
7665
7735
  id: string | null = null,
@@ -7671,6 +7741,9 @@ export class TransactionDisplayItem {
7671
7741
  commodityCode: string | null = null,
7672
7742
  productCode: string | null = null,
7673
7743
  discounts: TransactionDisplayDiscount[] | null = null,
7744
+ taxAmount: string | undefined = undefined,
7745
+ taxRate: string | undefined = undefined,
7746
+ discountCode: string | undefined = undefined,
7674
7747
  ) {
7675
7748
  this.id = id;
7676
7749
  this.description = description;
@@ -7681,6 +7754,9 @@ export class TransactionDisplayItem {
7681
7754
  this.commodityCode = commodityCode;
7682
7755
  this.productCode = productCode;
7683
7756
  this.discounts = discounts;
7757
+ this.taxAmount = taxAmount;
7758
+ this.taxRate = taxRate;
7759
+ this.discountCode = discountCode;
7684
7760
  }
7685
7761
  }
7686
7762
 
@@ -17667,6 +17743,427 @@ export class SubmitApplicationRequest {
17667
17743
  }
17668
17744
  }
17669
17745
 
17746
+ /**
17747
+ * Models settings related to state checks for a merchant.
17748
+ */
17749
+ export class StateCheckSettings {
17750
+
17751
+ /**
17752
+ * If state checks are enabled for the merchant.
17753
+ */
17754
+ enabled: boolean | null = null;
17755
+
17756
+ /**
17757
+ * The list of states that are exempt from surcharges.
17758
+ */
17759
+ surchargeExemptStates: string[] | null = null;
17760
+
17761
+ // Constructor with default values for optional fields
17762
+ constructor(
17763
+ enabled: boolean | null = null,
17764
+ surchargeExemptStates: string[] | null = null,
17765
+ ) {
17766
+ this.enabled = enabled;
17767
+ this.surchargeExemptStates = surchargeExemptStates;
17768
+ }
17769
+ }
17770
+
17771
+ /**
17772
+ * Models merchant settings and configuration.
17773
+ */
17774
+ export class PricingMerchantSettings {
17775
+
17776
+ /**
17777
+ * The merchant account identifier.
17778
+ */
17779
+ account: string | null = null;
17780
+
17781
+ /**
17782
+ * The gateway identifier.
17783
+ */
17784
+ gateway: string | null = null;
17785
+
17786
+ /**
17787
+ * Whether surcharging is enabled for the merchant.
17788
+ */
17789
+ surchargingEnabled: boolean | null = null;
17790
+
17791
+ /**
17792
+ * The custom surcharge percentage, if applicable.
17793
+ */
17794
+ customSurchargePercent?: number;
17795
+
17796
+ /**
17797
+ * If reduced rate pricing is enabled.
17798
+ */
17799
+ reducedRate?: boolean;
17800
+
17801
+ /**
17802
+ * If inverse pricing is enabled.
17803
+ */
17804
+ inversePricingEnabled?: boolean;
17805
+
17806
+ /**
17807
+ * The credit discount rate, if applicable.
17808
+ */
17809
+ creditDiscountRate?: number;
17810
+
17811
+ /**
17812
+ * The acquiring solution identifier.
17813
+ */
17814
+ acquiringSolution: string | null = null;
17815
+
17816
+ /**
17817
+ * Whether the merchant accepts debit cards.
17818
+ */
17819
+ acceptDebit?: boolean;
17820
+
17821
+ /**
17822
+ * State check settings for the merchant.
17823
+ */
17824
+ stateCheckSettings?: StateCheckSettings;
17825
+
17826
+ // Constructor with default values for optional fields
17827
+ constructor(
17828
+ account: string | null = null,
17829
+ gateway: string | null = null,
17830
+ surchargingEnabled: boolean | null = null,
17831
+ customSurchargePercent: number = 0,
17832
+ reducedRate: boolean = false,
17833
+ inversePricingEnabled: boolean = false,
17834
+ creditDiscountRate: number = 0,
17835
+ acquiringSolution: string | null = null,
17836
+ acceptDebit: boolean = false,
17837
+ stateCheckSettings: StateCheckSettings | undefined = undefined,
17838
+ ) {
17839
+ this.account = account;
17840
+ this.gateway = gateway;
17841
+ this.surchargingEnabled = surchargingEnabled;
17842
+ this.customSurchargePercent = customSurchargePercent;
17843
+ this.reducedRate = reducedRate;
17844
+ this.inversePricingEnabled = inversePricingEnabled;
17845
+ this.creditDiscountRate = creditDiscountRate;
17846
+ this.acquiringSolution = acquiringSolution;
17847
+ this.acceptDebit = acceptDebit;
17848
+ this.stateCheckSettings = stateCheckSettings;
17849
+ }
17850
+ }
17851
+
17852
+ /**
17853
+ * Models the attributes for a pricing request.
17854
+ */
17855
+ export class PricingRequestAttributes {
17856
+
17857
+ /**
17858
+ * The card number for the pricing request.
17859
+ */
17860
+ cardNumber?: string;
17861
+
17862
+ /**
17863
+ * The payment token.
17864
+ */
17865
+ token: string | null = null;
17866
+
17867
+ /**
17868
+ * The merchant identifier.
17869
+ */
17870
+ merchantIdentifier?: string;
17871
+
17872
+ /**
17873
+ * The transaction amount.
17874
+ */
17875
+ amount: number | null = null;
17876
+
17877
+ /**
17878
+ * The country code.
17879
+ */
17880
+ country?: string;
17881
+
17882
+ /**
17883
+ * The postal code.
17884
+ */
17885
+ postalCode?: string;
17886
+
17887
+ /**
17888
+ * The state or province.
17889
+ */
17890
+ state?: string;
17891
+
17892
+ /**
17893
+ * Merchant settings for the pricing request.
17894
+ */
17895
+ merchantSettings?: PricingMerchantSettings;
17896
+
17897
+ // Constructor with default values for optional fields
17898
+ constructor(
17899
+ cardNumber: string | undefined = undefined,
17900
+ token: string | null = null,
17901
+ merchantIdentifier: string | undefined = undefined,
17902
+ amount: number | null = null,
17903
+ country: string | undefined = undefined,
17904
+ postalCode: string | undefined = undefined,
17905
+ state: string | undefined = undefined,
17906
+ merchantSettings: PricingMerchantSettings | undefined = undefined,
17907
+ ) {
17908
+ this.cardNumber = cardNumber;
17909
+ this.token = token;
17910
+ this.merchantIdentifier = merchantIdentifier;
17911
+ this.amount = amount;
17912
+ this.country = country;
17913
+ this.postalCode = postalCode;
17914
+ this.state = state;
17915
+ this.merchantSettings = merchantSettings;
17916
+ }
17917
+ }
17918
+
17919
+ /**
17920
+ * Models the data wrapper for a pricing request.
17921
+ */
17922
+ export class PricingRequestData {
17923
+
17924
+ /**
17925
+ * The type of the request.
17926
+ */
17927
+ type: string | null = null;
17928
+
17929
+ /**
17930
+ * The pricing request attributes.
17931
+ */
17932
+ attributes: PricingRequestAttributes | null = null;
17933
+
17934
+ // Constructor with default values for optional fields
17935
+ constructor(
17936
+ type: string | null = null,
17937
+ attributes: PricingRequestAttributes | null = null,
17938
+ ) {
17939
+ this.type = type;
17940
+ this.attributes = attributes;
17941
+ }
17942
+ }
17943
+
17944
+ /**
17945
+ * Models a pricing request.
17946
+ */
17947
+ export class PricingRequest {
17948
+
17949
+ /**
17950
+ * The request timeout in seconds.
17951
+ */
17952
+ timeout: number | null = null;
17953
+
17954
+ /**
17955
+ * Whether or not to route transaction to the test gateway.
17956
+ */
17957
+ test: boolean | null = null;
17958
+
17959
+ /**
17960
+ * The pricing request data.
17961
+ */
17962
+ data: PricingRequestData | null = null;
17963
+
17964
+ // Constructor with default values for optional fields
17965
+ constructor(
17966
+ timeout: number | null = null,
17967
+ test: boolean | null = null,
17968
+ data: PricingRequestData | null = null,
17969
+ ) {
17970
+ this.timeout = timeout;
17971
+ this.test = test;
17972
+ this.data = data;
17973
+ }
17974
+ }
17975
+
17976
+ /**
17977
+ * Models pricing response data for new handler for pricing api responses.
17978
+ */
17979
+ export class PricingResponseAttributes {
17980
+
17981
+ /**
17982
+ * The surcharge percentage.
17983
+ */
17984
+ surchargePercent: number | null = null;
17985
+
17986
+ /**
17987
+ * The surcharge amount.
17988
+ */
17989
+ surchargeAmount: number | null = null;
17990
+
17991
+ /**
17992
+ * If the transaction is exempt from surcharges.
17993
+ */
17994
+ surchargeExempt: boolean | null = null;
17995
+
17996
+ /**
17997
+ * The type of card.
17998
+ */
17999
+ cardType: string | null = null;
18000
+
18001
+ /**
18002
+ * The card token.
18003
+ */
18004
+ cardToken?: string;
18005
+
18006
+ /**
18007
+ * The card brand.
18008
+ */
18009
+ brand: string | null = null;
18010
+
18011
+ /**
18012
+ * The bank identification number.
18013
+ */
18014
+ bin: string | null = null;
18015
+
18016
+ /**
18017
+ * The commercial card indicator.
18018
+ */
18019
+ commercialIndicator: string | null = null;
18020
+
18021
+ /**
18022
+ * The disclosure statement.
18023
+ */
18024
+ disclosure?: string;
18025
+
18026
+ /**
18027
+ * The debit card category.
18028
+ */
18029
+ debitCategory: string | null = null;
18030
+
18031
+ /**
18032
+ * The country where the card was issued.
18033
+ */
18034
+ countryIssued: string | null = null;
18035
+
18036
+ /**
18037
+ * The unique identifier for the pricing response.
18038
+ */
18039
+ uuid: string | null = null;
18040
+
18041
+ // Constructor with default values for optional fields
18042
+ constructor(
18043
+ surchargePercent: number | null = null,
18044
+ surchargeAmount: number | null = null,
18045
+ surchargeExempt: boolean | null = null,
18046
+ cardType: string | null = null,
18047
+ cardToken: string | undefined = undefined,
18048
+ brand: string | null = null,
18049
+ bin: string | null = null,
18050
+ commercialIndicator: string | null = null,
18051
+ disclosure: string | undefined = undefined,
18052
+ debitCategory: string | null = null,
18053
+ countryIssued: string | null = null,
18054
+ uuid: string | null = null,
18055
+ ) {
18056
+ this.surchargePercent = surchargePercent;
18057
+ this.surchargeAmount = surchargeAmount;
18058
+ this.surchargeExempt = surchargeExempt;
18059
+ this.cardType = cardType;
18060
+ this.cardToken = cardToken;
18061
+ this.brand = brand;
18062
+ this.bin = bin;
18063
+ this.commercialIndicator = commercialIndicator;
18064
+ this.disclosure = disclosure;
18065
+ this.debitCategory = debitCategory;
18066
+ this.countryIssued = countryIssued;
18067
+ this.uuid = uuid;
18068
+ }
18069
+ }
18070
+
18071
+ /**
18072
+ * Models the data wrapper for a pricing response.
18073
+ */
18074
+ export class PricingResponseData {
18075
+
18076
+ /**
18077
+ * The type of the response.
18078
+ */
18079
+ type: string | null = null;
18080
+
18081
+ /**
18082
+ * The pricing response attributes.
18083
+ */
18084
+ attributes: PricingResponseAttributes | null = null;
18085
+
18086
+ // Constructor with default values for optional fields
18087
+ constructor(
18088
+ type: string | null = null,
18089
+ attributes: PricingResponseAttributes | null = null,
18090
+ ) {
18091
+ this.type = type;
18092
+ this.attributes = attributes;
18093
+ }
18094
+ }
18095
+
18096
+ /**
18097
+ * Models an error response.
18098
+ */
18099
+ export class ErrorType {
18100
+
18101
+ /**
18102
+ * The HTTP status code.
18103
+ */
18104
+ status: number | null = null;
18105
+
18106
+ /**
18107
+ * The error title.
18108
+ */
18109
+ title: string | null = null;
18110
+
18111
+ /**
18112
+ * The detailed error message.
18113
+ */
18114
+ detail: string | null = null;
18115
+
18116
+ // Constructor with default values for optional fields
18117
+ constructor(
18118
+ status: number | null = null,
18119
+ title: string | null = null,
18120
+ detail: string | null = null,
18121
+ ) {
18122
+ this.status = status;
18123
+ this.title = title;
18124
+ this.detail = detail;
18125
+ }
18126
+ }
18127
+
18128
+ /**
18129
+ * Models a pricing response.
18130
+ */
18131
+ export class PricingResponse {
18132
+
18133
+ /**
18134
+ * Whether or not the request succeeded.
18135
+ */
18136
+ success: boolean | null = null;
18137
+
18138
+ /**
18139
+ * The error, if an error occurred.
18140
+ */
18141
+ error: string | null = null;
18142
+
18143
+ /**
18144
+ * A narrative description of the transaction result.
18145
+ */
18146
+ responseDescription: string | null = null;
18147
+
18148
+ /**
18149
+ * The pricing response data.
18150
+ */
18151
+ data: PricingResponseData | null = null;
18152
+
18153
+ // Constructor with default values for optional fields
18154
+ constructor(
18155
+ success: boolean | null = null,
18156
+ error: string | null = null,
18157
+ responseDescription: string | null = null,
18158
+ data: PricingResponseData | null = null,
18159
+ ) {
18160
+ this.success = success;
18161
+ this.error = error;
18162
+ this.responseDescription = responseDescription;
18163
+ this.data = data;
18164
+ }
18165
+ }
18166
+
17670
18167
 
17671
18168
 
17672
18169